git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Re: git log -M -- filename is not working?

From
Jeff King <peff@peff.net>
Date
May 8, 2010, 04:44 UTC
Message-ID
<20100508044434.GC14998@coredump.intra.peff.net>
In-Reply-To
<19428.24021.324557.517627@winooski.ccs.neu.edu>
On Fri, May 07, 2010 at 02:37:09PM -0400, Eli Barzilay wrote:
> BTW, I've had at least 4 people now who got confused by this.  Is
> there any use for -M/-C without --follow?  In any case, it will be
> very helpful if the -M/-C descriptions said "see also --follow".
Yes, it detects renames when doing diffs.
Documentation patch is below.
> Also, is there a way to set this as the default for `git log'?

If you mean --follow, then no. Nor would you probably want to, because the --follow mechanism (as currently implemented) is pretty restricted. It can only take a single path currently.

-- >8 --
Subject: [PATCH] docs: clarify meaning of -M for git-log

As an option to the "diff" family, it is fairly obvious what "detect renames" means. However, for revision traversal, the "-M" option is just included in the long list of options, with no indication that it is about showing renames in diffs versus following renames. Let's make it more explicit.

Signed-off-by: Jeff King <peff@peff.net>
---
The only other revision traversal manpage that includes diff-options
seems to be format-patch. Should it get the same treatment?
 Documentation/diff-options.txt |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index c9c6c2b..3070ddd 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -177,7 +177,14 @@ endif::git-format-patch[]
 	Break complete rewrite changes into pairs of delete and create.
 
 -M::
+ifndef::git-log[]
 	Detect renames.
+endif::git-log[]
+ifdef::git-log[]
+	If generating diffs, detect and report renames for each commit.
+	For following files across renames while traversing history, see
+	`--follow`.
+endif::git-log[]
 
 -C::
 	Detect copies as well as renames.  See also `--find-copies-harder`.
-- 
1.7.1.176.gcff095.dirty
Previous: Jakub NarebskiNext: Eli Barzilay
Message 7 of 26 in “git log -M -- filename is not working?”
  1. Eugene SajineMay 7, 2010
  2. Jacob HelwigMay 7, 2010
  3. Eugene SajineMay 7, 2010
  4. Eli BarzilayMay 7, 2010
  5. Matthieu MoyMay 7, 2010
  6. Jakub NarebskiMay 7, 2010
  7. Jeff KingMay 8, 2010
  8. Eli BarzilayMay 8, 2010
  9. Jeff KingMay 8, 2010
  10. Junio C HamanoMay 8, 2010
  11. Eli BarzilayMay 8, 2010
  12. Jeff KingMay 12, 2010
  13. Eli BarzilayMay 12, 2010
  14. Jeff KingMay 12, 2010
  15. Jeff KingMay 12, 2010
  16. Eli BarzilayMay 12, 2010
  17. Bo YangMay 12, 2010
  18. Jeff KingMay 12, 2010
  19. Bo YangMay 13, 2010
  20. Eli BarzilayMay 13, 2010
  21. Jeff KingMay 14, 2010
  22. Eli BarzilayMay 14, 2010
  23. Bo YangMay 12, 2010
  24. Jeff KingMay 12, 2010
  25. Eli BarzilayMay 12, 2010
  26. Bo YangMay 12, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.