对 master 与当前分支的重新定位?
Rebasing against master vs against current branch?
如果我有一个我一直在处理的功能分支并且想要清理它,比如将所有提交压缩为 1 个提交,我会:
根据该功能分支的第一次提交进行变基 git rebase <COMMIT>
;或
对抗高手? git rebase -i master
我不确定两者的用例和区别。
一般来说,您可以使用以下任何一种:
git rebase -i the-other-branch
# pick the first revision, squash the others. That will work
你也可以像我一样做:
git merge -m "Getting updates from main branch" master # do not worry, we will get rid of this revision next
git reset --soft master # now all differences between your branch and master (in other words, all changes related to your feature branch) will be in index
git commit -m "My feature"
希望对您有所帮助。
如果我有一个我一直在处理的功能分支并且想要清理它,比如将所有提交压缩为 1 个提交,我会:
根据该功能分支的第一次提交进行变基
git rebase <COMMIT>
;或对抗高手?
git rebase -i master
我不确定两者的用例和区别。
一般来说,您可以使用以下任何一种:
git rebase -i the-other-branch
# pick the first revision, squash the others. That will work
你也可以像我一样做:
git merge -m "Getting updates from main branch" master # do not worry, we will get rid of this revision next
git reset --soft master # now all differences between your branch and master (in other words, all changes related to your feature branch) will be in index
git commit -m "My feature"
希望对您有所帮助。