Because I know I’ll forget it if I don’t write it down now.
I’ve been doing a thing in a branch on one machine, but now I want to do that thing on another machine. I’ve already pushed that branch to origin, so I don’t need to - hold on. I better put that down as well.
On One Machine
The main concern here is to ensure that my work isn’t stuck on the
one machine. The -u flag (or --set-upstream for the verbose)
creates a tracking reference upstream, so that the remote
repository remembers the branch.
$ git branchmaster* oh-hai$ git push -u origin oh-haiOn Another Machine
Now that I’ve created the tracking reference upstream, I can pull it down from the other machine.
$ git branch* master$ git branch -rorigin/masterorigin/oh-hai$ git checkout --track -b oh-hai origin/oh-haiHope I didn’t forget anything. I’ll find out soon enough.