Created
August 31, 2023 11:12
-
-
Save hboon/56bd6cc33dcb7fa0589becd645c70be0 to your computer and use it in GitHub Desktop.
Fish shell function to search for a commit on (tmux) screen, generate a branch name and run `gco -b <new-branch> <hash>`
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
#Use this to do `gco -b <branch> <commit>` | |
function pr | |
set --local hash (gcommit) | |
#echo "in our pr: $hash" | |
set --local msg (git show -s --format=%B $hash | head -1) | |
#echo "in our pr: $msg" | |
set --local branch (string lower $msg | string replace -a -r "[ /#]" "-" | string replace -a -r "[\(\)\.\[\]'`\":]" "") | |
#echo "in our pr: $branch" | |
echo "Running: git checkout -b $branch $hash" | |
git checkout -b $branch $hash | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment