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

Re: git-commit: select which files to commit while editing the commit message

From
LTLuben Tuikov <ltuikov@yahoo.com>
Date
Dec 8, 2006, 20:45 UTC
Message-ID
<360959.72234.qm@web31809.mail.mud.yahoo.com>
In-Reply-To
<elcegl$qfh$1@sea.gmane.org>
--- Jakub Narebski <jnareb@gmail.com> wrote:
Show 31 quoted lines
> Junio C Hamano wrote:
> > Pazu <pazu@pazu.com.br> writes:
> > 
> >> # Please enter the commit message for your changes.
> >> # (Comment lines starting with '#' will not be included)
> >> # On branch refs/heads/next
> >> # Updated but not checked in:
> >> #   (will commit)
> >> #
> >> #    modified:   perl/Makefile
> >> #    modified:   var.c
> >>
> >> Here's where the magic would happen. Removing the line "modified: var.c" would
> >> remove var.c from this commit. Of course, the template message should be
> >> modified to tell the user he can do that.
> >>
> >> So, what do you think about this?
> > 
> > Personally, I would refuse to use such a modified git, because
> > often the first thing I would do in the commit log buffer is
> > check the listed files and remove the '# ...' lines while
> > typing.  I do not want that to affect the set of changes I
> > staged in any way.
> > 
> > But maybe that is just me.
> 
> I was to raise the same objection. 
> 
> But this can be solved by using magic _only_ if the template with exception
> of "modified:" lines matches, and if there is at least one file
> in "modified:" section.
I raise the same objection as Junio.

This is how perforce does it*, and while it is useful, git is NOT perforce, and I agree with Junio and Jakub.

If you want to commit only few files, update the index for only the ones you want to commit. If you did update the index for all of them, "git-read-tree -m -i HEAD" is your friend.

    Luben
* The reason being is that there is no "index-cache" and the commit
message needs to be scanned to determine which of the edited files
you actually intend to commit to the server at this time.
Previous: Jakub NarebskiNext: Josef Weidendorfer
Message 2 of 20 in “Re: git-commit: select which files to commit while editing the commit message”
  1. Jakub NarebskiDec 8, 2006
  2. Luben TuikovDec 8, 2006
  3. Josef WeidendorferDec 8, 2006
  4. Seth FalconDec 8, 2006
  5. Jakub NarebskiDec 9, 2006
  6. Seth FalconDec 9, 2006
  7. Junio C HamanoDec 9, 2006
  8. Josef WeidendorferDec 10, 2006
  9. Junio C HamanoDec 10, 2006
  10. git-add --interactive (wip)Junio C Hamano, Dec 11, 2006
  11. Josef WeidendorferDec 11, 2006
  12. Junio C HamanoDec 12, 2006
  13. Johannes SchindelinDec 12, 2006
  14. Andreas EricssonDec 13, 2006
  15. Josef WeidendorferDec 13, 2006
  16. Junio C HamanoDec 13, 2006
  17. Johannes SchindelinDec 13, 2006
  18. Shawn PearceDec 13, 2006
  19. Johannes SchindelinDec 13, 2006
  20. Josef WeidendorferDec 13, 2006

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.