Last active
September 29, 2025 10:54
-
-
Save layerok/4688dec10e333372522a5d398df83e73 to your computer and use it in GitHub Desktop.
custom git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // inspired by: https://mlog.nektro.net/ | |
| git-newbranchname() { | |
| rand=$(actualrandom 2) | |
| echo "vova-patch-${rand}" | |
| } | |
| git-newbranch() { | |
| git checkout -b $(git-newbranchname) | |
| } | |
| git-commit2pr() { | |
| current=$(git branch --show-current) | |
| newone=$(git-newbranchname) | |
| patchfile=$(git format-patch HEAD~1) | |
| git reset --merge HEAD~1 | |
| git checkout -q origin/main | |
| git checkout -b ${newone} | |
| git am --reject ${patchfile} | |
| git checkout ${current} | |
| echo "Made new branch ${newone}" | |
| echo "New current HEAD:" | |
| git --no-pager log --oneline HEAD...HEAD~1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment