Re: Git commit won't add an untracked file given on the command line

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Git commit won't add an untracked file given on the command line

From: Miles Bader <hidden>
Date: 2016-06-15 22:45:40

Johannes Schindelin [off-list ref] writes:
quoted
I agree, but it would kinda handy to have an exception for files 
explicitly named on the command line.
Only if you do not have a clear picture of what the staging area is about, 
IMHO.
That's such a vague statement, I've not sure how to take it.

I use the staging area a lot, so I think I have a pretty clear idea of what
it's "about", but I also often use "commit FILE" or "commit -a" for simple
cases; even when splitting a change into multiple commits, it's often more
convenient to do "commit FILE..." instead of "add FILE; commit".

I agree that having "commit DIR" add new files would likely be more
annoying than helpful (it's not uncommon to have some temporary files
laying around), but given that "commit FILE" is _explicitly_ naming the new
file, it seems hard to imagine somebody would be surprised if it worked
even when FILE was a new file...

-Miles

-- 
=====
(^o^;
(()))
*This is the cute octopus virus, please copy it into your sig so it can spread.

Re: Git commit won't add an untracked file given on the command line

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:45:40

Hi,

On Wed, 19 Nov 2008, Miles Bader wrote:
Johannes Schindelin [off-list ref] writes:
quoted
quoted
I agree, but it would kinda handy to have an exception for files 
explicitly named on the command line.
Only if you do not have a clear picture of what the staging area is 
about, IMHO.
That's such a vague statement, I've not sure how to take it.

I use the staging area a lot, so I think I have a pretty clear idea of 
what it's "about", but I also often use "commit FILE" or "commit -a" for 
simple cases; even when splitting a change into multiple commits, it's 
often more convenient to do "commit FILE..." instead of "add FILE; 
commit".
What I meant was this: the "commit <file>" paradigm is not what you should 
do most of the time.  In order to work with the staging area efficiently, 
you should make staging and committing two separate steps.

I regularly encounter people who never call "git diff --cached" before 
committing, and guess who introduces all kinds of debug statements and 
other cruft into their commits?  Exactly.

So my point is this: stage first, verify, then commit.  That saves you a 
lot of embarrassment.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help