2df443cb35af4cdb6da58515ead496f7c618616b

Author
Pavle Portic <git@theedgeofrage.com>
Committer
Pavle Portic <git@theedgeofrage.com>
Date

Message

Add gdone zsh function

Diff

 1diff --git a/dot_config/zsh/functions/gdone b/dot_config/zsh/functions/gdone
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..8b02ce1a5731d84b8aee539aecf00b9ee2025e3b
 4--- /dev/null
 5+++ b/dot_config/zsh/functions/gdone
 6@@ -0,0 +1,14 @@
 7+# vim: ft=zsh
 8+# Update and switch to master and delete current branch
 9+
10+current=$(git branch --show-current)
11+
12+if [ "$current" == "$(git_main_branch)" ]; then
13+	echo "Cannot delete $(git_main_branch) branch"
14+	return 1
15+fi
16+
17+git switch $(git_main_branch)
18+git fetch --all --prune --jobs=10
19+git branch -D $current
20+unset current