git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-rm'ing all dead files
@ 2007-01-24 16:17 Pazu
  2007-01-24 16:25 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Pazu @ 2007-01-24 16:17 UTC (permalink / raw)
  To: git

I couldn't find an easy way to remove all "dead" files from the index, i.e.,
call git-rm on all files that are missing from the working copy.

Here's the scenario: I moved/added/removed a lot of files using a GUI tool; now
I need to reflect those changes in git. Using git-commit -a isn't the best
choice because there are local modifications I don't want to commit. I can use
"git add ." to automatically stage all new files, but how to the same for
removed files?

-- Pazu

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

* Re: git-rm'ing all dead files
  2007-01-24 16:17 git-rm'ing all dead files Pazu
@ 2007-01-24 16:25 ` Johannes Schindelin
  2007-01-24 16:51   ` Pazu
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2007-01-24 16:25 UTC (permalink / raw)
  To: Pazu; +Cc: git

Hi,

On Wed, 24 Jan 2007, Pazu wrote:

> I couldn't find an easy way to remove all "dead" files from the index, 
> i.e., call git-rm on all files that are missing from the working copy.

How about

	git ls-files -z --deleted | git update-index -z --remove --stdin

?

Ciao,
Dscho

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

* Re: git-rm'ing all dead files
  2007-01-24 16:25 ` Johannes Schindelin
@ 2007-01-24 16:51   ` Pazu
  2007-01-24 16:57     ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Pazu @ 2007-01-24 16:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

2007/1/24, Johannes Schindelin <Johannes.Schindelin@gmx.de>:

> How about
>
>         git ls-files -z --deleted | git update-index -z --remove --stdin

Aha. I was trying

    git-ls-files -d | xargs git rm --cached

but most removed files contains spaces in their names, and that
screwed git-rm up. I've even noticed the -z option on git-ls-files,
but couldn't find one on git-rm, and I completely forgot about
git-update-index.

Thanks, Johannes. This should do the trick.

-- Pazu

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

* Re: git-rm'ing all dead files
  2007-01-24 16:51   ` Pazu
@ 2007-01-24 16:57     ` Johannes Schindelin
  2007-01-24 17:02       ` Pazu
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2007-01-24 16:57 UTC (permalink / raw)
  To: Pazu; +Cc: git

Hi,

On Wed, 24 Jan 2007, Pazu wrote:

> 2007/1/24, Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> 
> > How about
> > 
> >         git ls-files -z --deleted | git update-index -z --remove --stdin
> 
> Aha. I was trying
> 
>    git-ls-files -d | xargs git rm --cached
> 
> but most removed files contains spaces in their names, and that
> screwed git-rm up. I've even noticed the -z option on git-ls-files,
> but couldn't find one on git-rm, and I completely forgot about
> git-update-index.

You _can_ use

	git ls-files -z -d | xargs -0 git rm --cached

So, you did not find that option with git-rm, because it is an option to 
xargs...

Ciao,
Dscho

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

* Re: git-rm'ing all dead files
  2007-01-24 16:57     ` Johannes Schindelin
@ 2007-01-24 17:02       ` Pazu
  0 siblings, 0 replies; 5+ messages in thread
From: Pazu @ 2007-01-24 17:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

2007/1/24, Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> You _can_ use
>
>         git ls-files -z -d | xargs -0 git rm --cached
>
> So, you did not find that option with git-rm, because it is an option to
> xargs...

I remember trying that, but git-rm was still confused about spaces in
filenames. I'll try it again the next time I'm in a situation like
that.

-- Pazu

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

end of thread, other threads:[~2007-01-24 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-24 16:17 git-rm'ing all dead files Pazu
2007-01-24 16:25 ` Johannes Schindelin
2007-01-24 16:51   ` Pazu
2007-01-24 16:57     ` Johannes Schindelin
2007-01-24 17:02       ` Pazu

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).