michael.schuett
michael.schuett

Reputation: 4771

git push with double dash (git push --)

I am familiar with the use of -- in commands such as git checkout -- when you want to separate the branch from the file git checkout -- master. However I have never seen git push -- and can't find anything in the man page or https://git-scm.com/docs/git-push about it.

The command I ran into was

git push -- origin e96b75aec4014a898cebfb0619599d8171f62c66:master

Upvotes: 1

Views: 215

Answers (2)

Jonathan.Brink
Jonathan.Brink

Reputation: 25433

It is a no-op.

git-push doesn't take any file arguments like git-checkout does so there is no need for the bare double-dash and it is ignored.

A note-worthy, but unrelated aspect of the push command you have listed is that it is using the refspec syntax but that is not related to the --.

You can similarly use it with git-branch even though it also does not take any file arguments (ex: git branch -- fooBranch is equivalent to git branch fooBranch)

Upvotes: 1

Tim
Tim

Reputation: 43354

This is not a git-specific option (at least not for push), therefore it's not explained in the docs.

What it is actually used for:

a double dash (--) is used in bash built-in commands and many other commands to signify the end of command options, after which only positional parameters are accepted.

More details at unix.SE.

Upvotes: 1

Related Questions