-
Notifications
You must be signed in to change notification settings - Fork 2
Helpful git tricks
Mark Scheel edited this page Jan 31, 2022
·
4 revisions
Here is a nice trick for splitting commits buried in history into multiple commits.
Sometimes the git 'diff3' output doesn't make it obvious what to do with a conflict, especially when one of the conflicting commits changes many lines and another changes very few. Try the following commands to see specific diffs:
git diff :1:Filename :2:Filename # Compare current branch with common ancestor
git diff :1:Filename :3:Filename # Compare merged-in branch with common ancestor
git log --merge -p Filename # Show both simultaneously to avoid running two separate commands