Skip to content

Instantly share code, notes, and snippets.

@francoisgeorgy
Last active July 31, 2020 12:20
Show Gist options
  • Select an option

  • Save francoisgeorgy/ac861ac1eb768de097f30e5417c6f672 to your computer and use it in GitHub Desktop.

Select an option

Save francoisgeorgy/ac861ac1eb768de097f30e5417c6f672 to your computer and use it in GitHub Desktop.
#git remove a folder from git
# 1. Add the folder path to the repo's root .gitignore file:
dist/
# 2. Remove the folder from the local git tracking, but keep it on your disk:
git rm -r --cached dist/
# 3. Push the changes to the git repo
# The folder will be considered "deleted" from Git's point of view (i.e. they are in past history, but not in the latest commit, and people pulling from this repo will get the files removed from their trees), but stay on your working directory because you've used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment