常用的git命令

注释,请重视:
所有开发工作请在本地分支执行,需要提交的时候请先切换分支同步主干代码
要求:修改完一个问题单就将该问题单提交到本地,然后上传代码,具体操作请按照下面提到的代码操作流程。
[]:表示可选参数,最好带有参数,逐仓使用
projectname;git库中.git/config文件中remote标签里包含的peojectname值


常用git命令如下:
同步主干代码:    repo sync [projectname]
创建本地分支:    git checkout -b branchname
切换分支:        git checkout branchname
将主干分支更新合并到本地开发: git rebase remote branchname
添加修改到缓存:  git add [-A] [filepath...]
提交修改到本地库:git commit 
补充提交到最新的修改: git commit --amend
撤销修改:        git checkout filepath
删除增加:        git rm filepath      请谨慎使用,除非迫不得已,不建议使用
查看提交记录:    git log [--oneline]
将本地提交上传到主干: repo upload [projectname]


正确的代码操作流程:
1.获得最新代码:
git checkout remote
repo sync
git rebase remote branchname
if(冲突){
解决冲突
git add
git rebase --continue
}
2.进行开发:
代码开发
git add
git commit
3.上传提交:
git checkout remote
repo sync
git rebase remote branchname
if(冲突){
解决冲突
git add
git rebase --continue
}
git rebase branchname remote
repo upload projectname

你可能感兴趣的:(工作,git,upload)