Last active
March 24, 2024 08:24
-
-
Save nektro/0a332803e43ebca6d5924eb68f981279 to your computer and use it in GitHub Desktop.
This file contains 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
actualrandom() { | |
cat /dev/urandom | head -c $1 | xxd -ps | awk '{printf "0x" $0}' | xargs -0 printf "%d\n" | |
} | |
git-newbranchname() { | |
rand=$(actualrandom 2) | |
echo "nektro-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