I have not decided if I like the following behavior regarding files / folders that are not under version control.
In particular, it seems strange that un-versioned files seem to follow you when you checkout different branches. It seems like said files should only exist in the branch they were created in.
Can someone please help me understand why / if this is desirable behavior?
For example:
shopkins@shax:~/tmp/test$ ls hello.txt shopkins@shax:~/tmp/test$ git branch - * master my_branch shopkins@shax:~/tmp/test$ shopkins@shax:~/tmp/test$ git checkout my_branch Switched to branch 'my_branch' shopkins@shax:~/tmp/test$ mkdir adir shopkins@shax:~/tmp/test$ touch adir/my_branch.txt shopkins@shax:~/tmp/test$ git add adir/ shopkins@shax:~/tmp/test$ git commit -a -m "added adir with my_branch.txt" [my_branch d36964c] added adir with my_branch.txt 0 files changed, 0 insertions(+), 0 deletions(-) shopkins@shax:~/tmp/test$ git checkout my_branch Switched to branch 'my_branch' shopkins@shax:~/tmp/test$ tree . |-- adir | |-- my_branch.txt | `-- orphan.txt `-- hello.txt 1 directory, 3 files create mode 100644 adir/my_branch.txt shopkins@shax:~/tmp/test$ touch adir/orphan.txt shopkins@shax:~/tmp/test$ git checkout master Switched to branch 'master' shopkins@shax:~/tmp/test$ ls adir hello.txt shopkins@shax:~/tmp/test$ tree . |-- adir | `-- orphan.txt `-- hello.txt 1 directory, 2 files EDIT As it turns out, nothing was changed in the files between the branches in the following first edit. Thanks for the help everyone!
EDIT It seems that git does not write modification of versioned files when checkouts occur. In the following example, another.txt is not under version control:
shopkins@shax:~/tmp/test$ ls -l total 4 drwxr-xr-x 2 shopkins shopkins 4096 2011-02-21 21:49 adir -rw-r--r-- 1 shopkins shopkins 0 2011-02-21 21:47 another.txt -rw-r--r-- 1 shopkins shopkins 0 2011-02-21 21:49 hello.txt shopkins@shax:~/tmp/test$ git checkout my_branch Switched to branch 'my_branch' shopkins@shax:~/tmp/test$ ls -l total 4 drwxr-xr-x 2 shopkins shopkins 4096 2011-02-21 21:49 adir -rw-r--r-- 1 shopkins shopkins 0 2011-02-21 21:47 another.txt -rw-r--r-- 1 shopkins shopkins 0 2011-02-21 21:49 hello.txt shopkins@shax:~/tmp/test$