Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to version files ONLY locally with git

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.

like image 857
user1167753 Avatar asked Mar 08 '16 08:03

user1167753


1 Answers

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).

like image 106
Royal Pinto Avatar answered Sep 17 '22 13:09

Royal Pinto