Skip to content

Instantly share code, notes, and snippets.

@eliza-abraham
Created November 11, 2013 09:47
Show Gist options
  • Save eliza-abraham/7410669 to your computer and use it in GitHub Desktop.
Save eliza-abraham/7410669 to your computer and use it in GitHub Desktop.
Removing ignored file from the repository
$git rm -r --cached some-directory
$git commit -m 'Remove the now ignored directory "some-directory"'
$git push origin master
@gianpaj
Copy link

gianpaj commented Mar 14, 2016

The above works fine for a single directory or file. But when you have committed a lot of files this could become handier:

git rm --cached `git ls-files -i --exclude-from=.gitignore`

Run this command to see first which files will be removed from repository (untracked):

git ls-files -i --exclude-from=.gitignore

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