nehem
nehem

Reputation: 13642

How does git resolve filename and branchname?

git checkout xxxx

How does git resolve if it's filename or branchname? What if my co-worker creates a filename as my existing branchname?

Upvotes: 4

Views: 57

Answers (2)

knittl
knittl

Reputation: 265241

If there's a conflict, you can use the double dash -- to distinguish between branches and files

git checkout branch --
git checkout -- file

Everything after -- is considered a filename. And that list can be empty.

Upvotes: 6

Bijendra
Bijendra

Reputation: 10025

for checkout for for branch(creates and checkout)

git checkout -b branchname

git checkout for file with same branchname already present

git checkout -- file

for files

git checkout filename

Upvotes: 0

Related Questions