Skip to content

Instantly share code, notes, and snippets.

@codatory
Created March 29, 2011 15:04
Show Gist options
  • Save codatory/892502 to your computer and use it in GitHub Desktop.
Save codatory/892502 to your computer and use it in GitHub Desktop.
git-goodness
# This is in my .profile, you could also put it in your .bash_profile
feature_deliver() {
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
feature_update
git checkout master
git merge --squash --no-commit ${CURRENT}
git commit
}
feature_update() {
master_update
git rebase master
}
master_update() {
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git pull --rebase
git checkout ${CURRENT}
}
master_deliver() {
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git push
git checkout ${CURRENT}
}
feature_create() {
git switch master
git checkout -b $1
}
feature_commits() {
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
echo "Commits in branch \"${CURRENT}\", but not \"master\":"
git log master..${CURRENT} --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset" --abbrev-commit --date=relative
}
feature_changes() {
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
echo "Commits in branch \"${CURRENT}\", but not \"master\":"
git diff master..${CURRENT}
}
sync_repo() {
master_update
master_deliver
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment