Skip to content

Instantly share code, notes, and snippets.

@benzittlau
Created May 4, 2011 21:59
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save benzittlau/956122 to your computer and use it in GitHub Desktop.
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
@meker12
Copy link

meker12 commented Jun 6, 2014

Thank you!

@phonyphonecall
Copy link

Cool!

@andrewhau1
Copy link

Thanks!

@vpankajakshan
Copy link

Thanks a lot!!

@rd13
Copy link

rd13 commented May 14, 2015

Beautiful.

@ctrlaltdylan
Copy link

If you get a little prompt about forcing a deletion:

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

Thank you!

@kurtisdunn
Copy link

Mad!

@DanielBonnery
Copy link

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

Thank You !!

@stephswo
Copy link

This worked perfectly, thanks!

@marobo
Copy link

marobo commented Nov 8, 2017

Thank You.!

@yvele
Copy link

yvele commented Oct 30, 2018

Thanks

@GammachisT
Copy link

Wow amazing code
Thanks

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