Merging¶
git rebase¶
Flatten commits
git rebase -i HEAD~4
where 4 is the number of commits- In the text editor, have the
pick
changed tosquash
ors
for commits you don't want
git merge vs git rebase¶
- like
revert
vsreset
- Golden rule of rebasing: only rebase private branches
- Merge will create a new commit
- rebase will just move all the branch's new commits to the end of master's HEAD
-
git rebase -i
is very useful for cleaning up private branches -
how to use the merge tool
git mergetool
Taking all their/our changes¶
- if you're already in a conflict state
git checkout --theirs path/to/file
git checkout --ours path/to/file
- pulling theirs:
git pull -X theirs
Last update:
2023-04-24