Skip to content

Instantly share code, notes, and snippets.

@anirudhjoshi
Forked from cwsaylor/gist:8511
Created January 11, 2011 08:49
Show Gist options
  • Save anirudhjoshi/774209 to your computer and use it in GitHub Desktop.
Save anirudhjoshi/774209 to your computer and use it in GitHub Desktop.
# Variation on Hashrocket's script for managing the git process
# as documented here: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html
# Create shell scripts out of each of these, put them in your path (~/bin for example)
# chmod 755 them and use like this:
#
# This version of hack is totally different than Hackrockets. I feel that hack implies
# that you are getting started, not finishing up. sink is Hashrockets hack.
#
# $ hack branch_name
# Test and Implement until done
# $ sink && rake
# $ ship
#
# An editor will be displayed with all of the commit messages allowing you to make one giant
# combined commit (merge --squash). Add the story (from xp) to the top and save.
#
# If any step fails, the && will prevent the next step from moving executing
# btw, sink == sync, sync is taken and I like the double entendre anyway
# CHANGELOG
# Implementing squash in ship
# Making changes so that the commands are more error proof
# hack
#!/bin/sh -x
git checkout master
git pull origin master
git checkout -b $1 master
# sink
#!/bin/sh -x
CURRENT=`git branch | grep "*" | awk '{print $2}'`
git checkout master
git pull origin master
git checkout ${CURRENT}
git rebase master ${CURRENT}
# ship
#!/bin/sh -x
CURRENT=`git branch | grep "*" | awk '{print $2}'`
git checkout master
git merge --squash ${CURRENT} && git commit -a -v && git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment