git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: wuzhouhui <wuzhouhui14@mails.ucas.ac.cn>
To: "junio c hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org, cuifang@sugon.com
Subject: Re: Re: How to find the commit that erase a change
Date: Wed, 9 Oct 2019 11:51:52 +0800 (GMT+08:00)	[thread overview]
Message-ID: <6cfb13f7.1fa14.16daea502c2.Coremail.wuzhouhui14@mails.ucas.ac.cn> (raw)
In-Reply-To: <xmqqmuealiy3.fsf@gitster-ct.c.googlers.com>

> -----Original Messages-----
> From: "Junio C Hamano" <gitster@pobox.com>
> Sent Time: 2019-10-09 11:02:44 (Wednesday)
> To: wuzhouhui <wuzhouhui14@mails.ucas.ac.cn>
> Cc: git@vger.kernel.org, cuifang@sugon.com
> Subject: Re: How to find the commit that erase a change
> 
> wuzhouhui <wuzhouhui14@mails.ucas.ac.cn> writes:
> 
> > I have a file which contains complicated change history. When I use
> >     git log -p file
> > to see all changes made in this file, I found that a change disappeared
> > for no reason.
> 
> "git log [-p] <pathspec>" is not about seeing *all* changes made to
> the path(s) that match the pathspec.  Especially when your history
> has merges, the command is to give you _one_ simplest explanation as
> to how the contents of the path(s) came to be in the shape you see
> in HEAD.
> 
> So for example, if you have a history like this (time flows from
> left to right):
> 
>     O-----A-----B----M-----N
>            \        /
>             \      /
>              X----Y
> 
> where A or B did *not* touch "file", X added a definition of func()
> to "file", Y reverted the change X made to "file", M made a natural
> merge between B and Y and N did not touch "file", "git log N file"
> would not even show the existence of commits X or Y.  In the larger
> picture, at ancient time O, the file started without func(), and
> none of the commits A, B, M or N felt the need to add it and as the
> result, N does not need the unwanted func().  So "file's contents
> are the same since O throughout the history reaching N" is given as
> _one_ simplest explanation.
> 
> The "--full-history" option may help, though.

"--full-history" doesn't resolve my problem, but
    git log -p -c file
does. I found that my change was erased in a merge commit.

Thanks.

  reply	other threads:[~2019-10-09  3:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09  2:28 How to find the commit that erase a change wuzhouhui
2019-10-09  3:02 ` Junio C Hamano
2019-10-09  3:51   ` wuzhouhui [this message]
2019-10-09 13:21     ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cfb13f7.1fa14.16daea502c2.Coremail.wuzhouhui14@mails.ucas.ac.cn \
    --to=wuzhouhui14@mails.ucas.ac.cn \
    --cc=cuifang@sugon.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).