Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6137477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:43:52+00:00 2026-05-23T17:43:52+00:00

My project underwent multiple directory renames and directory splitting. gitk deals with that very

  • 0

My project underwent multiple directory renames and directory splitting. gitk deals with that very nicely and is capable of tracking a file from head to all file revisions down to the very first one.

Emacs, however, seems to stumble upon the first rename. It only lists a few recent revisions when doing Ctrl-x v l (Tools > Version Control > Show History on the menu, vc-git-print-log function in vc-git.el):

commit 13172930ab094badeab81cd2e05119d2a4c1f58a
Author: WinWin <winwin@example.com>
Date:   Tue Jul 12 18:17:27 2011 -0600

    commit comment 

commit 0b52ca957a79a26e51bdd6f7193ef913c4abdc7b
Author: WinWin <winwin@example.com>
Date:   Tue Jul 10 10:39:12 2011 -0600

    commit comment 

commit 8ca577e532849203646867527921b66aa1162dbd
Author: WinWin <winwin@example.com>
Date:   Tue Jul 10 08:01:59 2011 -0600

    commit comment 

commit 9e623a23ad485d0937fe5409162f07434be8ca63
Author: WinWin <winwin@example.com>
Date:   Tue Jul 10 01:50:39 2011 -0600

    commit comment 

Since I am used to the way Emacs built-in support for Version Control works (finger habits from the CVS days…), I wonder whether it is possible to enable it to track the entire revision history, despite the renames, just as gitk does, without using a completely different package?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:43:53+00:00Added an answer on May 23, 2026 at 5:43 pm

    You have other packages for integrating git with Emacs, as described here (maggit, git-emacs or egg, an old fork from maggit).

    What you need to check, in git.el or in those other implementation, is how they implement git log:
    Only a git log -M -C will find renames and copies of a file(*) (or at least a git log --follow).
    (Also, check your git version)

    (*): Not exactly for one file: –follow is the right option when displaying the log for one file. See the last part of this answer to know why.

    That being said, without changing anything to your current package, you can check your local git config, and try:

    git config diff.renames copies
    

    and see if that changes the default git.el log result.


    The OP WinWin reports:

    • the --follow is the right option use for rename and copy detection for one given file.
    • that modifying C:\emacs-23.2\lisp\vc-git.el (and deleting vc-git.elc in same folder, this is important!), adding “--follow” to the (defun vc-git-print-log ... part is enough for said option to be active.

    Note: to understand the difference between -C and -M options, and --follow, see this thread

    Jakub Narębski mentioned in May 2010 (and that still seems accurate in July 2011):

    ‘-M/-C‘ is useful with “git diff” without pathspec, including e.g. “git show -C“.

    The problem with “git log -M -- <filename>” is that history simplification, which is required for good performance, happens before diff mechanism has a chance to perform rename detection. Before there was ‘--follow‘ option to git-log (which supports only the case of single file, and doesn’t work that well with more complicated history), you were forced to do:

    $ git log -M -- <filename> <oldname> <oldername>...
    

    Also, is there a way to set this as the default for ‘git log‘?

    I don’t think so. Note also that ‘--follow‘ works only with single file, and does not work for example (currently) with directory pathspec.

    To which, Eli Barzilay adds:

    OK, so just to clear this up:
    -C and -M (and --find-copies-harder) are for ‘diff‘, and --follow is for ‘log‘ with a single file (and each will pass it on to the other)?

    Jeff King answers:

    Yes (well, diff can never pass --follow to log, since diff never invokes log, but yes, the per-commit diff shown by log uses the -C and -M given to log).


    About the config settings, Jeff King mentions:

    copy detection can be really* slow. There is a reason it isn’t on by default.
    Try “git log -1000 -p” versus “git log -1000 -p -C -M --find-copies-harder” in some repository.
    In a simple git.git test, it is almost 5x slower (about 1 second versus 5 seconds on my machine).
    For large repositories, it can be much worse, because now each diff is O(size of repository) instead of O(size of changes).

    Still, I see your point that you might want it on all the time, if you have a sufficiently small repo. There is “diff.renames” to turn on rename detection all the time.
    But I think a log.follow option doesn’t make sense at this point:

    $ git config log.follow true
    $ git log foo.c ;# ok, follow foo.c
    $ git log foo.c bar.c ;# uh oh, now what?
    

    Does the last one just barf, and make you say “git log --no-follow foo.c bar.c“?
    Does it quietly turn off --follow, making the user guess why “git log foo.c” finds some history that “git log foo.c bar.c” doesn’t?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Project: I am having a button that toggles the column length from 3 to
My project parse xml file from dblp , it about 1Gb to save in
My project has a file foo that I've been using and checking in with
Every project invariably needs some type of reporting functionality. From a foreach loop in
My project has both client and server components in the same solution file. I
Project Requirements: I need to build a web service that will receive chunks of
Project Euler has a paging file problem (though it's disguised in other words). I
Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on
Project is C#. So I have a bunch of multithreaded code that is designed
Project Structure I have a silverlight project SLProj, that references a silverlight class library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.