Reputation: 163
I am using the work flow introduced by Successful Git branch. I am confused about how to manage changes,like configuration in develop branch.
When I merge from master, to keep working tree clean I stash the changes. If I commit the changes, I should be very careful when I merge back master.
So is there a better way to manage private changes in git?
Upvotes: 5
Views: 687
Reputation: 28981
There are several options:
Do not put private files under source control. For instance, if you need a config.ini
with private changes for each developer, then create a file config.ini.template
with example settings in the repository, then each developer should make a copy of it and amend the copy with private settings. The config.ini
should be added in the .gitignore
.
Add the config.ini
in the repo and use git update-index --assume-unchanged config.ini
so that git will ignore any local changes in the file not try to commit the file.
Add several config files in the repo for each environment, e.g. config-robotment.ini
, config-kan.ini
, config-produciton.ini
and so on. Then use a command line parameter, or an environment variable, or something similar to allow your application choose which file to use.
And the point is - don't use branches for the configuration, otherwise it will be always painful to branch/merge during development.
Upvotes: 6
Reputation: 1328022
For configuration file, the choices are resumed in "Git: keep specific files unmerged".
I prefer versioning different value files for each environment (here for each branch), that way I don't have to deal with merge (the value file "dev.config
" would never be modified in master branch, where the value file "master.config
" is used)
I also version a template file, in order for a content filter driver to generate the actual config file (which remains private and isn't version) on checkout of the branch:
Upvotes: 1
Reputation: 20406
Create and switch to a local branch with a different name, merge upstream master branch when needed.
Upvotes: 0