I'm puzzled how to use branches in git to save temporary work.
This is what I tried:
/tmp/gt > git init
Initialized empty Git repository in .git/
/tmp/gt > date > t
/tmp/gt > git add t
/tmp/gt > git commit -m 'initial'
Created initial commit b722fde: initial
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 t
Now I'm saving away that work to branch "b".
/tmp/gt > git branch b
and continue to work in the master branch.
/tmp/gt > date >> t
/tmp/gt > cat t
Di 18 Aug 2009 08:52:43 CEST
Di 18 Aug 2009 08:53:13 CEST
What surprises me is this:
/tmp/gt > git checkout b
M t
Switched to branch "b"
/tmp/gt > cat t
Di 18 Aug 2009 08:52:43 CEST
Di 18 Aug 2009 08:53:13 CEST
I expected that in branch "b" the file "t" was still in the same state when the branch was created (i.e. containg just a single date line).
Can I avoid this auto-merging or is this some conceptual question?
Thanks for guidance, Axel.