All of the developers have files which should have been in .gitignore from the start of the project, but which were not.
Is there a git command to remove files from git, while keeping them locally and keeping them locally on all the other developer machines, when they git pull
?
Ideally this should look at a diff of .gitignore to decide what needs to be removed but kept locally.
At the moment, I am considering the following manual procedure:
My Machine:
.gitignore
, but which don't match the old .gitignore
git rm
all those files commit
and push origin master
the changes Every other developer's machine:
git pull
which will update .gitignore
and remove their local copies of the files which should now be ignored. This procedure has huge scope for manual errors - is there a better way?
I've looked at:
Remove file from Git without deleting them locally and remotely
Removing a file from versioning but keeping it locally? and
http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html
Locally you can do this by:
git rm --cached FILE_NAME
Arlo Carreon explains how to do this for multiple developers: http://www.arlocarreon.com/blog/git/untrack-files-in-git-repos-without-deleting-them/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.