I thought the line
git checkout .
can revert all changes in the current directory and subdirectory for the local working copy. But I also see this popular form:
git checkout -- .
so if --
(the double dash or also called "bare double dash") is to signal the end of command options, then why is it needed in the above case? The .
can never be an option so there shouldn't be any confusion.
1. 12. For clarity, in git it means more than this, as it also means the argument after the -- cannot be a branch name, and by implication the argument before -- cannot be a file path.
The double dash -- in git means different things to different commands, but in general it separates options from parameters. In git specifically, the meaning of -- depends on which subcommand you are using it with.
It can be used to create branches, switch branches, and checkout remote branches.
git clone is to fetch your repositories from the remote git server. git checkout is to checkout your desired status of your repository (like branches or particular files). E.g., you are currently on master branch and you want to switch into develop branch.
It's meant to be to resolve ambiguity.
For example, if you had a branch named bob
(which would checkout that branch) and a folder named bob
(which would revert that folder).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With