git代码合并步骤及冲突解决

1.提交代码步骤

1.1对于master分支

git stash缓存当前的改动
git reset --hard放弃当前的改动(慎用)
git pull更新代码
git stash pop
解决冲突
git add .
git commit -m 'description'
git push

1.2 对于其他分支

git chechout -b dev创建分支
git push origin dev提交分支
git merge master 同步Master代码到分支

 

2.git stash多次之后出现冲突怎么解决

直接git reset --hard将代码回到某个版本

然后使用git pull更新代码

最后git stash list查看stash的列表

找到自己当前要提交的改动版本

git stash pop stash@{index}回到指定版本代码

3.git commit之后pull发现代码有冲突如何解决

git reset --soft HEAD~1   撤回一次commit(保留代码)

 

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