git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Re: git commit workflow question
       [not found] <20070914103348.GA22621@bulgaria>
@ 2007-09-14 18:14 ` Shawn O. Pearce
  2007-09-15 11:31   ` Wincent Colaiuta
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn O. Pearce @ 2007-09-14 18:14 UTC (permalink / raw)
  To: Brian Swetland; +Cc: git

Brian Swetland <swetland@google.com> wrote:
> With perforce I often have a bunch of files modified (having p4 add'd
> or p4 edit'd them) and then only commit a subset of them.  I can do
> this interactively by doing a p4 submit and just removing the files
> I don't want to check in from the list in the changelist description
> when I'm writing up the change description in $EDITOR, invoked by
> p4 submit.
> 
> It seems like my options with git are to invoke git commit with
> a specific list of things to commit, invoke git commit --interactive
> and use the interactive menu thing to shuffle stuff around, or
> manually unstage things until I have the index in a state where
> a git commit without other arguments will do what I want.

Or use git-citool/git-gui to make commits, in which case that
will help you to arrange the index with what you want to commit.
But yes, git-commit does not pay any attention to modifications
made to the template in the edit buffer.

I'm not sure how the Git community would react to being able to edit
the list of files being committed from within the commit message
buffer.  I think most Git users run at least `git diff --cached`
before they commit to make sure they are happy with the difference.
I know a lot of users who do that.  Most/all of those users also do
not stage something into the index until they are happy with the
change, which means there isn't any list of files to remove when
it comes time to make the commit as the contents of the index is
exactly what should be committed.

I used p4 for a while before Git was invented.  I found the file
editing feature useful then because there was no concept of the
index.  Now with Git I've embraced the index so much that I'm not
sure I can work without it, and I don't need to remove files from
my index during the actual commit itself.
 
-- 
Shawn.

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

* Re: git commit workflow question
  2007-09-14 18:14 ` git commit workflow question Shawn O. Pearce
@ 2007-09-15 11:31   ` Wincent Colaiuta
  2007-09-15 12:07     ` David Watson
  0 siblings, 1 reply; 3+ messages in thread
From: Wincent Colaiuta @ 2007-09-15 11:31 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Brian Swetland, git

El 14/9/2007, a las 20:14, Shawn O. Pearce escribió:

> I'm not sure how the Git community would react to being able to edit
> the list of files being committed from within the commit message
> buffer.  I think most Git users run at least `git diff --cached`
> before they commit to make sure they are happy with the difference.
> I know a lot of users who do that.

Yes, I generally check what's in the index before going ahead with a  
commit; in fact I have the following alias in my .bash_profile so  
that I can just type "staged" to see what'll be in the commit, along  
with an "unstaged" alias for the opposite:

alias staged='git diff --cached'

Having said that, it would be very useful to be able to edit the list  
within the commit message buffer for those occasions where you  
realise that stuff you have staged in the index really should be two  
separate commits. It would enable this very simple workflow:

   1. review changes, realize that some of the changes belong in a  
separate commit
   2. commit, omitting the unwanted changes
   3. commit again, this time with the remainder of the changes

Without the ability to edit the list within the commit message buffer  
your workflow becomes a bit more cumbersome:

   1. review changes, realize that some of the changes belong in a  
separate commit
   2a. explicitly pass files to commit on the commandline (cumbersome  
if number of files is large); or:
   2b. use git-commit --interactive (again can be relatively  
cumbersome); or:
   2c. explicitly unstage unwanted files, commit, then restage them  
and commit

So, yes, the proposed functionality isn't necessary by any means, but  
it would make some nice usability sugar. I know that in the past my  
experience with other SCMs that can do this has made me mistakenly  
believe that Git does too.

Cheers,
Wincent

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

* Re: git commit workflow question
  2007-09-15 11:31   ` Wincent Colaiuta
@ 2007-09-15 12:07     ` David Watson
  0 siblings, 0 replies; 3+ messages in thread
From: David Watson @ 2007-09-15 12:07 UTC (permalink / raw)
  To: Wincent Colaiuta; +Cc: Shawn O. Pearce, Brian Swetland, git

<shameless plug>The Eclipse plugin (egit) actually already supports this
feature, and I use it all the time. It's incredibly handy, since I can
stag things as much as I want, and then commit then piecemeal.</shameless
plug>

However, I'm not convinced this should necessarily be included in git, at
least not by editing the commit message. Perhaps it should be a task for a
porcelain? I know you can do something similar using git-gui as
well, just by clicking on files in its top view to stage/unstage. Or like
rebase -i, where you first get a buffer with a list of stuff to be done,
and then in a separate buffer you get the commit message.

On Sat, Sep 15, 2007 at 01:31:37PM +0200, Wincent Colaiuta wrote:
>  El 14/9/2007, a las 20:14, Shawn O. Pearce escribi?:
> 
> > I'm not sure how the Git community would react to being able to edit
> > the list of files being committed from within the commit message
> > buffer.  I think most Git users run at least `git diff --cached`
> > before they commit to make sure they are happy with the difference.
> > I know a lot of users who do that.
> 
>  Yes, I generally check what's in the index before going ahead with a commit; in 
>  fact I have the following alias in my .bash_profile so that I can just type 
>  "staged" to see what'll be in the commit, along with an "unstaged" alias for 
>  the opposite:
> 
>  alias staged='git diff --cached'
> 
>  Having said that, it would be very useful to be able to edit the list within 
>  the commit message buffer for those occasions where you realise that stuff you 
>  have staged in the index really should be two separate commits. It would enable 
>  this very simple workflow:
> 
>    1. review changes, realize that some of the changes belong in a separate 
>  commit
>    2. commit, omitting the unwanted changes
>    3. commit again, this time with the remainder of the changes
> 
>  Without the ability to edit the list within the commit message buffer your 
>  workflow becomes a bit more cumbersome:
> 
>    1. review changes, realize that some of the changes belong in a separate 
>  commit
>    2a. explicitly pass files to commit on the commandline (cumbersome if number 
>  of files is large); or:
>    2b. use git-commit --interactive (again can be relatively cumbersome); or:
>    2c. explicitly unstage unwanted files, commit, then restage them and commit
> 
>  So, yes, the proposed functionality isn't necessary by any means, but it would 
>  make some nice usability sugar. I know that in the past my experience with 
>  other SCMs that can do this has made me mistakenly believe that Git does too.
> 
>  Cheers,
>  Wincent
> 
>  -
>  To unsubscribe from this list: send the line "unsubscribe git" in
>  the body of a message to majordomo@vger.kernel.org
>  More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Dave Watson
Software Engineer
MIMvista Corp

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

end of thread, other threads:[~2007-09-15 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20070914103348.GA22621@bulgaria>
2007-09-14 18:14 ` git commit workflow question Shawn O. Pearce
2007-09-15 11:31   ` Wincent Colaiuta
2007-09-15 12:07     ` David Watson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).