//切换分支

git checkout 分支名

 

//创建本地分支

git checkout -b 分支名

 

//提交分支到远程

git push

 

//强制提交分支到远程

git push -f

 

//查看所有分支

git branch -a

 

//删除分支

git branch -d 分支名

 

//撤回修改

git checkout 文件路径

 

//撤回所有修改

git checkout .

 

//把A分支合并到B

1、git checkout B //切换到B分支

2、git rebase A //合并A到B

3、git push -f //提交到远程

 

//获取最新提交

git pull 或 git pull -r

 

//提交本地代码

1、git add .

2、git commit -m'注释'

 

//合并多个提交为一个

git rebase -i head~2

 

//把A分支合并到B

1、git checkout B //切换到B分支

2、git rebase A //合并A到B

如果有冲突,先解决冲突

git rebase --continue 继续

git rebase --abort 撤销合并

3、git push -f //提交到远程

 

//打标签

1、git tag -a {标签版本号} -m '{注释}'  //创建标签

2、git push --tags  //提交标签到远程