I have a project with two branches foo
and baar
. In this project I have a config files database1.properties
and database1.properties
where data base properties are stored for example schema name and schema password. When I am working on foo branch, schema name is foo and password is foo and when I am working on baar branch schema name is baar and password is baar. How to tell git that these properties files are only for my local system and shouldn't be pushed to the origin repo? I use egit and also tortoiseGit.
With a single branch you cannot prevent selected files from being pushed.
When branch is getting pushed, all commits will be pushed to the remote.
As a workaround you could have your changes(specific to local) in a different branch(foo-local
, bar-local
etc) and whenever you want these changes in local system, use git merge local-branch --no-commit --no-ff
or similar command to merge into actual branch (This will not merge your local specific changes to the remote tracking branch). Once you are done, you can discard these changes(however these changes will always be there in local branch and can apply to actual branch any time you want).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With