Pragmatism in the real world

Gittyup – Easily keep master in sync with upstream

If, like me, you use git and have an upstream remote which is not your origin, then I highly recommend that you use Evan Coury‘s gittyup script.

This is a very simple script that does the following:

1. Verify that you are in a valid Git repo.
2. Remember which branch you are on.
3. Stash any uncommitted changes you have.
4. Checkout master.
5. Fetch all remotes. (nice to track other remotes)
6. Merge upstream/master into local master (FF ONLY!)
7. Push your updated local master branch to origin.
8. Check out the branch you were previously on.
9. Applies any stashed changes and index status.

This is a very quick an easy way to update your local master with upstream and push to origin without losing any changes you may currently be working on.

You should set it up now!