Keep settings in branch

I begin to use git for software development.

I have a project on github. This project also involves some user-settings stored in dedicated settings-files.

  • Git: How to merge local branch with remote tracking automatically without fetching
  • git branch in hg subrepo
  • Track someone's GitHub repo in a branch
  • How to show connections between local and remote branches in git?
  • Removing a specific commit in the git history with several branches?
  • Push and pull branches in Git
  • On github the settings should be empty (like this)

    ### Settings:
    
    ## Your name
    $name = "";
    ## Your email adress
    $email = "";
    ## and so on
    

    However, I also have the project running on my computer (or server). My personal version of the project should have all settings filled out.

    I would like to have two branches for that. The personal branch should contain all my settings. The master branch should be the one where I develop the software and which I upload to github.

    I would like to merge the master branch into the personal branch from time to time to keep my system up-to-date. However, whenever I try to merge the branches, my personal settings get lost.

    Is there a way to do this or am I just doing something wrong (what)?

  • How to determine if Git handles a file as binary or as text?
  • Cycle through several branches with submodules for read only purpose
  • Any good options for hosted Git/Trac?
  • Publishing to Azure Web Apps from GitLab repository on trigger
  • How do I store output of a git command in a Perl array or scalar?
  • Making a web application open source
  • 3 Solutions collect form web for “Keep settings in branch”

    In your personal branch, you could keep:

    • the GitHub config file unchanged (with no value), but with a different name (config.template for example)
    • a “value file” with your personal value
    • a “smudge” script able to generate the actual config file using the template one and your personal values

    That script is triggered on any git checkout as a content filter driver.

    enter image description here

    That way, you can merge master onto your personal branch as many time as you want, your config values will not be modified.

    You can create a setting file like setting-sample, and modify .gitignore to ignore the real setting file (i.e. setting). So the empty setting file will be kept in remote repo, and your personal setting file will be kept in your local repo.

    You may commit the empty settings file and then commit a .gitignore file pointing to the original file, so in that case, the users would download the file but git will ignore the changes that users make.

    Git Baby is a git and github fan, let's start git clone.