On Wed, May 13, 2020 at 08:59:14AM +0200, Tassilo Horn wrote:

> > I gone through the git doc but I am not able to do the git stash
> > particular file
[...]
> so it must be
> 
>   git stash push -m "message " -- filepath
> 
> That filespecs go after a double-dash is quite common with git.  For
> example, if you want to checkout only some file of a given revision,
> you'd also use something like
> 
>   git checkout <sha> -- path/to/file
[...]

I would add that "--" is common not only with Git but in many
command-line programs — especially those developed under the GNU
umbrella.

The "--" token commonly means "whatever arguments come after this must
not be interpreted as options".
This approach allows to have commands with the semantics like

  command [options] [aguments]

In this case, the implementation of `command` might have hard time
deciding when the last option ends and the first agument comes in —
especially in the case of an arument which resembles an option by
starting with the "-" character.
Using of "--" removes the confusion so we can run our `command` like

  command --first-option --second-opton -- --weird-file-name

and have no problem with separating the two options from the argument
which has quite a strange look ;-)

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/20200514113352.m75nrk3aq3bmmd5d%40carbon.

Reply via email to