Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
685 views
in Technique[技术] by (71.8m points)

git svn - Proper git procedure for changed files that shouldn't be committed?

I just inherited an existing codebase that has multiple configuration files in it. These configuration files are all generic, meant to be edited and customized for each machine they are downloaded to. Git is (obviously) telling me that they have been edited and is always showing them under "changes not staged for commit" every time I do a git status. How can I ignore these files under git? Adding them to .gitignore doesn't work because they are already being tracked by git. I don't want to commit anything to the repo, but at the same time I want to tell git not to track these files anymore on my local machine. Is there a way of doing this that I'm not aware of? I know I can git stash them and they won't be shown anymore, but I feel that is not really what it was meant for... Am I wrong?

Not sure if this changes anything, but I am using git-svn on my local machine to interact with the SVN server.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Don't store configuration files on the repository. You can store example versions of those files or 'generic' versions of them in the repository, but do it under another name.

If there are several of them and they live in their own directory, create a separate directory to hold the generic versions in the repository. If there are only one or two of them and they don't have their own directory, use file names. You can add something like -default or -example to the versions stored in the repository.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...