Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a tmp directory in my git repo I'd like to still exist, but be ignored. I added it to .gitignore, but git status still tells me about changes to files in that directory. I tried git rm -r --cached, but that removes it from the remote repo. How can I stop tracking changes to this directory, but still allow it to exist? I also need to do this for 1 file, but changes to that also show up in git status after .gitignoreing them. What should I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
922 views
Welcome To Ask or Share your Answers For Others

1 Answer

Instead of .gitignore, you can update local git repository by running following command:

git update-index --assume-unchanged <file>

In this case a file is being tracked in the origin repo. You can modify it in your local repo and git will never mark it as changed. Read more at:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...