diff --git a/README.md b/README.md index 5d93da5..1a41fb7 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ same control as git but without the headache of its impossible to remember comma ### Why? I started this project because `git log --no-pager` gives an error. Apparently I wanted `git --no-pager log`. This was the last straw. -*So I decided to "fix" the git CLI.* +*So I decided to "fix" the git CLI.* -EDIT: Even better example of inanity of git CLI: To get the SHA reference of HEAD, do you use `git show-ref HEAD --abbrev --hash` or `git rev-parse --short HEAD`? +EDIT: Even better example of inanity of git CLI: To get the SHA reference of HEAD, do you use `git show-ref HEAD --abbrev --hash` or `git rev-parse --short HEAD`? * Why are they different results? * Why does `show-ref` use `--abbrev` but `rev-parse` use `--short`? @@ -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. diff --git a/bin/get b/bin/get index a842b20..b4bec21 100755 --- a/bin/get +++ b/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) ;;