Skip to content

Instantly share code, notes, and snippets.

@kuboon
Last active March 21, 2024 06:41
Show Gist options
  • Save kuboon/c4e4ccbc625d52584c8be5a291c2ffd5 to your computer and use it in GitHub Desktop.
Save kuboon/c4e4ccbc625d52584c8be5a291c2ffd5 to your computer and use it in GitHub Desktop.
fish dive into git repo
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
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
@kuboon
Copy link
Author

kuboon commented Jan 1, 2024

copy & paste directly into your fish prompt, then funcsave dive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment