$ go get -d -v github.com/juju/juju
$ export JUJU_MAKE_GODEPS=true
$ make install# Add the main git repo as the upstream remote.
# git protocol is more efficient than https, requires ssh key
$ git remote add upstream git@github.com:juju/juju.git
# Have git protect me from accidentally pushing to upstream
$ git remote set-url upstream --push no-pushing
# Make the origin be my copy of the project
$ git remote set-url origin git@github.com:howbazaar/juju.git
$ git remote -v
origin git@github.com:howbazaar/juju.git (fetch)
origin git@github.com:howbazaar/juju.git (push)
upstream git@github.com:juju/juju.git (fetch)
upstream no-pushing (push)
# Get the commits, branches, and tags from upstream.
$ git fetch upstream
$ git branch
* master
# Make the master branch track upstream/master.
$ git branch -u upstream/master
git branch develop upstream/develop
git checkout develop$ git checkout -b fix-<some-bug>
# this is shorthand for
# $ git branch fix-<some-bug>
# $ git checkout fix-<some-bug>
# hack, hack, fix, test
$ git commit -am "Fixed the frobulator."
$ git push origin# Did two commits, then realised that I missed a file
# in the first one. I had pending changes in the branch,
# including the file.
$ git stash
# Put all the current changes off to the side
$ git rebase --interactive
# Mark the commit two back with 'edit', save and exit
$ git stash pop
# Get my changes back
$ git add the-file
$ git stash
# Put the rest of the changes back to the side
$ git rebase --continue
# We're done with the rebase
$ git stash pop
# Get the changes back$ git fetch upstream
# downloads all the commits, tags, and branches
$ git checkout develop
# switch back to my copy of main upstream branch
$ git merge --ff-only
# merges in parent (upstream/develop),
# fast forward only - no merge commit added
$ git checkout -
# go back to my branch
$ git merge develop
# fix the conflicts
$ git reset develop
$ git commit -am "My work..."# If I haven't made a fix for this release yet, get
# a local branch relating to the release series.
$ git branch upstream/2.2 2.2
$ git checkout 2.2
# Once I'm on the 2.2 branch, if I branch from here,
# the upstream for that branch is set.
$ git checkout -b 2.2-fix-foobar
# hack, hack, fix, commit, push"git gets easier once you get the basic idea that branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space."
@agnoster 7 Mar 2011