Skip to content

Instantly share code, notes, and snippets.

@gabrielmansour
Forked from cwsaylor/gist:8511
Last active December 19, 2015 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmansour/5960207 to your computer and use it in GitHub Desktop.
Save gabrielmansour/5960207 to your computer and use it in GitHub Desktop.
hack sink ship
# 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
# Implementing no-ff in lieu of squash in ship
#!/bin/sh -x
if [ `git config core.hackbranch` ]; then BRANCH=`git config core.hackbranch`; else BRANCH="master"; fi
git checkout ${BRANCH}
git pull origin ${BRANCH}
git checkout -b $1 ${BRANCH}
#!/bin/sh -x
if [ `git config core.hackbranch` ]; then BRANCH=`git config core.hackbranch`; else BRANCH="master"; fi
CURRENT=`git branch | grep "*" | awk '{print $2}'`
git checkout ${BRANCH}
git merge --no-ff ${CURRENT} && git commit -a -v && git push origin ${BRANCH}
#!/bin/sh -x
if [ `git config core.hackbranch` ]; then BRANCH=`git config core.hackbranch`; else BRANCH="master"; fi
CURRENT=`git branch | grep "*" | awk '{print $2}'`
git checkout ${BRANCH}
git pull origin ${BRANCH}
git checkout ${CURRENT}
git rebase ${BRANCH} ${CURRENT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment