# How to determine the order of commit

4 messages from 2019-03-05 to 2019-03-05. Participants: wuzhouhui, Christian Couder, Junio C Hamano.
Thread: https://gitlist.dev/t/50655

## wuzhouhui, 2019-03-05 08:51

Subject: How to determine the order of commit
Message-ID: <40f11dda.1d424.1694d0cd42b.Coremail.wuzhouhui14@mails.ucas.ac.cn>
URL: https://gitlist.dev/e/40f11dda.1d424.1694d0cd42b.Coremail.wuzhouhui14%40mails.ucas.ac.cn

```
Hi,

Suppose I have "git format-patch" two commit from a repository like
following:

  git format-patch -1 cf1c9ccba730
  git format-patch -1 d1a2930d8a99

Now, how to determine the commit order of these two patch in repository?
```

## Christian Couder, 2019-03-05 12:39

Subject: Re: How to determine the order of commit
Message-ID: <CAP8UFD21SaWUSqpKjTYVQkbQxLpFEhvjJW8019i6tAS9agnWGg@mail.gmail.com>
URL: https://gitlist.dev/e/CAP8UFD21SaWUSqpKjTYVQkbQxLpFEhvjJW8019i6tAS9agnWGg%40mail.gmail.com
In-Reply-To: <40f11dda.1d424.1694d0cd42b.Coremail.wuzhouhui14@mails.ucas.ac.cn>

```
Hi,

On Tue, Mar 5, 2019 at 10:00 AM wuzhouhui <wuzhouhui14@mails.ucas.ac.cn> wrote:
>
> Suppose I have "git format-patch" two commit from a repository like
> following:
>
>   git format-patch -1 cf1c9ccba730
>   git format-patch -1 d1a2930d8a99
>
> Now, how to determine the commit order of these two patch in repository?

Do you mean something like:

$ git merge-base --is-ancestor cf1c9ccba730 d1a2930d8a99

and:

$ git merge-base --is-ancestor d1a2930d8a99 cf1c9ccba730

?

```

## wuzhouhui, 2019-03-05 13:17

Subject: Re: How to determine the order of commit
Message-ID: <1AC99C35-03C0-4121-93B2-0D42F126106D@mails.ucas.ac.cn>
URL: https://gitlist.dev/e/1AC99C35-03C0-4121-93B2-0D42F126106D%40mails.ucas.ac.cn
In-Reply-To: <CAP8UFD21SaWUSqpKjTYVQkbQxLpFEhvjJW8019i6tAS9agnWGg@mail.gmail.com>

```

> On Mar 5, 2019, at 8:39 PM, Christian Couder <christian.couder@gmail.com> wrote:
> 
> Hi,
> 
> On Tue, Mar 5, 2019 at 10:00 AM wuzhouhui <wuzhouhui14@mails.ucas.ac.cn> wrote:
>> 
>> Suppose I have "git format-patch" two commit from a repository like
>> following:
>> 
>>  git format-patch -1 cf1c9ccba730
>>  git format-patch -1 d1a2930d8a99
>> 
>> Now, how to determine the commit order of these two patch in repository?
> 
> Do you mean something like:
> 
> $ git merge-base --is-ancestor cf1c9ccba730 d1a2930d8a99
> 
> and:
> 
> $ git merge-base --is-ancestor d1a2930d8a99 cf1c9ccba730
> 
Yep, that's what I want. Thanks!
> ?


```

## Junio C Hamano, 2019-03-05 13:59

Subject: Re: How to determine the order of commit
Message-ID: <xmqqva0xtoar.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqva0xtoar.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CAP8UFD21SaWUSqpKjTYVQkbQxLpFEhvjJW8019i6tAS9agnWGg@mail.gmail.com>

```
Christian Couder <christian.couder@gmail.com> writes:

> Hi,
>
> On Tue, Mar 5, 2019 at 10:00 AM wuzhouhui <wuzhouhui14@mails.ucas.ac.cn> wrote:
>>
>> Suppose I have "git format-patch" two commit from a repository like
>> following:
>>
>>   git format-patch -1 cf1c9ccba730
>>   git format-patch -1 d1a2930d8a99
>>
>> Now, how to determine the commit order of these two patch in repository?
>
> Do you mean something like:
>
> $ git merge-base --is-ancestor cf1c9ccba730 d1a2930d8a99
>
> and:
>
> $ git merge-base --is-ancestor d1a2930d8a99 cf1c9ccba730
>
> ?

What if neither is true ;-)?

```
