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

Re: Updated git HOWTO for kernel hackers

From
Linus Torvalds <torvalds@osdl.org>
Date
Jun 23, 2005, 02:28 UTC
Message-ID
<Pine.LNX.4.58.0506221915280.11175@ppc970.osdl.org>
In-Reply-To
<42BA18AF.2070406@pobox.com>
On Wed, 22 Jun 2005, Jeff Garzik wrote:
> 
> The output isn't terribly helpful:

Yeah. The good news is that if something bad happens, it surely lets you know, and it's very verbose about that.

I should probably remove the "Fragment applied at offset xx" thing, it was basically a debugging message to make sure that I applied patch fragments correctly even if the line offset given in the patch was sligthly off..

Show 26 quoted lines
> Outputting the following (stolen from 'git commit') would be far more 
> useful:
> 
>        modified: Documentation/networking/cxgb.txt
>        modified: drivers/net/chelsio/Makefile
>        deleted:  drivers/net/chelsio/ch_ethtool.h
>        modified: drivers/net/chelsio/common.h
>        modified: drivers/net/chelsio/cphy.h
>        modified: drivers/net/chelsio/cpl5_cmd.h
>        modified: drivers/net/chelsio/cxgb2.c
>        deleted:  drivers/net/chelsio/cxgb2.h
>        modified: drivers/net/chelsio/elmer0.h
>        modified: drivers/net/chelsio/espi.c
>        modified: drivers/net/chelsio/espi.h
>        modified: drivers/net/chelsio/gmac.h
>        modified: drivers/net/chelsio/mv88x201x.c
>        deleted:  drivers/net/chelsio/osdep.h
>        modified: drivers/net/chelsio/pm3393.c
>        modified: drivers/net/chelsio/regs.h
>        modified: drivers/net/chelsio/sge.c
>        modified: drivers/net/chelsio/sge.h
>        modified: drivers/net/chelsio/subr.c
>        modified: drivers/net/chelsio/suni1x10gexp_regs.h
>        deleted:  drivers/net/chelsio/tp.c
>        deleted:  drivers/net/chelsio/tp.h
>        modified: include/linux/pci_ids.h
How about this patch? Then you can say
	git-apply --stat --summary --apply --index /tmp/my.patch

and it will not only apply the patch, but also give a diffstat and a summary or renames etc..

This also removes the "Fragment.." debugging message.

Btw, "--stat" and "--summary" normally turn off the "apply" flag, so "--apply" has to come _after_ the stat/summary thing, fwiw:

diff --git a/apply.c b/apply.c
--- a/apply.c
+++ b/apply.c
@@ -860,7 +860,6 @@ static int find_offset(const char *buf, 
 		n = (i >> 1)+1;
 		if (i & 1)
 			n = -n;
-		fprintf(stderr, "Fragment applied at offset %d\n", n);
 		return try;
 	}
 
@@ -1434,6 +1433,10 @@ int main(int argc, char **argv)
 			check_index = 1;
 			continue;
 		}
+		if (!strcmp(arg, "--apply")) {
+			apply = 1;
+			continue;
+		}
 		if (!strcmp(arg, "--show-files")) {
 			show_files = 1;
 			continue;

> > Also, you can do
> > 
> > 	git commit <list-of-files-to-commit>
> > 
> > as a shorthand for
> > 
> > 	git-update-cache <list-of-files-to-commit>
> > 	git commit
> > 
> > which some people will probably find more natural.
> 
> It would be natural if it functioned like 'bk citool' ;-)
> 
> 	git commit --figure-out-for-me-what-files-changed
> 
> 'git diff' can do this, so it's certainly feasible.

Well, it _does_ do that. That's what the "git status" thing does, and look 
at the initial commit message comments that it prepares for you: it tells 
you which files are modified but haven't been marked for check-in etc.

But the thing is, you need to have a graphical tool for that. I don't want
to have some silly command line that asks for each modified file whether
you want to include that file in the commit or not.

So this is where "git" ends, and a nice user interface (written by 
somebody else than me) begins. Ie this is a cogito-like thing.

> > "git-whatchanged" is useful if you actually want to see what the commits 
> > _changed_, and then you often want to use the "-p" flag to see it as 
> > patches. Also, it's worth pointing out the fact that you can limit it to 
> > certain subdirectories (or individual files) etc, ie:
> > 
> > 	git-whatchanged -p drivers/net
> > 
> > since that is often what people want.
> > 
> > But if you just want the log, "git log" is faster and simpler and more 
> > correct.
> 
> I usually want just two things:
> 
> 1) browse the log
> 
> 2) list changes in local tree that are not in $remote_tree, a la
> 	bk changes -L ../linux-2.6
> 
> I agree that seeing the merge csets is useful, that is why [being 
> ignorant of 'git log'] I used git-changes-script.

For (1) "bk log" is good. For (2) you'll have to use your own script, or
just have the remote tree as a branch in the same tree, in which case you
can do

	git log remotebranch..mybranch

and it will do what you expect. In fact, since "HEAD" is the default 
branch for the final one, you can do

	git log remotebranch..

and you'll get the log of everything that is in your HEAD but it _not_ in 
the "remotebranch" branch.

Btw, if you have the remote as a branch in your own tree, you can also do

	gitk remotebranch..mybranch

which is a really nice way of graphically seeing "what is in 'mybranch' 
that is not in 'remotebranch'".

			Linus
Previous: Jeff GarzikNext: Adam Kropelin
Message 34 of 94 in “Updated git HOWTO for kernel hackers”
  1. Jeff GarzikJun 22, 2005
  2. Dave JonesJun 22, 2005
  3. Jeff GarzikJun 22, 2005
  4. Dave JonesJun 22, 2005
  5. Jeff GarzikJun 23, 2005
  6. Jeff GarzikJun 25, 2005
  7. Dave JonesJun 25, 2005
  8. Greg KHJun 22, 2005
  9. Linus TorvaldsJun 22, 2005
  10. Jeff GarzikJun 23, 2005
  11. Linus TorvaldsJun 23, 2005
  12. Jeff GarzikJun 23, 2005
  13. Linus TorvaldsJun 23, 2005
  14. Jeff GarzikJun 23, 2005
  15. Linus TorvaldsJun 23, 2005
  16. Jeff GarzikJun 23, 2005
  17. Linus TorvaldsJun 23, 2005
  18. Jeff GarzikJun 23, 2005
  19. Linus TorvaldsJun 23, 2005
  20. Greg KHJun 23, 2005
  21. Linus TorvaldsJun 23, 2005
  22. Greg KHJun 23, 2005
  23. Jeff GarzikJun 23, 2005
  24. Petr BaudisJun 23, 2005
  25. Martin LanghoffJun 23, 2005
  26. Vojtech PavlikJun 23, 2005
  27. Linus TorvaldsJun 22, 2005
  28. Jeff GarzikJun 23, 2005
  29. Linus TorvaldsJun 23, 2005
  30. Jeff GarzikJun 23, 2005
  31. Linus TorvaldsJun 23, 2005
  32. Linus TorvaldsJun 23, 2005
  33. Jeff GarzikJun 23, 2005
  34. Linus TorvaldsJun 23, 2005
  35. Adam KropelinJun 23, 2005
  36. Linus TorvaldsJun 23, 2005
  37. Jeff GarzikJun 23, 2005
  38. Linus TorvaldsJun 23, 2005
  39. Miles BaderJun 23, 2005
  40. Jeff GarzikJun 23, 2005
  41. Linus TorvaldsJun 23, 2005
  42. Anton AltaparmakovJun 23, 2005
  43. Daniel BarkalowJun 23, 2005
  44. Dave AirlieJun 23, 2005
  45. Mercurial vs Updated git HOWTO for kernel hackersMatt Mackall, Jun 23, 2005
  46. Petr BaudisJun 24, 2005
  47. Christopher LiJun 24, 2005
  48. Petr BaudisJun 28, 2005
  49. Andrew ThompsonJun 28, 2005
  50. Petr BaudisJun 28, 2005
  51. Matt MackallJun 28, 2005
  52. Kyle MoffettJun 28, 2005
  53. SeanJun 28, 2005
  54. Matt MackallJun 28, 2005
  55. SeanJun 28, 2005
  56. Kyle MoffettJun 28, 2005
  57. Matt MackallJun 28, 2005
  58. SeanJun 28, 2005
  59. Kyle MoffettJun 28, 2005
  60. SeanJun 28, 2005
  61. Kyle MoffettJun 29, 2005
  62. SeanJun 29, 2005
  63. Kyle MoffettJun 29, 2005
  64. Vojtech PavlikJun 29, 2005
  65. Matt MackallJun 28, 2005
  66. Thomas Arendsen HeinJun 29, 2005
  67. Andrea ArcangeliJun 24, 2005
  68. Theodore Ts'oJun 24, 2005
  69. Paolo CiarrocchiJun 24, 2005
  70. Christopher LiJun 24, 2005
  71. Kevin SmithJun 24, 2005
  72. Matt MackallJun 24, 2005
  73. Petr BaudisJun 28, 2005
  74. Sven VerdoolaegeJun 28, 2005
  75. Petr BaudisJun 28, 2005
  76. Cygwin and Native MS Windows (was: Mercurial vs Updated git HOWTO for kernel hackers)Kevin Smith, Jun 28, 2005
  77. Cogito vs. Git (was: Mercurial vs Updated git HOWTO for kernel hackers)Kevin Smith, Jun 28, 2005
  78. Petr BaudisJun 28, 2005
  79. Matthias UrlichsJun 24, 2005
  80. Linus TorvaldsJun 24, 2005
  81. John W. LinvilleJun 24, 2005
  82. Jeff GarzikJun 24, 2005
  83. Daniel BarkalowJun 24, 2005
  84. Should "git-read-tree -m -u" delete files?Junio C Hamano, Jun 24, 2005
  85. Joel BeckerJun 24, 2005
  86. Kyle MoffettJun 24, 2005
  87. Pavel MachekJun 27, 2005
  88. Kyle MoffettJun 27, 2005
  89. Matt MackallJun 27, 2005
  90. Benjamin LaHaiseJun 27, 2005
  91. Matt MackallJun 27, 2005
  92. Ed TomlinsonJun 27, 2005
  93. Amin AzezJul 8, 2005
  94. Amin AzezJul 11, 2005

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.