I'm learning to use git and I noticed that certain parameters are preceded by a dash while others are preceded by two.
Example:
git branch --merged
git branch -d nome
What is the reason?
I'm learning to use git and I noticed that certain parameters are preceded by a dash while others are preceded by two.
Example:
git branch --merged
git branch -d nome
What is the reason?
As you can see in your example there is a difference between them. With only a dash is the abbreviated form of a command while with two dashes is the command "in extenso."
It is common for both forms to exist for most commands.
This follows the pattern adopted by Unix at its source. Initially there were only one-stroke and one-letter options, thus simplifying parse and giving agility to use.
Over time it became necessary to have more options and began to give more value to make it easier to read what you are doing and simplifications were not so desirable. So we adopted the standard extensively and to differentiate there was a preference for the two traits.
Git completely follows the philosophy of Unix / Linux (after all its main creator also the creator of Linux). Today there is no special reason other than maintaining the standard already established and avoiding confusion.
This is used in what is usually called option or switch .
Font .
When you use with a trace you are probably using a shortcut version of the command, eg multiple programs have the command help
, which you can access
nome_do_programa --help
or
nome_do_programa -h
In git branch -d nome_do_branch
, -d
is the shortcut of --delete
, for example:
git branch --delete nome_do_branch