git finish helper script delete current branch and update master
When I finished working on feature branch. I can do
1
(BRANCH) $ git finish
2
​
3
cleaning up BRANCH
4
Sure (y/n) ? y
5
Switched to branch 'master'
6
Your branch is up to date with 'origin/master'.
7
Deleted branch BRANCH (was 5a868ef).
8
Pruning origin
9
...
10
Successfully rebased and updated refs/heads/master.
11
​
12
(master) $
Copied!
Put this script to /usr/local/bin/git-finish
1
#!/bin/bash
2
branch_name=$(git branch | grep \* | cut -d ' ' -f2)
3
echo "cleaning up $branch_name"
4
echo -n "Sure (y/n) ? "
5
read input < /dev/tty
6
if [ "$input" == "y" ]; then
7
git checkout master
8
git branch -D $branch_name
9
git remote prune origin
10
git fetch origin
11
git pull --rebase --autostash
12
fi
Copied!
Last modified 1mo ago
Copy link