We just updated from git-1.7.3 to git-2.6.1, and some unittests we run show 
a change in behavior in the git checkout command.

We want to set up a simple test repository with one file and one branch 
that unittests can then use to exercise other parts of our code. The 
process we use below works with git-1.7.3, but doesn't with git-2.6.1.

I'm sure this is some misunderstanding on my part as to how this all works, 
since in our production repositories the git-2.6.1 checkout of a new branch 
works fine.

We set up the test repository like this:

git init .
touch test.file
git add test.file
git commit -m 'test'
git update-ref refs/remotes/origin/1.2 master

In git-1.7.3 trying to check out 1.2 would create a local branch with that 
name and check it out:

$ git branch -a
* master
$ git checkout 1.2
Switched to a new branch '1.2'

In git-2.6.1 trying to check out 1.2 fails

$ git branch -a
* master
$ module swap sierra-git/2.6.1
$ git checkout 1.2
error: pathspec '1.2' did not match any file(s) known to git.

Clearly I could use the -b option to check out like this
$ git checkout -b 1.2 origin/1.2
Switched to a new branch '1.2'
but the man page indicates that this should not be necessary.

Any suggestions as to what I am doing wrong?


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to