While looking up syntax for git parameters involving one dash versus two dashes. I came across this post which explains that single dashes allow you to specify multiple single letter parameters with one dash and double dashes are for multi-letter parameters.
So in the case of git merge --no-ff <branch-name>
is -ff
calling -f
twice? If so, why?
CodePudding user response:
So in the case of
git merge --no-ff <branch-name>
is-ff
calling-f
twice?
No, it isn't.
--no-ff
is the complete long option. Long options may contain dashes, because only whitespace separates command line arguments and a long option is always an entire command line argument (unlike short options, where one command line argument can contain multiple options, .i.e. -bar
contains b
a
and r
).
CodePudding user response:
--ff
just means fast forward
.
Semantically speaking:
a fast-forward merge of a branch
other
in a currentfeature
branch is a trivial merge where the SHA1 offeature
is just "bumped" toother
(this is not always possible, only ifother
is a child-commit-or-so offeature
)a non-fast-forward merge of
other
infeature
is "a true merge" which results in the creation of a new merge commit in branchfeature
, which then has two parent commits.
Reference
See also the online refman which indicates there are three related CLI flags:
https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---ff
--ff
--no-ff
--ff-only
Specifies how a merge is handled when the merged-in history is already a descendant of the current history.