git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Perrin Meyer <perrinmeyer@yahoo.com>
Cc: git <git@vger.kernel.org>
Subject: Re: lost history with directory move?
Date: Mon, 28 Jan 2008 21:21:41 -0500	[thread overview]
Message-ID: <20080129022141.GF24004@spearce.org> (raw)
In-Reply-To: <66024.57523.qm@web52812.mail.re2.yahoo.com>

Perrin Meyer <perrinmeyer@yahoo.com> wrote:
> $ mv doc/ Documentation/
> $ git commit -a 
> where I see a lot of deletes
> 
> $ git add Documentation/
> $ git commit -a
> and I see that a all my doc files added, as expected. 
> 
> But when I got to look at the history of the Documentation/ directory
> 
> $ git log Documentation/
> 
> I only see one commit message 
> 
> $ git log --follow Documentation/

--follow only works on a single file.  So you cannot use
it for an entire directory.
 
> $ git log --follow README
> 
> I only see the single rename commit, not any history. 

Right, because the file came into existance in that commit and we
cannot find any deleted path in that same commit that is "highly
similar" to the file now called Documentation/README.  So we don't
call it a rename.
 
> I'm guessing, in hindsight, that I probably should have done
> 
> $ mv doc/ Documentation/
> $ git add Documentation/
> $ git commit -a 

Correct.  Rename detection works by looking for an add/delete pair
_in the same commit_ that have file content that is higly similar
between the two paths.  You broke that by doing the two changes in
two different commits.
 
> but is there anyway to get my history back given what I have done? 

I can't think of one other than to squash the two commits together
with a tool like `git rebase -i` and then force push it back to
your upstream repository.  Note that doing this would change the
commit SHA-1 names so anyone who has built on top of these changes
would also need to rebase their changes.

-- 
Shawn.

      reply	other threads:[~2008-01-29  2:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29  1:22 lost history with directory move? Perrin Meyer
2008-01-29  2:21 ` Shawn O. Pearce [this message]

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

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

  git send-email \
    --in-reply-to=20080129022141.GF24004@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=perrinmeyer@yahoo.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.
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 NNTP newsgroup(s).