开发者

different versions of ignored files in different branches

we want to merge our projects from subversion to git, but there is still one problem we need to solve :)

Our situation: We store our configuration data in one config file. This file needs to bee different in for each branch and each environment. So this file i开发者_如何学Pythons ignored in subversion. When we checkout a branch, we copy a sample file and change some values in the file. So everything works fine :)

But how can we handle this in git? So, when I switch from one branch to another branch on my development box I need a different config file. But the ignored files i my local git repository are all the same for each branch :(

Can anybody give me a hint on this?

Thanks, Stefan


Use the same .gitignore file in each branch with its contents being the path to the ignored file.


Go to the branch(es) where you want the ignored files to be different, edit /add the .gitignore file with appropriate paths / filenames and commit.

For example, in branch1's .gitignore, have:

branch1.config

For example, in branch2's .gitignore, have:

branch2.config

Or if the names are similar enough and won't interfere with other files, use wildcards and ignore them, something like:

branch*.config
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜