Skip to content

Instantly share code, notes, and snippets.

@vaibhav276
Last active August 8, 2016 09:58
Show Gist options
  • Save vaibhav276/8e393ee362b9194f89e8 to your computer and use it in GitHub Desktop.
Save vaibhav276/8e393ee362b9194f89e8 to your computer and use it in GitHub Desktop.
# Show commits diffrence between two branches
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative branch-A..branch-B
# Create patch
git format-patch <branch-to-compare-with> --stdout > <filename>
git format-patch commitStart^..commitLatest --stdout > <filename>
# Apply patch
git apply --check <filename>
git am --signoff < <filename>
# List conflicted files after merge
git diff --name-only --diff-filter=U
# Undo merge
git reset --merge ORIG_HEAD
# View file history
git log -p <file>
# Add files to last commit
git commit --amend –C HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment