Note that there are some explanatory texts on larger screens.

plurals
  1. POIn git, can you view the older commits applied to a file after it has been moved?
    text
    copied!<p>After I have moved a file in git (using <code>git mv</code>), looking at the log for that file only shows the commits including and after the move. </p> <p>Is there any way to view the commits applied to the file under its old name? In the example, below, I'd like to see commits b04033bdc44f1 and 8ca40d563ce5d in <code>git log</code> after I've done the move.</p> <pre><code> $ git init Initialized empty Git repository in /Users/ben/code/git_mv_example/.git/ $ touch foo $ git add foo $ git commit -m "Initial commit" Created initial commit 8ca40d5: Initial commit 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 foo [master*]$ echo "abcdefg" &gt; foo [master*]$ git commit -a -m "edited foo" Created commit b04033b: edited foo 1 files changed, 1 insertions(+), 0 deletions(-) $ git log foo commit b04033bdc44f1eb3477270b4b7ca727377d8c03a Author: Ben Brinckerhoff &lt;ben@devver.net&gt; Date: Tue Jun 2 13:26:53 2009 -0600 edited foo commit 8ca40d563ce5d07d965bfb75a01b9c23378fd321 Author: Ben Brinckerhoff &lt;ben@devver.net&gt; Date: Tue Jun 2 13:26:15 2009 -0600 Initial commit $ git mv foo bar [master+]$ git commit -a -m "renamed foo to bar" Created commit 2bccdf6: renamed foo to bar 1 files changed, 0 insertions(+), 0 deletions(-) rename foo =&gt; bar (100%) $ git log bar commit 2bccdf6fc65b9da5b279d9f1117e436549dd3a7b Author: Ben Brinckerhoff &lt;ben@devver.net&gt; Date: Tue Jun 2 13:27:14 2009 -0600 renamed foo to bar $ git log foo fatal: ambiguous argument 'foo': unknown revision or path not in the working tree. Use '--' to separate paths from revisions </code></pre> <p>Is this not possible? Or perhaps is <code>git log</code> the wrong command for this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload