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

3 messages from 2006-12-08 to 2006-12-09. Participants: Junio C Hamano, Pazu, Sean.
Thread: https://gitlist.dev/t/43650

## Pazu, 2006-12-08 12:36

Subject: git-commit: select which files to commit while editing the commit message
Message-ID: <loom.20061208T131919-178@post.gmane.org>
URL: https://gitlist.dev/e/loom.20061208T131919-178%40post.gmane.org

```
Junio's reworking of the git-commit documentation, and the ensuing discussion
about what is commited, and how do you select that, made me remember how much I
liked SVK -- particularly, how much I liked to remove files from the commit
message template, and have them removed from the commit.

At first, I thought "great opportunity to contribute my first patch to git",
until I realized that git-commit is written in bash, and my brain refuses to
understand that. Yep, I'm that bad. So I'm writing this, and maybe someone
well-versed in bash will find this a good idea and code it :-)

For those not familiar with SVK, if you remove the files mentioned in the commit
template (that "here are the files that you're about to commit" part), SVK won't
commit them. For example, if I modify a couple of files in git, and execute 'git
commit -a', an editor will popup showing something like this:

# 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?

-- Pazu

```

## Junio C Hamano, 2006-12-08 19:18

Subject: Re: git-commit: select which files to commit while editing the commit message
Message-ID: <7vpsaui4cn.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vpsaui4cn.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <loom.20061208T131919-178@post.gmane.org>

```
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.

```

## Sean, 2006-12-09 07:02

Subject: Re: git-commit: select which files to commit while editing the commit message
Message-ID: <BAYC1-PASMTP1040BEA204693E211075F0AED20@CEZ.ICE>
URL: https://gitlist.dev/e/BAYC1-PASMTP1040BEA204693E211075F0AED20%40CEZ.ICE
In-Reply-To: <7vpsaui4cn.fsf@assigned-by-dhcp.cox.net>

```
On Fri, 08 Dec 2006 11:18:16 -0800
Junio C Hamano <junkio@cox.net> wrote:

> 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.

Your usage should not affected at all by the addition of this
feature.  One of the comment lines could be magic, in that if
it is missing the feature is disabled.  Something like:

#  *** Editable Commit List ***

Or some such at the top of the list, where if it is missing after
commit message editing, the post processing of the file list
will be completely disabled.  Another alternative would be to
just enable the feature with an  -A  or some other commit command
line option, so that those uninterested in such a feature don't
have to even see it.

It would be interesting to hear from Pasky on how this feature
has worked out in practice for Cogito users and whether he thinks
it would be a good addition to Git.


```
