janson0
janson0

Reputation: 137

What is the behavior of git checkout with one file?

If x and y were your files and you did a few commits like so:

commit 0: x / y
commit 1: x / y+1
commit 2: x+1/y+1
commit 3: x+1 / y+2 (HEAD)

If you did:

git checkout master~1 x

Would you get x or x+1?

Upvotes: 0

Views: 87

Answers (1)

Michael Mior
Michael Mior

Reputation: 28762

What's stopping you from trying this to find out? Anyway, master~1 refers to the commit before master. Assuming the master branch is at commit 3, you'll get the file x at commit 2, which is x+1.

Upvotes: 2

Related Questions