git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding a commit message to the index
@ 2010-09-19  0:48 Cameron Hutchison
  2010-09-19  1:29 ` Joshua Juran
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Cameron Hutchison @ 2010-09-19  0:48 UTC (permalink / raw)
  To: git

Is it possible to add a commit message to the index, and have it used as
the final commit message, or as the template for the final commit
message?

Witnessing AKPM's ongoing efforts on linux-kernel to get better commit
messages out of people, it seems it would be beneficial to be able to
stage a commit message and refine it over the course of the development
of the commit. The first cut is rarely the best, so being able to refine
a commit message as one can refine a commit by incrementally using the
index seems like a good idea.

I know I can use git-commit -F and store my commit message outside of
git, but it would be nice to have it in the index with the code it
comments on. That would make the commit and the message stay together
with git-stash for example. Apply this to other index-modifying
operations too.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Adding a commit message to the index
  2010-09-19  0:48 Adding a commit message to the index Cameron Hutchison
@ 2010-09-19  1:29 ` Joshua Juran
  2010-09-19 12:19 ` Ævar Arnfjörð Bjarmason
  2010-09-19 13:38 ` Jakub Narebski
  2 siblings, 0 replies; 4+ messages in thread
From: Joshua Juran @ 2010-09-19  1:29 UTC (permalink / raw)
  To: Cameron Hutchison; +Cc: git

On Sep 18, 2010, at 5:48 PM, Cameron Hutchison wrote:

> Is it possible to add a commit message to the index, and have it  
> used as
> the final commit message, or as the template for the final commit
> message?
>
> Witnessing AKPM's ongoing efforts on linux-kernel to get better commit
> messages out of people, it seems it would be beneficial to be able to
> stage a commit message and refine it over the course of the  
> development
> of the commit. The first cut is rarely the best, so being able to  
> refine
> a commit message as one can refine a commit by incrementally using the
> index seems like a good idea.

One of the reasons for having a local repo is so you can check in work  
in progress without committing it to public history.

If you're ready to write a commit message, then make a commit.  You  
can refine it incrementally with `git commit --amend`.

Also, consider making multiple fine-grained commits, and then use  
interactive rebase to squash them into fewer larger commits (and edit  
commit messages) as appropriate.  It's a lot easier to squash fine  
commits than to split course ones.

To summarize:  Commit first, answer questions later.

Josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Adding a commit message to the index
  2010-09-19  0:48 Adding a commit message to the index Cameron Hutchison
  2010-09-19  1:29 ` Joshua Juran
@ 2010-09-19 12:19 ` Ævar Arnfjörð Bjarmason
  2010-09-19 13:38 ` Jakub Narebski
  2 siblings, 0 replies; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-09-19 12:19 UTC (permalink / raw)
  To: Cameron Hutchison; +Cc: git

On Sun, Sep 19, 2010 at 00:48, Cameron Hutchison <lists@xdna.net> wrote:
> Is it possible to add a commit message to the index, and have it used as
> the final commit message, or as the template for the final commit
> message?

What Joshua suggests is better, but you can abuse git-commit by
writing a commit message to e.g. .git/MERGE_MSG, then the message will
be used at the next 'git commit'.

But just commiting /now/ and squashing/rebasing later is a much better
workflow.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Adding a commit message to the index
  2010-09-19  0:48 Adding a commit message to the index Cameron Hutchison
  2010-09-19  1:29 ` Joshua Juran
  2010-09-19 12:19 ` Ævar Arnfjörð Bjarmason
@ 2010-09-19 13:38 ` Jakub Narebski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Narebski @ 2010-09-19 13:38 UTC (permalink / raw)
  To: Cameron Hutchison; +Cc: git

Cameron Hutchison <lists@xdna.net> writes:

> Is it possible to add a commit message to the index, and have it used as
> the final commit message, or as the template for the final commit
> message?
[...]

Why not use commit message templates?

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-19 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-19  0:48 Adding a commit message to the index Cameron Hutchison
2010-09-19  1:29 ` Joshua Juran
2010-09-19 12:19 ` Ævar Arnfjörð Bjarmason
2010-09-19 13:38 ` Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).