Last Updated: May 1, 2025
Merge Commands
git merge branchMerge specified branch into current branch
git merge --no-ff branchForce a merge commit even if fast-forward possible
git merge --squash branchSquash all commits into one before merging
git merge --abortAbort a merge in progress if conflicts arise
git merge --continueContinue merge after resolving conflicts
git merge -X theirs branchAuto-resolve conflicts favoring merged branch
git merge -X ours branchAuto-resolve conflicts favoring current branch
git mergetoolLaunch visual merge tool for conflict resolution
Rebase Commands
git rebase branchReapply current branch commits on top of another
git rebase -i HEAD~3Interactive rebase last 3 commits (squash/fixup/reword)
git rebase --onto newbase oldbaseTransplant branch to a new base commit
git rebase --continueContinue rebase after resolving conflicts
git rebase --skipSkip the current commit during rebase
git rebase --abortAbort rebase and return to original state
git pull --rebaseFetch and rebase instead of merge (cleaner history)
git config --global pull.rebase trueAlways use rebase when pulling
Cherry-Pick & Advanced
git cherry-pick commitApply a specific commit to current branch
git cherry-pick --continueContinue cherry-pick after resolving conflicts
git cherry-pick --abortAbort cherry-pick operation
git reflogShow log of ALL HEAD movements (recovery tool)
git bisect startBegin binary search for a bug-introducing commit
git bisect good commitMark a commit as good during bisect
git bisect bad commitMark a commit as bad during bisect
git bisect resetEnd bisect session and return to original HEAD
Pro Tip: Rebase for a clean linear history on feature branches. Merge when integrating completed work into shared branches.