navi: Add git patch cheat sheets

This commit is contained in:
Robin-Charles Guihéneuf
2026-04-27 13:53:29 +02:00
parent fff6f346cb
commit 1333250def
+25
View File
@@ -67,5 +67,30 @@ git push origin <name>
git tag -d <tag_name>
git push -d origin <tag_name>
# Create a patch from current full diff
git diff > <patch_name>.patch
# Create a patch from current file diff
git diff <diff_file> > <patch_name>.patch
# Create a patch from commit(s)
git format-patch <first_commit>..<last_commit>
# Show a diff patch
git apply --stat <patch_name>
# Check a diff patch
git apply --check <patch_name>
# Apply a diff patch
git apply <patch_name>
# Apply a commit patch
git am <patch_name>
# Variables
$ tag_name: git tag -l | awk '{print $1}'
$ diff_file: git diff --name-only | awk '{print $1}'
$ first_commit: git log -n 20 --oneline | fzf --preview 'git show --color=always {1}' | awk '{print $1}'
$ last_commit: git log -n 20 --oneline | fzf --preview 'git show --color=always {1}' | awk '{print $1}'
$ patch_name: ls *.patch | awk '{print $1}'