get tag/untag
This commit is contained in:
parent
fd17aeaf0a
commit
838fb211e6
2 changed files with 37 additions and 2 deletions
|
|
@ -49,6 +49,8 @@ get diff %REFA% %REFB% | compare %REFA% with %REFB% (git diff %REFA% %REFB%)
|
|||
get undo commit | git reset --soft HEAD~1
|
||||
get push | pushes to upstream. If upstream not set, prompt user to name a remote branch. (If multiple remotes exist, prompt for which remote to use.)
|
||||
get clone %PATH% | %PATH% can be a normal url. Paths like "username/repo" will be expanded assuming a Github. Paths with just "repo" will expand to a Github url, if your Github username is stored in git config.
|
||||
get tag %TAG% | git tag %TAG%
|
||||
get untag %TAG% | Deletes local tag. Y/N prompt to delete remote tag.
|
||||
|
||||
### TODO
|
||||
Now that I've added tab completion, I think "stage" and "status" are too similar.
|
||||
|
|
|
|||
33
bin/get
33
bin/get
|
|
@ -43,6 +43,39 @@ else
|
|||
fi
|
||||
;;
|
||||
|
||||
tag)
|
||||
echo Tagging
|
||||
git tag "$2"
|
||||
;;
|
||||
|
||||
untag)
|
||||
# See if tag exists
|
||||
if git rev-parse "$2" >/dev/null 2>&1
|
||||
then
|
||||
echo Deleting tag "$2"
|
||||
git tag -d "$2"
|
||||
fi
|
||||
# Get local branch name
|
||||
local_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
# Get associated remote
|
||||
remote=$(git config --get branch.$local_branch.remote)
|
||||
# If tag is not present on remote, stop here.
|
||||
exist=$(git ls-remote --tags "$remote" "$2")
|
||||
if [ "$exist" != '' ]
|
||||
then
|
||||
# Prompt user to delete on upstream.
|
||||
read -e -p "Would you like to delete the tag on remote '${remote}'? [Y/n]: " deltag
|
||||
deltag=${deltag:-Y}
|
||||
case "$deltag" in
|
||||
[Yy] | [Yy][Ee][Ss] )
|
||||
git push --delete "$remote" "$2"
|
||||
;;
|
||||
[Nn] | [Nn][Oo] )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
|
||||
add)
|
||||
# TODO: make add only add untracked files (useful when auto-completing)
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue