From f8246281af9adb0fdddbcc90d2e19cb5cd5217e5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 10 Jan 2012 22:44:45 -0800 Subject: merge: use editor by default in interactive sessions 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 --- Documentation/merge-options.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Documentation/merge-options.txt') diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 6bd0b041c3..f2f1d0f51c 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -8,10 +8,20 @@ failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing. --edit:: --e:: +--no-edit:: + Invoke an editor before committing successful mechanical merge to + further edit the auto-generated merge message, so that the user + can explain and justify the merge. The `--no-edit` option can be + used to accept the auto-generated message (this is generally + discouraged). The `--edit` option is still useful if you are + giving a draft message with the `-m` option from the command line + and want to edit it in the editor. + - Invoke editor before committing successful merge to further - edit the default merge message. +Older scripts may depend on the historical behaviour of not allowing the +user to edit the merge log message. They will see an editor opened when +they run `git merge`. To make it easier to adjust such scripts to the +updated behaviour, the environment variable `GIT_MERGE_AUTOEDIT` can be +set to `no` at the beginning of them. --ff:: --no-ff:: -- cgit v1.2.1 From 690b29758289ac81062159c178b6d917f06e9862 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 22 Feb 2012 14:27:07 -0800 Subject: Documentation/merge-options.txt: group "ff" related options together 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 --- Documentation/merge-options.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Documentation/merge-options.txt') diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 1a5c12e317..2bd92c4741 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -13,13 +13,18 @@ inspect and further tweak the merge result before committing. edit the default merge message. --ff:: + When the merge resolves as a fast-forward, only update the branch + pointer, without creating a merge commit. This is the default + behavior. + --no-ff:: - Do not generate a merge commit if the merge resolved as - a fast-forward, only update the branch pointer. This is - the default behavior of git-merge. -+ -With --no-ff Generate a merge commit even if the merge -resolved as a fast-forward. + Create a merge commit even when the merge resolves as a + fast-forward. + +--ff-only:: + Refuse to merge and exit with a non-zero status unless the + current `HEAD` is already up-to-date or the merge can be + resolved as a fast-forward. --log[=]:: --no-log:: @@ -54,11 +59,6 @@ merge. With --no-squash perform the merge and commit the result. This option can be used to override --squash. ---ff-only:: - Refuse to merge and exit with a non-zero status unless the - current `HEAD` is already up-to-date or the merge can be - resolved as a fast-forward. - -s :: --strategy=:: Use the given merge strategy; can be supplied more than -- cgit v1.2.1 From 77c72780edfa5e3858423366fc91699724793b39 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 21 Mar 2013 22:57:48 +0100 Subject: Documentation: merging a tag is a special case 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 --- Documentation/merge-options.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation/merge-options.txt') diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 0bcbe0ac3c..34a8445828 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -30,7 +30,8 @@ set to `no` at the beginning of them. --no-ff:: Create a merge commit even when the merge resolves as a - fast-forward. + fast-forward. This is the default behaviour when merging an + annotated (and possibly signed) tag. --ff-only:: Refuse to merge and exit with a non-zero status unless the -- cgit v1.2.1 From efed0022492b81bf59d29193c4ffe96492dd9e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C3=B6tte?= Date: Sun, 31 Mar 2013 18:02:24 +0200 Subject: merge/pull: verify GPG signatures of commits being merged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Documentation/merge-options.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Documentation/merge-options.txt') diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 0bcbe0ac3c..31f1067521 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -83,6 +83,11 @@ option can be used to override --squash. Pass merge strategy specific option through to the merge strategy. +--verify-signatures:: +--no-verify-signatures:: + Verify that the commits being merged have good GPG signatures and abort the + merge in case they do not. + --summary:: --no-summary:: Synonyms to --stat and --no-stat; these are deprecated and will be -- cgit v1.2.1 From eb307ae7bb78ccde4e2ac69f302ccf8834883628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C3=B6tte?= Date: Sun, 31 Mar 2013 18:02:46 +0200 Subject: merge/pull Check for untrusted good GPG signatures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Documentation/merge-options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/merge-options.txt') diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 31f1067521..a0f022b41d 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -85,8 +85,8 @@ option can be used to override --squash. --verify-signatures:: --no-verify-signatures:: - Verify that the commits being merged have good GPG signatures and abort the - merge in case they do not. + Verify that the commits being merged have good and trusted GPG signatures + and abort the merge in case they do not. --summary:: --no-summary:: -- cgit v1.2.1 From 66fa1b2c354f79ed48f5986ee700ccb2d167ccbf Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 16 May 2013 18:26:00 -0400 Subject: Documentation/merge-options.txt: restore `-e` option It looks like commit f8246281af9adb0fdddbcc90d2e19cb5cd5217e5 unintentionally removed the documentation for the `-e` option. Signed-off-by: Richard Hansen Signed-off-by: Junio C Hamano --- Documentation/merge-options.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation/merge-options.txt') diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt index 34a8445828..f192cd2e16 100644 --- a/Documentation/merge-options.txt +++ b/Documentation/merge-options.txt @@ -8,12 +8,13 @@ failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing. --edit:: +-e:: --no-edit:: Invoke an editor before committing successful mechanical merge to further edit the auto-generated merge message, so that the user can explain and justify the merge. The `--no-edit` option can be used to accept the auto-generated message (this is generally - discouraged). The `--edit` option is still useful if you are + discouraged). The `--edit` (or `-e`) option is still useful if you are giving a draft message with the `-m` option from the command line and want to edit it in the editor. + -- cgit v1.2.1