Skip to content

Instantly share code, notes, and snippets.

@benzittlau
Created May 4, 2011 21:59
Show Gist options
  • Select an option

  • Save benzittlau/956122 to your computer and use it in GitHub Desktop.

Select an option

Save benzittlau/956122 to your computer and use it in GitHub Desktop.
Remove all *.swp files from a git repository
git ls-files | grep '\.swp$' | xargs git rm
@andrewhau1

Copy link
Copy Markdown

Thanks!

@vpankajakshan

Copy link
Copy Markdown

Thanks a lot!!

@rd13

rd13 commented May 14, 2015

Copy link
Copy Markdown

Beautiful.

@ctrlaltdylan

Copy link
Copy Markdown

If you get a little prompt about forcing a deletion:

git ls-files | grep '\.swp$' | xargs git rm -f

Thank you!

@kurtisdunn

Copy link
Copy Markdown

Mad!

@DanielBonnery

Copy link
Copy Markdown

I tried to add the argument --cached like that:
git ls-files | grep '\.Rproj$' | xargs git rm --cached

It did not work

@kanekalla

Copy link
Copy Markdown

Thank You !!

@stephswo

Copy link
Copy Markdown

This worked perfectly, thanks!

@marobo

marobo commented Nov 8, 2017

Copy link
Copy Markdown

Thank You.!

@yvele

yvele commented Oct 30, 2018

Copy link
Copy Markdown

Thanks

@GammachisT

Copy link
Copy Markdown

Wow amazing code
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment