feat: add 'g fff'

This commit is contained in:
William Hilton 2019-06-05 10:41:12 -04:00
parent 8d9d0bfd42
commit 231010fa79
2 changed files with 12 additions and 0 deletions

View file

@ -85,6 +85,7 @@ g fetch *branches* | Fetches and fast-forwards the specified branches
g push | pushes to upstream. <ul><li> If upstream not set, prompt user to name a remote branch. </li> <li> If multiple remotes exist, prompt for which remote to use. </li></ul>
g remote | Interactive prompt to add a remote.
g ff | git pull --ff-only
g fff | deletes the local branch and rechecks it out (useful when remote branch has been force-pushed and can't be fast-forwarded)
\* To save your Github username where `get` can see it: `git config --global github.user your_user_name`

11
bin/g
View file

@ -316,6 +316,17 @@ ff)
git pull --ff-only
;;
fff)
# Get local branch name
local_branch=$(git rev-parse --abbrev-ref HEAD)
# Move HEAD pointer
git checkout HEAD~0 &>/dev/null
# Delete local branch
git branch -D "$local_branch" &>/dev/null
# Re-checkout the local branch
git checkout "$local_branch"
;;
ignore)
GIT_ROOT=$(git_root)
CWD=$(pwd)