navi: Add git patch cheat sheets
This commit is contained in:
@@ -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}'
|
||||
|
||||
Reference in New Issue
Block a user