Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've found there are two ways for solving this problem</p> <p><em>note</em>: don't use both at the same time, as if the commit fails to merge it will add the log again to the bottom.</p> <p><em>personal note</em>: I'm using the first solution as it relies entirely on git's hooks and config properties, instead of an external script.<br> For a real solution one would have to extend a git command named 'fmt-merge-msg' that generates the oneline descriptions when passing the --log option (if you really need this solution you'll have to create your own patch (for git) and compile it from source). </p> <p><strong>1. using prepare-commit-message as VonC <a href="https://stackoverflow.com/questions/3148863/how-can-i-customize-gits-merge-commit-message/3149262#3149262">suggested</a></strong><br> this solution has the problem that you need to interrupt the commit and then commit manually</p> <p>setting an alias that will build the desired commit message:</p> <pre><code>[alias] lm = log --pretty=format:'%s%n by %C(yellow)%an%Creset (%ad)%n %n%b' --date=local </code></pre> <p>creating the prepare-commit-msg hook by creating an executable prepare-commit-msg in $GIT_DIR/hooks/ (example script below)</p> <pre><code>#!/bin/sh #... case "$2,$3" in merge,) echo "Merge details:" &gt;&gt; $1 echo "" &gt;&gt; $1 git lm ORIG_HEAD..MERGE_HEAD &gt;&gt; "$1" ;; *) ;; esac </code></pre> <p>one should define an alias commit msg such as</p> <pre><code>[alias] m = merge --no-ff --no-commit </code></pre> <p><strong>2. using a custom command that will generate the merge automatically</strong><br> (using the lm alias created in 1.)</p> <pre><code>#!/bin/sh echo "" echo "merge with commit details -- HEAD..$1" git merge --no-ff --no-log -m "`git lm HEAD..$1`" --no-commit $1 </code></pre> <p>and then execute a rather rigid command:</p> <pre><code>./cmd-name &lt;branch to merge&gt; </code></pre> <p>if you still wish to have the oneline description of the commits you'll need to add new commands or whatever to the -m argument (if you use --log then it will be generated on the bottom)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload