Last active
March 21, 2024 06:41
-
-
Save kuboon/c4e4ccbc625d52584c8be5a291c2ffd5 to your computer and use it in GitHub Desktop.
fish dive into git repo
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
function dive | |
set repo $argv[1] | |
if test -z (echo $repo | cut -d '/' -f3) | |
set repo github.com/$repo | |
end | |
set path ~/repos/$repo | |
if test -d $path | |
cd $path | |
echo "Moved to existing directory $path" | |
else | |
mkdir -p $path | |
cd $path | |
git clone https://$repo.git . | |
echo "Cloned $repo and moved to directory $path" | |
end | |
end |
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
function git-begin | |
read -P "Jira: " jira | |
read -P "prefix[fix]: " prefix | |
if test -z "$prefix" | |
set prefix "fix" | |
end | |
read -P "slug: " slug | |
read -P "title[$slug]: " title | |
if test -z "$title" | |
set title $slug | |
end | |
set b "$prefix/$jira-$slug" | |
set t "$jira $title" | |
set c (git branch --show-current) | |
git switch -c $b | |
git commit --allow-empty -m "$t" | |
git push --set-upstream origin $b | |
gh pr create -a @me -b "$ticket_number" --draft --base $c -t "$t" $ARGV | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
copy & paste directly into your fish prompt, then
funcsave dive