我们常常喜欢使用git rebase去切换分支提交代码,操作流程就是:
先切换分支:比如当前是master
我们修改了一堆代码产生一个commit id :5555555567777
那么我们常常比较懒就直接切换了:git checkout dev
然后呢?使用命令git rebase 5555555567777,想把这笔修改提交到dev分支上,有时候呢?没有更新代码就这么操作出现了bug,这种操作模式和git cherry-pick 方式差不多。
常常出现的Bug是什么呢?
git status
On branch devYour branch and 'origin/dev' have diverged,
and have 2 and 3 different commits each, respectively.(use "git pull" to merge the remiote branch into yours)
Last cummand done (1 command done):pick a159982 init XXXSettings
No commands remaining.
You are currently editing a commit while rebasing branch 'dev' on 14a908c"
git commit --amend" to amend the current commit)(use(use"git rebase--continue"”