Skip to content

Instantly share code, notes, and snippets.

@Nyahua
Created March 27, 2017 07:40
Show Gist options
  • Save Nyahua/ebf851b1be7cf4b7098137ce54a2e473 to your computer and use it in GitHub Desktop.
Save Nyahua/ebf851b1be7cf4b7098137ce54a2e473 to your computer and use it in GitHub Desktop.
How to remove a directory from git repository ?

[How to remove a directory from git repository] (http://stackoverflow.com/questions/6313126/how-to-remove-a-directory-from-git-repository)

Remove directory from git and local

git rm -r one-of-the-directories
git commit -m "Remove duplicated directory"
git push origin <your-git-branch> (typically 'master', but not always)

Remove directory from git but NOT local

what you usually want to do is remove this directory from git but not delete it entirely from the filesystem (local)

In that case use:

git rm -r --cached myFolder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment