Skip to content

Commit b77b139

Browse files
committed
(master) added ability to push tags as well by passing --tags flag
1 parent a17a460 commit b77b139

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

push.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
#
1111
# @options
1212
# -q, --quiet Suppress the "Pushing not allowed" warning message and silently exit.
13+
# --tags ALSO pushes tags to remote
1314
# options@
1415
#
1516
# @examples
1617
# 1) push
1718
# # pushes current branch
1819
# 2) push some-other-branch
1920
# # pushes some-other-branch...
21+
# 3) push --tags
22+
# # pushes current branch -AND- pushes any tags
2023
# examples@
2124
#
2225
# @dependencies
@@ -39,6 +42,7 @@ if (( numArgs > 0 && numArgs < 3 )); then
3942
until [ -z "$1" ]; do
4043
[ "$1" = "--admin" ] && [ "$ADMIN" = "true" ] && isAdmin=true
4144
{ [ "$1" = "-q" ] || [ "$1" = "--quiet" ]; } && isQuiet=true
45+
[ "$1" = "--tags" ] && pushTags=true
4246
! echo "$1" | egrep -q "^-" && branch="$1"
4347
shift
4448
done
@@ -108,6 +112,14 @@ if [ "$yn" == "y" ] || [ "$yn" == "Y" ]; then
108112
fi
109113
fi
110114

115+
if [ $pushTags ]; then
116+
echo
117+
echo "Now ${A}pushing${X} tags to: ${COL_GREEN} ${_remote} ${X}"
118+
echo "$ git push --tags ${_remote}"
119+
git push --tags ${_remote}
120+
echo ${O}${H2HL}${X}
121+
fi
122+
111123
hasRemote=$(git config branch.$branch.remote 2> /dev/null)
112124
if [ -z "$hasRemote" ]; then
113125
echo

0 commit comments

Comments
 (0)