* How to stage a tree with all changes?
@ 2007-06-13 16:22 David Kastrup
2007-06-13 16:47 ` Matthieu Moy
2007-06-13 18:40 ` Jeff King
0 siblings, 2 replies; 3+ messages in thread
From: David Kastrup @ 2007-06-13 16:22 UTC (permalink / raw)
To: git
Suppose I have a number of changes in a tree: additions, deletions,
renames and so on.
How do I stage and commit all of that?
git-commit -a
omits new files.
git-add .
git-commit -a
seemingly overlooks deletions.
What am I overlooking? This should be simple, shouldn't it?
--
David Kastrup
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to stage a tree with all changes?
2007-06-13 16:22 How to stage a tree with all changes? David Kastrup
@ 2007-06-13 16:47 ` Matthieu Moy
2007-06-13 18:40 ` Jeff King
1 sibling, 0 replies; 3+ messages in thread
From: Matthieu Moy @ 2007-06-13 16:47 UTC (permalink / raw)
To: David Kastrup; +Cc: git
David Kastrup <dak@gnu.org> writes:
> Suppose I have a number of changes in a tree: additions, deletions,
> renames and so on.
At commit time, a rename is just an add+delete for git. It'll
investigate renames with heuristics later, when needed.
> How do I stage and commit all of that?
Well, what I usually do is
$ git status
(nicer with
[status]
color = auto
in ~/.gitconfig)
and then "confirm" one by one the things I actually want to commit.
> git-commit -a
>
> omits new files.
>
> git-add .
> git-commit -a
The -a is not necessary if you just did "git add .".
> seemingly overlooks deletions.
In most cases, you'd have deleted the files with "rm", and you could
have told git at that time, using "git rm" instead. Otherwise,
$ git-ls-files -z | git-update-index --remove -z --stdin
will remove deleted files from the index after the fact. But I don't
know any porcelain command to do that. Perhaps a "git rm -u" could be
a nice dual for "git add -u"?
--
Matthieu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to stage a tree with all changes?
2007-06-13 16:22 How to stage a tree with all changes? David Kastrup
2007-06-13 16:47 ` Matthieu Moy
@ 2007-06-13 18:40 ` Jeff King
1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2007-06-13 18:40 UTC (permalink / raw)
To: David Kastrup; +Cc: git
On Wed, Jun 13, 2007 at 06:22:23PM +0200, David Kastrup wrote:
> git-add .
> git-commit -a
>
> seemingly overlooks deletions.
It shouldn't. Try this:
mkdir repo && cd repo
git init
echo foo >foo
git add .
git commit -m initial
rm foo
echo bar >bar
git add .
git commit -a
'bar' is scheduled for addition, and 'foo' is scheduled for deletion.
Have you perhaps removed a file, but it's still in the working
directory, and so picked up by your git-add? Can you give us a test
case?
> What am I overlooking? This should be simple, shouldn't it?
Yes, it should. :)
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-13 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-13 16:22 How to stage a tree with all changes? David Kastrup
2007-06-13 16:47 ` Matthieu Moy
2007-06-13 18:40 ` Jeff King
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).