Remove a folder from git tracking -
Remove a folder from git tracking -
i need exclude folder (name uploads) tracking. tried run
git rm -r --cached wordpress/wp-content/uploads
and after added path .gitignore
/wordpress/wp-content/uploads
but when ran "git status" show deleted. if seek commit changes, files deleted, not removed tracking.
what i'm doing wrong?
i have tried
git update-index --assume-unchanged <file>
but seems untrack files. need remove entire folder (including subfolders) tracking.
thank much
i came across question while googling "git remove folder tracking". op's question lead me answer. summarizing here future generations.
question
how remove folder git repository without deleting local machine (i.e., development environment)?
answer
step 1. add together folder path repo's root .gitignore
file.
path_to_your_folder/
step 2. remove folder local git tracking, maintain on disk.
git rm -r --cached path_to_your_folder/
step 3. force changes git repo.
the folder considered "deleted" git's point of view (i.e. in past history, not in latest commit, , people pulling repo files removed trees), remain on working directory because you've used --cached
.
git
Comments
Post a Comment