文件添加:
1、git add .
2、git add [file1] [files] …
添加注释
git commit –m “添加Alphga车型判断,添加AEB的LOG打印”
代码推送:
git push origin HEAD:refs/for/xxxxxx
-------xxxxxx表示代码仓库的路径(如:git push origin HEAD:refs/for/master)
回退版本:
git log
列出所有版本号
Git checkout + 某版本号(commit后面的)
查看分支:
git branch 查看本地分支
git branch –r 查看远程分支
git branch –a 查看所有分支
更新代码(同步远程仓库代码到本地):
git pull 从远程分支获取代码并合并到本地分支即将本地代码更新到最新状态
出现Already up-to-data代表本地代码已经更新到和远程仓库一致了
错误处理:
出现:error:The following untracked working tree files would be overwritten by checkout:
执行:git clean –d -fx
切换分支:
git checkout 分支名称
恢复分支文件与远程一致:
git reset –hard origin/xxxxxxx
----------xxxxx 表示分支名称,如:git reset –hard origin/master