4
When we use the git checkout nomedoarquivo
what difference with git checkout -- nomedoarquivo
?
I don’t know what changes using that --
?
4
When we use the git checkout nomedoarquivo
what difference with git checkout -- nomedoarquivo
?
I don’t know what changes using that --
?
4
The command git checkout "nome"
(without --
), will work the same way git checkout -- nome
(with --
) when there is no branch with the same name as the filing cabinet.
If there is a branch and file with the same name in the project, then the user has to specify which one he wants to checkout.
git checkout -- nome
to choose the filing cabinetgit checkout nome
to choose the branchThe --
serves to avoid confusion. Indicating that the user is checking out a file and not a branch with the same name.
Git is smart enough to try to match the command if there are no files and branchs with equal names. That’s why you didn’t see any difference in the results of the commands.
In fact, it is not only with branchs that ambiguity can occur. As explained in the documentation link at git checkout disambiguation.
Browser other questions tagged git
You are not signed in. Login or sign up in order to post.