There are a lot of different ways to do this. If you have to move from computer to computer, you'll be switching to a different repository, so that means you'd be pushing up your changes to the remote repo. That's fine, but it also means you
A very simple example is to only perform your unstable work on a private branch, and to name it something obvious, e.g. unstable-development
. Here's how to do this from scratch. First, let's make a new repo from your client's site, which I'll call "secret-sauce".
$ git clone git://example.com/repositories/secret-sauce.git
You're still on the master
branch, the default. Let's make a new branch so that you can commit stuff there instead of on master
.
$ git branch unstable
$ git checkout unstable
Switched to branch 'unstable'
Okay. Now let's add some unstable code:
$ touch kablammo.txt
$ git add *
$ git commit -m "Added unstable code."
[master (root-commit) 9428aef] Initial checkin.
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 kablammo.txt
Right now, unstable
exists only on your side. Notice that when we cloned, we got a remote repository called origin
, which has a corresponding master
branch. When your local repository knows about a remote repository's branches, we call that a "tracking branch". You can see all your remote tracking branches with git branch -r
:
$ git branch -r
origin/HEAD -> origin/master
origin/master
Okay. Let's push our changes back!
$ git push origin unstable
That's it -- our changes now live in the unstable
branch on the remote repo. If we want to see what people are up to on the master
branch again, we can switch back again with git checkout master
.