Skip to content

Commit 1aed7af

Browse files
committed
push-brach: auto select current branch if no <branch> arg specified
1 parent 29d58b4 commit 1aed7af

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bin/git-push-branch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ usage () {
1212
}
1313

1414
if [ $# -le 0 ]; then
15-
echo -e "Err: missing argument!\n"
16-
usage 1
15+
# set branch to current branch
16+
branch=$(git branch | grep '*' | cut -d' ' -f2)
17+
else
18+
branch="$1"
1719
fi
1820

19-
git push -u origin "$1"
21+
git push -u origin "$branch"
2022

2123
exit 0

0 commit comments

Comments
 (0)