How to save personal changes in git?

I am using the workflow introduced by the Successful Git branch. I am confused about how to manage changes, such as configuration in the development area.

When I merge with the master to maintain a clean tree tree, I commit changes. If I make changes, I have to be very careful when I merge back the wizards.

So, is there a better way to manage private changes in git?

+4
source share
3 answers

There are several options:

  • Do not put personal files under source control. For example, if you need config.ini with private changes for each developer, then create a config.ini.template file with examples of settings in the repository, then each developer should make a copy of it and adjust the copy with private settings. config.ini should be added to .gitignore .

  • Add config.ini to the repo and use git update-index --assume-unchanged config.ini so that git ignores any local changes to the file without trying to commit the file.

  • Add several configuration files to the repo for each environment, for example. 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 so that your application can choose which file to use.

And the fact is that - do not use branches for configuration, otherwise it will always be painful to deal with branching / merging during development.

+4
source

For the configuration file, the selection is resumed in Git: keep certain files inactive .

I prefer to manage versions of different value files for each environment (here for each branch), so I do not need to deal with merging (the value file " dev.config " will never be changed in the main branch, where the value of the file " master.config " is used )

I also create a template file to create a filter file to create the actual configuration file (which remains closed and is not a version) when checking the branch:

smudge clean filter driver

+1
source

Create and switch to the local branch with a different name, merge the leading branch up if necessary.

0
source

Source: https://habr.com/ru/post/1432613/


All Articles