threads / discuss / 19019

auto commit merge using the default merge message

Subject: auto commit merge using the default merge message

## tl;dr

10 messages between Apr 23, 2009 and Apr 24, 2009.

replies: 9people: 6as markdown or json

Caleb Cushing· Apr 23, 2009, 07:46 UTC · lore

so I do the same merge all the time... sorta, I'm not sure rerere would actually work because the file is different each time... I just have to delete it each time. and I want to automate the process. checkout merge rm commmit, problem is commit brings and editor up, I want to commit with the 'auto inserted merge message' that is generated, without seeing the editor, how do I do this?

-- 
Caleb Cushing

http://xenoterracide.blogspot.com
Alex Riesen· Apr 23, 2009, 07:57 UTC · re: Caleb Cushing · lore

Re: auto commit merge using the default merge message

2009/4/23 Caleb Cushing <xenoterracide@gmail.com>:
Show 6 quoted lines
> so I do the same merge all the time... sorta, I'm not sure rerere
> would actually work because the file is different each time... I just
> have to delete it each time. and I want to automate the process.
> checkout merge rm commmit, problem is commit brings and editor up, I
> want to commit with the 'auto inserted merge message' that is
> generated, without seeing the editor, how do I do this?

See git commit -C <commit-with-fitting-description>, git commit -F <message-file> and git commit -m "message text".

Michael J Gruber· Apr 23, 2009, 08:25 UTC · re: Alex Riesen · lore

Re: auto commit merge using the default merge message

Alex Riesen venit, vidit, dixit 23.04.2009 09:57:
Show 10 quoted lines
> 2009/4/23 Caleb Cushing <xenoterracide@gmail.com>:
>> so I do the same merge all the time... sorta, I'm not sure rerere
>> would actually work because the file is different each time... I just
>> have to delete it each time. and I want to automate the process.
>> checkout merge rm commmit, problem is commit brings and editor up, I
>> want to commit with the 'auto inserted merge message' that is
>> generated, without seeing the editor, how do I do this?
> 
> See git commit -C <commit-with-fitting-description>,
> git commit -F <message-file> and git commit -m "message text".

I think he wants the auto generated message which may be different for each merge. Maybe something like

GIT_EDITOR=/bin/true git commit
will do the trick.
Michael
Junio C Hamano· Apr 23, 2009, 08:32 UTC · re: Michael J Gruber · lore

Re: auto commit merge using the default merge message

Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 6 quoted lines
> I think he wants the auto generated message which may be different for
> each merge. Maybe something like
>
> GIT_EDITOR=/bin/true git commit
>
> will do the trick.

Use "GIT_EDITOR=:" instead. It also is *true* just like /bin/true, but git knows a simple magic about this and avoids an extra fork+exec.

A similar trick exists for GIT_PAGER=cat (not "/bin/cat"), by the way.
Michael J Gruber· Apr 23, 2009, 09:07 UTC · re: Junio C Hamano · lore

Re: auto commit merge using the default merge message

Junio C Hamano venit, vidit, dixit 23.04.2009 10:32:
Show 12 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> I think he wants the auto generated message which may be different
>> for each merge. Maybe something like
>> 
>> GIT_EDITOR=/bin/true git commit
>> 
>> will do the trick.
> 
> Use "GIT_EDITOR=:" instead.  It also is *true* just like /bin/true,
> but git knows a simple magic about this and avoids an extra
> fork+exec.
Good to know!
> A similar trick exists for GIT_PAGER=cat (not "/bin/cat"), by the
> way.
> 

So, GIT_PAGER=cat differs from GIT_PAGER=/bin/cat even when `which cat`==/bin/cat?

Michael
Brian Gernhardt· Apr 23, 2009, 16:19 UTC · re: Michael J Gruber · lore

Re: auto commit merge using the default merge message

On Apr 23, 2009, at 5:07 AM, Michael J Gruber wrote:
Show 13 quoted lines
> Junio C Hamano venit, vidit, dixit 23.04.2009 10:32:
>> Use "GIT_EDITOR=:" instead.  It also is *true* just like /bin/true,
>> but git knows a simple magic about this and avoids an extra
>> fork+exec.
>
> Good to know!
>
>> A similar trick exists for GIT_PAGER=cat (not "/bin/cat"), by the
>> way.
>>
>
> So, GIT_PAGER=cat differs from GIT_PAGER=/bin/cat even when `which
> cat`==/bin/cat?

Yes, if $GIT_PAGER == "cat", then git won't launch a pager at all. If $GIT_PAGER == "/bin/cat", then git will launch /bin/cat and pipe all of it's output through it. The result is (assuming a functional /bin/ cat) identical, but "cat" avoids the extra memory usage of "/bin/cat".

~~ Brian
Caleb Cushing· Apr 24, 2009, 01:31 UTC · re: Junio C Hamano · lore

Re: auto commit merge using the default merge message

On Thu, Apr 23, 2009 at 4:32 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Use "GIT_EDITOR=:" instead.  It also is *true* just like /bin/true, but
> git knows a simple magic about this and avoids an extra fork+exec.
>
So I could put
GIT_EDITOR=:

at the top of my shell script, and then whenever I need to do a commit, just git commit and it'll work (assuming the commit has a default message).

-- 
Caleb Cushing

http://xenoterracide.blogspot.com
Jeff King· Apr 24, 2009, 14:06 UTC · re: Caleb Cushing · lore

Re: auto commit merge using the default merge message

On Thu, Apr 23, 2009 at 09:31:10PM -0400, Caleb Cushing wrote:
Show 12 quoted lines
> On Thu, Apr 23, 2009 at 4:32 AM, Junio C Hamano <gitster@pobox.com> wrote:
> > Use "GIT_EDITOR=:" instead.  It also is *true* just like /bin/true, but
> > git knows a simple magic about this and avoids an extra fork+exec.
> >
> 
> So I could put
> 
> GIT_EDITOR=:
> 
> at the top of my shell script, and then whenever I need to do a
> commit, just git commit and it'll work (assuming the commit has a
> default message).
You need to also
  export GIT_EDITOR
for "git commit" to see it.
-Peff
Caleb Cushing· Apr 24, 2009, 17:50 UTC · re: Jeff King · lore

Re: auto commit merge using the default merge message

On Fri, Apr 24, 2009 at 10:06 AM, Jeff King <peff@peff.net> wrote:
> export GIT_EDITOR
>
maybe I'm being silly, but won't that then affect my interactive shells?
-- 
Caleb Cushing

http://xenoterracide.blogspot.com
Jeff King· Apr 24, 2009, 17:55 UTC · re: Caleb Cushing · lore

Re: auto commit merge using the default merge message

On Fri, Apr 24, 2009 at 01:50:57PM -0400, Caleb Cushing wrote:
> On Fri, Apr 24, 2009 at 10:06 AM, Jeff King <peff@peff.net> wrote:
> > export GIT_EDITOR
> >
> maybe I'm being silly, but won't that then affect my interactive shells?

No, because you're putting it in your shell script, not in your .profile (right?). The "export" command just tells the shell "pass this variable in the environment to any child processes you spawn". Without it, the variable is local to that shell.

-Peff

← back to recent threads