I would love to be able to use the -m flag and --log together with git merge and pull to be able to create a custom commit message but also include one-line summaries of each of the commits being merged/pulled.
threads / discuss / 24545
Possible feature request for merge and pull
Subject: Possible feature request for merge and pull
Re: Possible feature request for merge and pull
On Wed, Jul 28, 2010 at 01:24, Bradley Wagner <bradley.wagner@hannonhill.com> wrote:
> I would love to be able to use the -m flag and --log together with git > merge and pull to be able to create a custom commit message but also > include one-line summaries of each of the commits being merged/pulled.
This sort of thing has vaguely come up before, and it was mentioned that you can just use a small script that calls git-filter-branch or git-rebase -i.
It's easy to rewrite the commits you just pulled, having some feature that e.g. adds a custom message to the beginning of each of them would just impose an artificial limitation and overlap with existing (and more powerful) functionality.
Re: Possible feature request for merge and pull
On Wed, Jul 28, 2010 at 3:34 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 14 quoted lines
> On Wed, Jul 28, 2010 at 01:24, Bradley Wagner > <bradley.wagner@hannonhill.com> wrote: >> I would love to be able to use the -m flag and --log together with git >> merge and pull to be able to create a custom commit message but also >> include one-line summaries of each of the commits being merged/pulled. > > This sort of thing has vaguely come up before, and it was mentioned > that you can just use a small script that calls git-filter-branch or > git-rebase -i. > > It's easy to rewrite the commits you just pulled, having some feature > that e.g. adds a custom message to the beginning of each of them would > just impose an artificial limitation and overlap with existing (and > more powerful) functionality.
If I understand correctly, the request is not to rewrite the pulled commits, but just to produce a nice message in the newly-created merge commit.
It sounds like --log and -m are currently incompatible, in that -m overrides --log, and that's not the desired behaviour. Bradley: this is probably a relatively easy fix to make, in case you're looking to get into some git hacking. :)
Have fun,
Avery
Re: Possible feature request for merge and pull
Avery,
On Wed, Jul 28, 2010 at 4:49 PM, Avery Pennarun <apenwarr@gmail.com> wrote:
Show 20 quoted lines
> On Wed, Jul 28, 2010 at 3:34 AM, Ævar Arnfjörð Bjarmason > <avarab@gmail.com> wrote: >> On Wed, Jul 28, 2010 at 01:24, Bradley Wagner >> <bradley.wagner@hannonhill.com> wrote: >>> I would love to be able to use the -m flag and --log together with git >>> merge and pull to be able to create a custom commit message but also >>> include one-line summaries of each of the commits being merged/pulled. >> >> This sort of thing has vaguely come up before, and it was mentioned >> that you can just use a small script that calls git-filter-branch or >> git-rebase -i. >> >> It's easy to rewrite the commits you just pulled, having some feature >> that e.g. adds a custom message to the beginning of each of them would >> just impose an artificial limitation and overlap with existing (and >> more powerful) functionality. > > If I understand correctly, the request is not to rewrite the pulled > commits, but just to produce a nice message in the newly-created merge > commit.
Yes, that's correct.
> It sounds like --log and -m are currently incompatible, in that -m > overrides --log, and that's not the desired behaviour.
Correct, I can't remember which overrides which but basically it's as if you just used one of them. Also, git pull doesn't appear to take a -m flag at all.
> Bradley: this > is probably a relatively easy fix to make, in case you're looking to > get into some git hacking. :)
Nice, I may check that out.
Show 5 quoted lines
> > Have fun, > > Avery >
-- Hannon Hill - Put Us to the Test bradley.wagner@hannonhill.com | http://www.hannonhill.com
Re: Possible feature request for merge and pull
On Wed, Jul 28, 2010 at 04:49:11PM -0400, Avery Pennarun wrote:
> It sounds like --log and -m are currently incompatible, in that -m > overrides --log, and that's not the desired behaviour. Bradley: this > is probably a relatively easy fix to make, in case you're looking to > get into some git hacking. :)
Really? I get:
$ mkdir repo && cd repo && git init &&
echo content >file && git add file && git commit -m one &&
echo content >>file && git commit -a -m two &&
git checkout -b other HEAD^ &&
echo content >file2 && git add file2 && git commit -m three &&
git merge --log -m "custom message" master &&
git showcommit fa21035ea5f5437e8664a5d249e7ab88ee3f0e75 Merge: d12be4a 4dc5cba Author: Jeff King <peff@peff.net> Date: Wed Jul 28 20:50:39 2010 -0400
custom message
* master:
twowhich seems to be what was asked for. So is the problem just that git-pull does not take "-m"?
-Peff
Re: Possible feature request for merge and pull
On Wed, Jul 28, 2010 at 9:03 PM, Jeff King <peff@peff.net> wrote:
Show 32 quoted lines
> On Wed, Jul 28, 2010 at 04:49:11PM -0400, Avery Pennarun wrote: > >> It sounds like --log and -m are currently incompatible, in that -m >> overrides --log, and that's not the desired behaviour. Bradley: this >> is probably a relatively easy fix to make, in case you're looking to >> get into some git hacking. :) > > Really? I get: > > $ mkdir repo && cd repo && git init && > echo content >file && git add file && git commit -m one && > echo content >>file && git commit -a -m two && > git checkout -b other HEAD^ && > echo content >file2 && git add file2 && git commit -m three && > git merge --log -m "custom message" master && > git show > > commit fa21035ea5f5437e8664a5d249e7ab88ee3f0e75 > Merge: d12be4a 4dc5cba > Author: Jeff King <peff@peff.net> > Date: Wed Jul 28 20:50:39 2010 -0400 > > custom message > > * master: > two > > which seems to be what was asked for. So is the problem just that > git-pull does not take "-m"? > > -Peff >
--log is supposed to include one-log summaries of each of the merged commits, right? It's not doing that for me when when I do 'git merge --log -m "message" <branch>'. Instead, it's only using the message I specified with -m.
One difference is that I'm merging topic branch into master but that shouldn't make any difference.
Your right that the other part of the request is to add -m to pull.
Re: Possible feature request for merge and pull
Bradley Wagner wrote:
> On Wed, Jul 28, 2010 at 9:03 PM, Jeff King <peff@peff.net> wrote:
>> Really? I get:
[...]
> --log is supposed to include one-log summaries of each of the merged > commits, right? It's not doing that for me
Just a wild guess, but are you using a version of git before 1.7.1.1?
If you upgrade, you'll be able to use -m with --log for "git merge", at least (v1.7.1.1~23^2: merge: --log appends shortlog to message if specified, 2010-05-11).
Thanks, Tay! Jonathan
Re: Possible feature request for merge and pull
On Wed, Jul 28, 2010 at 9:27 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 10 quoted lines
> Bradley Wagner wrote: >> On Wed, Jul 28, 2010 at 9:03 PM, Jeff King <peff@peff.net> wrote: > >>> Really? I get: > [...] >> --log is supposed to include one-log summaries of each of the merged >> commits, right? It's not doing that for me > > Just a wild guess, but are you using a version of git before > 1.7.1.1?
Certainly am: git version 1.7.0
> If you upgrade, you'll be able to use -m with --log for > "git merge", at least (v1.7.1.1~23^2: merge: --log appends > shortlog to message if specified, 2010-05-11).
Thanks, I'll do that.
> Thanks, Tay! > Jonathan
Re: Possible feature request for merge and pull
On Wed, Jul 28, 2010 at 9:30 PM, Bradley Wagner <bradley.wagner@hannonhill.com> wrote:
Show 19 quoted lines
> On Wed, Jul 28, 2010 at 9:27 PM, Jonathan Nieder <jrnieder@gmail.com> wrote: >> Bradley Wagner wrote: >>> On Wed, Jul 28, 2010 at 9:03 PM, Jeff King <peff@peff.net> wrote: >> >>>> Really? I get: >> [...] >>> --log is supposed to include one-log summaries of each of the merged >>> commits, right? It's not doing that for me >> >> Just a wild guess, but are you using a version of git before >> 1.7.1.1? > > Certainly am: git version 1.7.0 > >> If you upgrade, you'll be able to use -m with --log for >> "git merge", at least (v1.7.1.1~23^2: merge: --log appends >> shortlog to message if specified, 2010-05-11). > > Thanks, I'll do that.
New version works great with merge. Thanks guys! Now I'm wondering if we could bring -m flag to pull.
Re: Possible feature request for merge and pull
On Thu, Jul 29, 2010 at 12:20 AM, Bradley Wagner <bradley.wagner@hannonhill.com> wrote:
> New version works great with merge. Thanks guys! Now I'm wondering if > we could bring -m flag to pull.
I'm sure this is also an easy patch if you're in the mood to contribute it :)
Perhaps there are reasons this was left out originally, but I'm guessing it was just that nobody expressed any need for it.
Have fun,
Avery