path: root/Documentation/merge-options.txt
AgeCommit message (Collapse)Author
2020-10-20doc: preparatory clean-up of description on the sign-off optionJunio C Hamano
Almost identical text on the signed-off-by trailer appears in the documentation for "git commit" and "git merge" and its friends. Introduce a new signoff-option.txt file to be shared. A couple of things of note are: - The short-form "-s" is available only in "git commit", but not in commands that are friends of "git merge", as it is used as a short-hand for "--strategy". - The original lacks description on the negated "--no-signoff" form on "git commit" side, but it equally is applicable. It however was unclear in the original text that not adding a Signed-off-by trailer is the default, so rephrase to explain it as a way to countermand a --signoff option that appeared earlier on the same command line. This is in preparation to apply a further clarification on what exactly the Signed-off-by trailer means. Suggested-by: Philippe Blain <> Signed-off-by: Junio C Hamano <> Reviewed-by: Taylor Blau <> Reviewed-by: Bradley M. Kuhn <> Signed-off-by: Junio C Hamano <>
2020-04-29Merge branch 'dl/merge-autostash'Junio C Hamano
"git merge" learns the "--autostash" option. * dl/merge-autostash: (22 commits) pull: pass --autostash to merge t5520: make test_pull_autostash() accept expect_parent_num merge: teach --autostash option sequencer: implement apply_autostash_oid() sequencer: implement save_autostash() sequencer: unlink autostash in apply_autostash() sequencer: extract perform_autostash() from rebase rebase: generify create_autostash() rebase: extract create_autostash() reset: extract reset_head() from rebase rebase: generify reset_head() rebase: use apply_autostash() from sequencer.c sequencer: rename stash_sha1 to stash_oid sequencer: make apply_autostash() accept a path rebase: use read_oneliner() sequencer: make read_oneliner() extern sequencer: configurably warn on non-existent files sequencer: make read_oneliner() accept flags sequencer: make file exists check more efficient sequencer: stop leaking buf ...
2020-04-10pull: pass --autostash to mergeDenton Liu
Before, `--autostash` only worked with `git pull --rebase`. However, in the last patch, merge learned `--autostash` as well so there's no reason why we should have this restriction anymore. Teach pull to pass `--autostash` to merge, just like it did for rebase. Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2020-04-10merge: teach --autostash optionDenton Liu
In rebase, one can pass the `--autostash` option to cause the worktree to be automatically stashed before continuing with the rebase. This option is missing in merge, however. Implement the `--autostash` option and corresponding `merge.autoStash` option in merge which stashes before merging and then pops after. This option is useful when a developer has some local changes on a topic branch but they realize that their work depends on another branch. Previously, they had to run something like git fetch ... git stash push git merge FETCH_HEAD git stash pop but now, that is reduced to git fetch ... git merge --autostash FETCH_HEAD When an autostash is generated, it is automatically reapplied to the worktree only in three explicit situations: 1. An incomplete merge is commit using `git commit`. 2. A merge completes successfully. 3. A merge is aborted using `git merge --abort`. In all other situations where the merge state is removed using remove_merge_branch_state() such as aborting a merge via `git reset --hard`, the autostash is saved into the stash reflog instead keeping the worktree clean. Helped-by: Phillip Wood <> Suggested-by: Alban Gruin <> Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2020-04-03Documentation: document merge option --no-gpg-signĐoàn Trần Công Danh
Signed-off-by: Đoàn Trần Công Danh <> Signed-off-by: Junio C Hamano <>
2019-11-07Documentation: fix a bunch of typos, both old and newElijah Newren
Reported-by: Jens Schleusener <> Signed-off-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
2019-09-30Merge branch 'en/merge-options-ff-and-friends'Junio C Hamano
Doc update. * en/merge-options-ff-and-friends: merge-options.txt: clarify meaning of various ff-related options
2019-09-01merge-options.txt: clarify meaning of various ff-related optionsElijah Newren
As discovered on the mailing list, some of the descriptions of the ff-related options were unclear. Try to be more precise with what these options do. Signed-off-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
2019-08-07merge: do no-verify like commitMichael J Gruber
f8b863598c ("builtin/merge: honor commit-msg hook for merges", 2017-09-07) introduced the no-verify flag to merge for bypassing the commit-msg hook, though in a different way from the implementation in commit.c. Change the implementation in merge.c to be the same as in commit.c so that both do the same in the same way. This also changes the output of "git merge --help" to be more clear that the hook return code is respected by default. [js: * reworded commit message * squashed documentation changes from original series' patch 3/4 ] Signed-off-by: Michael J Gruber <> Signed-off-by: Josh Steadmon <> Signed-off-by: Junio C Hamano <>
2019-07-25Merge branch 'vv/merge-squash-with-explicit-commit' into maintJunio C Hamano
"git merge --squash" is designed to update the working tree and the index without creating the commit, and this cannot be countermanded by adding the "--commit" option; the command now refuses to work when both options are given. * vv/merge-squash-with-explicit-commit: merge: refuse --commit with --squash
2019-06-17Merge branch 'vv/merge-squash-with-explicit-commit'Junio C Hamano
"git merge --squash" is designed to update the working tree and the index without creating the commit, and this cannot be countermanded by adding the "--commit" option; the command now refuses to work when both options are given. * vv/merge-squash-with-explicit-commit: merge: refuse --commit with --squash
2019-05-28merge: refuse --commit with --squashVishal Verma
Convert option_commit to tristate, representing the states of 'default/untouched', 'enabled-by-cli', 'disabled-by-cli'. With this in place, check whether option_commit was enabled by cli when squashing a merge. If so, error out, as this is not supported. Previously, when --squash was supplied, 'option_commit' was silently dropped. This could have been surprising to a user who tried to override the no-commit behavior of squash using --commit explicitly. Add a note to the --squash option for git-merge to clarify the incompatibility, and add a test case to Cc: Junio C Hamano <> Cc: Rafael Ascensão <> Cc: Johannes Schindelin <> Signed-off-by: Vishal Verma <> Signed-off-by: Junio C Hamano <>
2019-04-18merge: add scissors line on merge conflictDenton Liu
This fixes a bug where the scissors line is placed after the Conflicts: section, in the case where a merge conflict occurs and commit.cleanup = scissors. Next, if commit.cleanup = scissors is specified, don't produce a scissors line in commit if one already exists in the MERGE_MSG file. Helped-by: Eric Sunshine <> Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2019-04-18merge: cleanup messages like commitDenton Liu
This change allows git-merge messages to be cleaned up with the commit.cleanup configuration or --cleanup option, just like how git-commit does it. We also give git-pull the option of --cleanup so that it can also take advantage of this change. Finally, add testing to ensure that messages are properly cleaned up. Note that some newlines that were added to the commit message were removed so that if a file were read via -F, it would be copied faithfully. Helped-by: Eric Sunshine <> Signed-off-by: Phillip Wood <> Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2019-02-21merge-options.txt: correct wording of --no-commit optionElijah Newren
The former wording implied that --no-commit would always cause the merge operation to "pause" and allow the user to make further changes and/or provide a special commit message for the merge commit. This is not the case for fast-forward merges, as there is no merge commit to create. Without a merge commit, there is no place where it makes sense to "stop the merge and allow the user to tweak changes"; doing that would require a full rebase of some sort. Since users may be unaware of whether their branches have diverged or not, modify the wording to correctly address fast-forward cases as well and suggest using --no-ff with --no-commit if the point is to ensure that the merge stops before completing. Reported-by: Ulrich Windl <> Signed-off-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
2018-02-16merge: allow fast-forward when merging a tracked tagJunio C Hamano
Long time ago at fab47d05 ("merge: force edit and no-ff mode when merging a tag object", 2011-11-07), "git merge" was made to always create a merge commit when merging a tag, even when the side branch being merged is a descendant of the current branch. This default is good for merges made by upstream maintainers to integrate work signed by downstream contributors, but will leave pointless no-ff merges when downstream contributors pull a newer release tag to make their long-running topic branches catch up with the upstream. When there is no local work left on the topic, such a merge should simply fast-forward to the commit pointed at by the release tag. Update the default (again) for "git merge" that merges a tag object to (1) --no-ff (i.e. create a merge commit even when side branch fast forwards) if the tag being merged is not at its expected place in refs/tags/ hierarchy and (2) --ff (i.e. allow fast-forward update when able) otherwise. Signed-off-by: Junio C Hamano <>
2017-11-06Merge branch 'wk/pull-signoff'Junio C Hamano
"git pull" has been taught to accept "--[no-]signoff" option and pass it down to "git merge". * wk/pull-signoff: pull: pass --signoff/--no-signoff to "git merge"
2017-10-19Merge branch 'wk/merge-options-gpg-sign-doc'Junio C Hamano
Doc updates. * wk/merge-options-gpg-sign-doc: Documentation/merge-options.txt: describe -S/--gpg-sign for 'pull'
2017-10-13pull: pass --signoff/--no-signoff to "git merge"W. Trevor King
merge can take --signoff, but without pull passing --signoff down, it is inconvenient to use; allow 'pull' to take the option and pass it through. The order of options in merge-options.txt is mostly alphabetical by long option since 7c85d274 (Documentation/merge-options.txt: order options in alphabetical groups, 2009-10-22). The long-option bit didn't make it into the commit message, but it's under the fold in [1]. I've put --signoff between --log and --stat to preserve the alphabetical order. [1]: Signed-off-by: W. Trevor King <> Signed-off-by: Junio C Hamano <>
2017-10-12Documentation/merge-options.txt: describe -S/--gpg-sign for 'pull'W. Trevor King
Pull has supported these since ea230d8 (pull: add the --gpg-sign option, 2014-02-10). Insert in long-option alphabetical order following 7c85d274 (Documentation/merge-options.txt: order options in alphabetical groups, 2009-10-22). Signed-off-by: W. Trevor King <> Signed-off-by: Junio C Hamano <>
2017-08-23treewide: correct several "up-to-date" to "up to date"Martin Ågren
Follow the Oxford style, which says to use "up-to-date" before the noun, but "up to date" after it. Don't change plumbing (specifically send-pack.c, but transport.c (git push) also has the same string). This was produced by grepping for "up-to-date" and "up to date". It turned out we only had to edit in one direction, removing the hyphens. Fix a typo in Documentation/git-diff-index.txt while we're there. Reported-by: Jeffrey Manian <> Reported-by: STEVEN WHITE <> Signed-off-by: Martin Ågren <> Signed-off-by: Junio C Hamano <>
2016-05-17Merge branch 'kf/gpg-sig-verification-doc'Junio C Hamano
Documentation for "git merge --verify-signatures" has been updated to clarify that the signature of only the commit at the tip is verified. Also the phrasing used for signature and key validity is adjusted to align with that used by OpenPGP. * kf/gpg-sig-verification-doc: Documentation: clarify signature verification
2016-05-13Documentation: clarify signature verificationKeller Fuchs
Clarify that "merge --verify-signatures" checks the signature on the tip commit of the history being merged. Uniformise the vocabulary used wrt. key/signature validity with OpenPGP: - a signature is valid if made by a key with a valid uid; - in the default trust-model, a uid is valid if signed by a trusted key; - a key is trusted if the (local) user set a trust level for it. Helped-by: Junio C Hamano <> Signed-off-by: Keller Fuchs <> Signed-off-by: Junio C Hamano <>
2016-04-21pull: pass --allow-unrelated-histories to "git merge"Junio C Hamano
The previous commit said: We could add the same option to "git pull" and have it passed through to underlying "git merge". I do not have a fundamental opposition against such a feature, but this commit does not do so and instead leaves it as low-hanging fruit for others, because such a "two project merge" would be done after fetching the other project into some location in the working tree of an existing project and making sure how well they fit together, it is sufficient to allow a local merge without such an option pass-through from "git pull" to "git merge". Prepare a patch to make it a reality, just in case it is needed. Signed-off-by: Junio C Hamano <>
2014-03-31Documentation: fix misuses of "nor"Justin Lebar
Signed-off-by: Justin Lebar <> Signed-off-by: Junio C Hamano <>
2014-01-27Merge branch 'jc/maint-pull-docfix'Junio C Hamano
* jc/maint-pull-docfix: Documentation: "git pull" does not have the "-m" option Documentation: exclude irrelevant options from "git pull"
2014-01-14Documentation: "git pull" does not have the "-m" optionJunio C Hamano
Even though "--[no-]edit" can be used with "git pull", the explanation of the interaction between this option and the "-m" option does not make sense within the context of "git pull". Use the conditional inclusion mechanism to remove this part from "git pull" documentation, while keeping it for "git merge". Reported-by: Ivan Zakharyaschev Signed-off-by: Junio C Hamano <>
2013-06-02Merge branch 'rh/merge-options-doc-fix'Junio C Hamano
* rh/merge-options-doc-fix: Documentation/merge-options.txt: restore `-e` option
2013-05-16Documentation/merge-options.txt: restore `-e` optionRichard Hansen
It looks like commit f8246281af9adb0fdddbcc90d2e19cb5cd5217e5 unintentionally removed the documentation for the `-e` option. Signed-off-by: Richard Hansen <> Signed-off-by: Junio C Hamano <>
2013-04-05Merge branch 'sg/gpg-sig'Junio C Hamano
Teach "merge/pull" to optionally verify and reject commits that are not signed properly. * sg/gpg-sig: pretty printing: extend %G? to include 'N' and 'U' merge/pull Check for untrusted good GPG signatures merge/pull: verify GPG signatures of commits being merged commit.c/GPG signature verification: Also look at the first GPG status line Move commit GPG signature verification to commit.c
2013-04-01merge/pull Check for untrusted good GPG signaturesSebastian Götte
When --verify-signatures is specified, abort the merge in case a good GPG signature from an untrusted key is encountered. Signed-off-by: Sebastian Götte <> Signed-off-by: Junio C Hamano <>
2013-04-01merge/pull: verify GPG signatures of commits being mergedSebastian Götte
When --verify-signatures is specified on the command-line of git-merge or git-pull, check whether the commits being merged have good gpg signatures and abort the merge in case they do not. This allows e.g. auto-deployment from untrusted repo hosts. Signed-off-by: Sebastian Götte <> Signed-off-by: Junio C Hamano <>
2013-03-21Documentation: merging a tag is a special caseJunio C Hamano
When asking Git to merge a tag (such as a signed tag or annotated tag), it will always create a merge commit even if fast-forward was possible. It's like having --no-ff present on the command line. It's a difference from the default behavior described in git-merge.txt. It should be documented as an exception of "FAST-FORWARD MERGE" section and "--ff" option description. Reviewed-by: Jonathan Nieder <> Reviewed-by: Yann Droneaud <> Signed-off-by: Junio C Hamano <>
2012-02-27Merge branch 'jc/doc-merge-options'Junio C Hamano
* jc/doc-merge-options: Documentation/merge-options.txt: group "ff" related options together
2012-02-22Documentation/merge-options.txt: group "ff" related options togetherJunio C Hamano
The --ff-only option was not described next to --ff and --no-ff options in "git merge" documentation, even though these three are logically together, describing how to choose one of three possibilities. Also the description for '--ff' and '--no-ff' discussed what '--ff' means, and mentioned '--no-ff' as if it were a side-note to '--ff'. Make them into three top-level entries and list them together. This way, it would be more clear that the user can choose one from these three. Signed-off-by: Junio C Hamano <>
2012-01-23merge: use editor by default in interactive sessionsJunio C Hamano
Traditionally, a cleanly resolved merge was committed by "git merge" using the auto-generated merge commit log message without invoking the editor. After 5 years of use in the field, it turns out that people perform too many unjustified merges of the upstream history into their topic branches. These merges are not just useless, but they are often not explained well, and making the end result unreadable when it gets time for merging their history back to their upstream. Earlier we added the "--edit" option to the command, so that people can edit the log message to explain and justify their merge commits. Let's take it one step further and spawn the editor by default when we are in an interactive session (i.e. the standard input and the standard output are pointing at the same tty device). There may be existing scripts that leave the standard input and the standard output of the "git merge" connected to whatever environment the scripts were started, and such invocation might trigger the above "interactive session" heuristics. GIT_MERGE_AUTOEDIT environment variable can be set to "no" at the beginning of such scripts to use the historical behaviour while the script runs. Note that this backward compatibility is meant only for scripts, and we deliberately do *not* support "merge.edit = yes/no/auto" configuration option to allow people to keep the historical behaviour. Suggested-by: Linus Torvalds <> Signed-off-by: Junio C Hamano <>
2011-12-05Documentation: fix formatting error in merge-options.txtJack Nagel
The first paragraph inside of a list item does not need a preceding line consisting of a single '+', and in fact this causes the text to be misrendered. Fix it. Signed-off-by: Jack Nagel <> Signed-off-by: Junio C Hamano <>
2011-10-12Teach merge the '[-e|--edit]' optionJay Soffian
Implemented internally instead of as "git merge --no-commit && git commit" so that "merge --edit" is otherwise consistent (hooks, etc) with "merge". Note: the edit message does not include the status information that one gets with "commit --status" and it is cleaned up after editing like one gets with "commit --cleanup=default". A later patch could add the status information if desired. Note: previously we were not calling stripspace() after running the prepare-commit-msg hook. Now we are, stripping comments and leading/trailing whitespace lines if --edit is given, otherwise only stripping leading/trailing whitespace lines if not given --edit. Signed-off-by: Jay Soffian <> Signed-off-by: Junio C Hamano <>
2011-02-21merge: enable progress reporting for rename detectionJeff King
The user can enable or disable it explicitly with the new --progress, but it defaults to checking isatty(2). This works only with merge-recursive and subtree. In theory we could pass a progress flag to other strategies, but none of them support progress at this point, so let's wait until they grow such a feature before worrying about propagating it. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2010-09-09merge: Make '--log' an integer option for number of shortlog entriesRamkumar Ramachandra
Change the command-line '--log' option from a boolean option to an integer option, and parse the optional integer provided on the command-line into the 'shortlog_len' variable. Also update the documentation accordingly. Signed-off-by: Ramkumar Ramachandra <> Reported-by: Yaroslav Halchenko <> Thanks-to: Jonathan Nieder <> Thanks-to: Johannes Sixt <> Signed-off-by: Junio C Hamano <>
2010-04-14Merge branch 'maint'Junio C Hamano
* maint: Documentation/config.txt: default gc.aggressiveWindow is 250, not 10 Docs: Add -X option to git-merge's synopsis. Conflicts: Documentation/merge-options.txt
2010-04-12Docs: Add -X option to git-merge's synopsis.Marc Branchaud
Also move -X's description next to -s's in merge-options.txt. This makes it easier to learn how to specify merge strategy options. Signed-off-by: Junio C Hamano <>
2010-02-24Documentation/git-pull: put verbosity options before merge/fetch onesTay Ray Chuan
After 3f7a9b5 (Documentation/git-pull.txt: Add subtitles above included option files, Thu Oct 22 2009), the -q/-v options were mentioned only for the merge options section, giving the impression that git-fetch did not take those arguments. Follow 90e4311 (git-pull: do not mention --quiet and --verbose twice, Mon Sep 7 2009) and hide -q/-v for merge options, while mentioning -q/-v before the merge- and fetch-specific options. Signed-off-by: Tay Ray Chuan <> Signed-off-by: Junio C Hamano <>
2010-01-21Merge branch 'ap/merge-backend-opts'Junio C Hamano
* ap/merge-backend-opts: Document that merge strategies can now take their own options Extend merge-subtree tests to test -Xsubtree=dir. Make "subtree" part more orthogonal to the rest of merge-recursive. pull: Fix parsing of -X<option> Teach git-pull to pass -X<option> to git-merge git merge -X<option> git-merge-file --ours, --theirs Conflicts: git-compat-util.h
2010-01-18Document that merge strategies can now take their own optionsJunio C Hamano
Also document the recently added -Xtheirs, -Xours and -Xsubtree[=path] options to the merge-recursive strategy. Signed-off-by: Avery Pennarun <> Signed-off-by: Junio C Hamano <>
2010-01-10Documentation: spell 'git cmd' without dash throughoutThomas Rast
The documentation was quite inconsistent when spelling 'git cmd' if it only refers to the program, not to some specific invocation syntax: both 'git-cmd' and 'git cmd' spellings exist. The current trend goes towards dashless forms, and there is precedent in 647ac70 (git-svn.txt: stop using dash-form of commands., 2009-07-07) to actively eliminate the dashed variants. Replace 'git-cmd' with 'git cmd' throughout, except where git-shell, git-cvsserver, git-upload-pack, git-receive-pack, and git-upload-archive are concerned, because those really live in the $PATH.
2009-11-10Merge branch 'bg/merge-ff-only'Junio C Hamano
* bg/merge-ff-only: Teach 'git merge' and 'git pull' the option --ff-only
2009-10-30Teach 'git merge' and 'git pull' the option --ff-onlyBjörn Gustavsson
For convenience in scripts and aliases, add the option --ff-only to only allow fast-forwards (and up-to-date, despite the name). Disallow combining --ff-only and --no-ff, since they flatly contradict each other. Allow all other options to be combined with --ff-only (i.e. do not add any code to handle them specially), including the following options: * --strategy (one or more): As long as the chosen merge strategy results in up-to-date or fast-forward, the command will succeed. * --squash: I cannot imagine why anyone would want to squash commits only if fast-forward is possible, but I also see no reason why it should not be allowed. * --message: The message will always be ignored, but I see no need to explicitly disallow providing a redundant message. Acknowledgements: I did look at Yuval Kogman's earlier patch (107768 in gmane), mainly as shortcut to find my way in the code, but I did not copy anything directly. Signed-off-by: Björn Gustavsson <> Signed-off-by: Junio C Hamano <>
2009-10-22Documentation/merge-options.txt: order options in alphabetical groupsJari Aalto
Signed-off-by: Jari Aalto <> Signed-off-by: Junio C Hamano <>
2009-05-25merge-options.txt: Clarify merge --squashMichael J Gruber
With the --squash option, merge sets up the index just like for a real merge, but without the merge info (stages). Say so. Signed-off-by: Michael J Gruber <> Signed-off-by: Junio C Hamano <>