From: Junio C Hamano Date: Thu, 09 Feb 2006 01:35:49 GMT Subject: Re: Two crazy proposals for changing git's diff commands Message-ID: <7v3bitl3ey.fsf@assigned-by-dhcp.cox.net> In-Reply-To: Linus Torvalds writes: > In particular, I think the real culprit is the plain "git diff" with no > arguments at all. Right now it ends up showing just a piece of the > picture, and the piece it shows is incomplete enough to be irritating. Not necessarily. Your "during the merge" example is a good one, and "so far it looks good and I do not want to see these diffs while modifying things further -- update-index it!" workflow benefits immensely from it. > Right now a plain "git diff" only shows the differences in the current > tree against the index. I think that was just the wrong choice. I think > almost everybody would actually prefer the default to be to show the > difference against HEAD. I somehow suspect this is welding training wheels to your bicycle. > Teaching "git status" to take a "-p" flag (for "patch" - or -v for > "verbose") might actually be a good thing. Then, instead of "git diff", > you'd use "git status -p" and it would show you what the differences are > in the index, and what they are in the tree, so you'd _really_ know what > "git commit" in all its glory would do. I think this may not be a bad idea. What we could do is this: $ git status -v [--only | --include] [paths...] When -v is given, it takes the same parameter as "git commit", and changes its output format from the usual N x "# useful info lines" to something like: --- diff ... --- a/path +++ b/path @@ -N,M +L,K @@ that shows the commit preview. At the same time we change "git commit" commit log message reader to stop reading the input at the first '---' line, just like we do for e-mailed patches. Then: - If you want a commit preview _before_ initiating a commit, you can say: $ git status -v [whatever you planned to give git commit] - If you want a commit preview _while_ writing the commit log, you can say: $ git commit -v [whatever your parameters are] which internally would pass the -v and "$@" to git status that seeds the log message - If you want a commit preview after you made a commit, it is too late ;-).