threads / discuss / 25986

how to make a commit only contain existing files

Subject: how to make a commit only contain existing files

## tl;dr

4 messages between Dec 7, 2010 and Dec 8, 2010.

replies: 3people: 2as markdown or json

david@lang.hm· Dec 7, 2010, 21:00 UTC · lore

I know that I can do a git rm to explictly remove files, but is there an easy way to just say that this commit should contain all the files that exist at this point in time, without carrying over any files that were in a prior commit but that don't exist now?

David Lang
Jeff King· Dec 7, 2010, 21:11 UTC · re: david@lang.hm · lore

Re: how to make a commit only contain existing files

On Tue, Dec 07, 2010 at 01:00:18PM -0800, david@lang.hm wrote:
> I know that I can do a git rm to explictly remove files, but is there
> an easy way to just say that this commit should contain all the files
> that exist at this point in time, without carrying over any files
> that were in a prior commit but that don't exist now?
Won't "git add -A; git commit" do what you want?
-Peff
david@lang.hm· Dec 8, 2010, 00:52 UTC · re: Jeff King · lore

Re: how to make a commit only contain existing files

On Tue, 7 Dec 2010, Jeff King wrote:
Show 8 quoted lines
> On Tue, Dec 07, 2010 at 01:00:18PM -0800, david@lang.hm wrote:
>
>> I know that I can do a git rm to explictly remove files, but is there
>> an easy way to just say that this commit should contain all the files
>> that exist at this point in time, without carrying over any files
>> that were in a prior commit but that don't exist now?
>
> Won't "git add -A; git commit" do what you want?

it very well may, I'll have to upgrade git on that box to a version that supports it.

Thanks.
David Lang
Jeff King· Dec 8, 2010, 03:39 UTC · re: david@lang.hm · lore

Re: how to make a commit only contain existing files

On Tue, Dec 07, 2010 at 04:52:48PM -0800, david@lang.hm wrote:
> >Won't "git add -A; git commit" do what you want?
> 
> it very well may, I'll have to upgrade git on that box to a version
> that supports it.

It was introduced in 1.6.0. If you have something older, "git add -u && git add ." will do the same thing.

-Peff

← back to recent threads