threads / discuss / 11098

git-merge --no-commit commits

Subject: git-merge --no-commit commits

## tl;dr

4 messages between Dec 2, 2007 and Dec 2, 2007.

replies: 3people: 2as markdown or json

Vegard Nossum· Dec 2, 2007, 16:57 UTC · lore
Hi,

I am using git 1.5.3.4 and just did the following (v1 and v2 are branches; v1 is a parent of v2):

git checkout v1 git merge --no-commit v2

It simply fast-forwarded AND committed even though I explicitly told it not to. What gives?

Kind regards, Vegard Nossum

Jakub Narebski· Dec 2, 2007, 17:10 UTC · re: Vegard Nossum · lore

Re: git-merge --no-commit commits

"Vegard Nossum" <vegard.nossum@gmail.com> writes:
Show 8 quoted lines
> I am using git 1.5.3.4 and just did the following (v1 and v2 are
> branches; v1 is a parent of v2):
> 
> git checkout v1
> git merge --no-commit v2
> 
> It simply fast-forwarded AND committed even though I explicitly told
> it not to. What gives?

The --no-commit option doesn't prevent fast-forward because fast-forward doesn't really _create_ a commit (and -no-commit is really about commit creation). It just advanced ref (branch head).

You probably wanted to use
  $ git merge --no-commit --no-ff v2
HTH
-- 
Jakub Narebski
ShadeHawk on #git
Poland
Vegard Nossum· Dec 2, 2007, 17:18 UTC · re: Jakub Narebski · lore

Re: git-merge --no-commit commits

On Dec 2, 2007 6:10 PM, Jakub Narebski <jnareb@gmail.com> wrote:
Show 19 quoted lines
> "Vegard Nossum" <vegard.nossum@gmail.com> writes:
>
> > I am using git 1.5.3.4 and just did the following (v1 and v2 are
> > branches; v1 is a parent of v2):
> >
> > git checkout v1
> > git merge --no-commit v2
> >
> > It simply fast-forwarded AND committed even though I explicitly told
> > it not to. What gives?
>
> The --no-commit option doesn't prevent fast-forward because
> fast-forward doesn't really _create_ a commit (and -no-commit is
> really about commit creation). It just advanced ref (branch head).
>
> You probably wanted to use
>
>   $ git merge --no-commit --no-ff v2
>

Yes. Thanks. Isn't that counter-intuitive, though? The manpage says that it lets you review the changes first. I assumed this would include fast-forwarding as well. There is no --no-ff in my git-merge manpage. Maybe I need a newer version?

Show 6 quoted lines
> HTH
> --
> Jakub Narebski
> ShadeHawk on #git
> Poland
>
Vegard
Jakub Narebski· Dec 2, 2007, 18:00 UTC · re: Vegard Nossum · lore

Re: git-merge --no-commit commits

On Sun, 2 Dec 2007, Vegard Nossum wrote:
Show 23 quoted lines
> On Dec 2, 2007 6:10 PM, Jakub Narebski <jnareb@gmail.com> wrote:
>> "Vegard Nossum" <vegard.nossum@gmail.com> writes:
>>
>>> I am using git 1.5.3.4 and just did the following (v1 and v2 are
>>> branches; v1 is a parent of v2):
>>>
>>> git checkout v1
>>> git merge --no-commit v2
>>>
>>> It simply fast-forwarded AND committed even though I explicitly told
>>> it not to. What gives?
>>
>> The --no-commit option doesn't prevent fast-forward because
>> fast-forward doesn't really _create_ a commit (and -no-commit is
>> really about commit creation). It just advanced ref (branch head).
>>
>> You probably wanted to use
>>
>>   $ git merge --no-commit --no-ff v2
> 
> Yes. Thanks. Isn't that counter-intuitive, though? The manpage says
> that it lets you review the changes first. I assumed this would
> include fast-forwarding as well. 

But for fast-forward there are no "changes" to review. Just updating branch head. Fast-forward means no new commit.

> There is no --no-ff in my git-merge 
> manpage. Maybe I need a newer version?

It looks like it is not in any released version. I've found description in 'master' version of Documentation/merge-options.txt

-- 
Jakub Narebski
Poland

← back to recent threads