Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use git's native plugin approach for git-wrapup

  • Loading branch information...
commit e1d65a460998149b1cf05015babe468a18767043 1 parent 52c8b03
@aaronj1335 authored
Showing with 9 additions and 9 deletions.
  1. +8 −7 git-wrapup
  2. +1 −1  home_files/bashrc
  3. +0 −1  home_files/gitconfig
View
15 git-wrapup
@@ -31,13 +31,10 @@ out pull requests to your local repo.
descriptive branch names can be long, so it's helpful to have command line
completion with this command. this is pretty easy if you're using bash and
you've already got git completion setup for bash. if you do, then add this
-script to your \$PATH, make it a git alias:
-
- $ git config --global alias.wrapup '!git-wrapup'
-
+script to your \$PATH (keep it named "git-wrapup" so "git wrapup" will work),
and then add this line to your bash startup script (~/.bashrc or whatever):
- if which git &>/dev/null && grep wrapup ~/.gitconfig &>/dev/null; then
+ if which git-wrapup &>/dev/null; then
_git_wrapup() { _git_branch; }
fi
DOCS
@@ -45,10 +42,14 @@ exit 70 # i guess this is the exit code for a documentatin request?
fi
branch=$1
+current_branch="`git rev-parse --abbrev-ref HEAD`"
# default to using the current branch if none is given
if [ ! "$branch" ]; then
- branch="`git rev-parse --abbrev-ref HEAD`"
+ branch="$current_branch"
+fi
+
+if [ "$branch" = "$current_branch" ]; then
git checkout master
fi
@@ -71,7 +72,7 @@ if [ "$remote" ]; then
# branches for this remote
git branch -dr $remote
perl -pi -e "s|^.*$remote.*\$||" "$gitconfig"
- perl -pi -e 's/^$//' "$gitconfig"
+ perl -pi -e 's/^\n//' "$gitconfig"
else
# we control this branch, so delete it on the remote
git push origin --delete $branch
View
2  home_files/bashrc
@@ -161,7 +161,7 @@ fi
# if the system has git installed and i've got the 'wrapup' alias in my
# gitconfig, then define a completion function for it
-if which git &>/dev/null && grep wrapup ~/.gitconfig &>/dev/null; then
+if which git-wrapup &>/dev/null; then
_git_wrapup() { _git_branch; }
fi
View
1  home_files/gitconfig
@@ -18,7 +18,6 @@
lga = !git log -n30 --graph --decorate --pretty=oneline --abbrev-commit --all && git status -sb
st = status -sb
stat = status -sb
- wrapup = !git-wrapup
[user]
name = Aaron Stacy
Please sign in to comment.
Something went wrong with that request. Please try again.