Skip to content

Instantly share code, notes, and snippets.

@biran0079
Forked from canton7/0main.md
Created September 25, 2013 06:36
Show Gist options
  • Select an option

  • Save biran0079/6695875 to your computer and use it in GitHub Desktop.

Select an option

Save biran0079/6695875 to your computer and use it in GitHub Desktop.

Revisions

  1. @canton7 canton7 revised this gist Aug 18, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0main.md
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,8 @@ If you can modify your application
    ----------------------------------

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://git-scm.com/docs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set those variables as approapriate (e.g. in your `.bashrc` for shell scripts, or somewhere in your webserver's config for web apps). Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, using keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set those variables as appropriate (e.g. in your `.bashrc` for shell scripts, or somewhere in your webserver's config for web apps). Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.

    If you can't modify your application
    ------------------------------------
  2. @canton7 canton7 revised this gist Aug 24, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -44,4 +44,6 @@ git push heroku HEAD:master
    # Checkout <branch_to_deploy_from>, and remove the deploy commit
    git checkout <branch_to_deploy_from>
    git reset --mixed HEAD^
    ```
    ```

    This creates a nice visual history, with a set of merges from `<branch_to_deploy_from>` to `heroku/master` (if you need to roll back), but master branch doesn't have a record of the deployments.
  3. @canton7 canton7 revised this gist Aug 24, 2012. 1 changed file with 27 additions and 1 deletion.
    28 changes: 27 additions & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,30 @@ If you can't modify your application
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Tell git to ignore `config.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This is a more complex setup, but allows the config files to be stored within, and tracked by, git.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://git-scm.com/docs/git-update-index). Anyone who's tried this normally ends up hating it.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://git-scm.com/docs/git-update-index). Anyone who's tried this normally ends up hating it.

    If your local config must be committed, e.g. for deployment to Heroku
    =====================================================================

    If you follow one of the above suggestions -- where tracked and untracked config are stored in different files, with the latter ignored -- but need to commit the untracked config for deploying to somewhere, consider an extra deployment step that does something like the following:

    ```
    # Assume the remote we're deploying to is called 'heroku', although this isn't heroku-specific
    # We'll create a commit on master containing the normally-untracked config, merge that into heroku/master, push, then remove the commit from master
    # Require a clean working directory, possibly using `git diff-index --quiet HEAD --` to check for uncommitted stuff
    git fetch heroku
    git checkout <branch_to_deploy_from> # e.g. master in git-flow
    # Add our normally-untracked confing
    git add -f <normally_untracked_config_file>
    # Create a deploy commit on master
    git commit -m "Deploy: Some useful commit message"
    # Checkout the branch we're going to push to, and merge that deploy commit in
    # We avoid having to have a local version of the heroku/master branch by detaching the HEAD
    git checkout -q heroku/master
    git merge --no-ff -m "Merge deploy commit" master
    # Push our deploy commit+merge to heroku
    git push heroku HEAD:master
    # Checkout <branch_to_deploy_from>, and remove the deploy commit
    git checkout <branch_to_deploy_from>
    git reset --mixed HEAD^
    ```
  4. @canton7 canton7 revised this gist Aug 11, 2012. 2 changed files with 3 additions and 3 deletions.
    4 changes: 2 additions & 2 deletions 0main.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ These are the most common techniques:
    If you can modify your application
    ----------------------------------

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore.html).
    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://git-scm.com/docs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set those variables as approapriate (e.g. in your `.bashrc` for shell scripts, or somewhere in your webserver's config for web apps). Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.

    @@ -18,4 +18,4 @@ If you can't modify your application
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Tell git to ignore `config.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This is a more complex setup, but allows the config files to be stored within, and tracked by, git.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index.html). Anyone who's tried this normally ends up hating it.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://git-scm.com/docs/git-update-index). Anyone who's tried this normally ends up hating it.
    2 changes: 1 addition & 1 deletion gitattributes_magic.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Having per-repo untracked config using gitattributes
    This approach was presented by SethRobertson on #git.
    I haven't had a chance to play with it, and it has some caveats (see below), but it's a nice idea.

    First, read up on gitattributes. [One](http://jk.gs/gitattributes.html) [Two](http://progit.org/book/ch7-2.html).
    First, read up on gitattributes. [One](http://git-scm.com/docs/gitattributes) [Two](http://progit.org/book/ch7-2.html).
    Pay attention to the smudge/clean filters.

    Create a local branch called "private", which contains your personal config.
  5. @canton7 canton7 revised this gist Apr 30, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ If you can modify your application
    If you can't modify your application
    ------------------------------------

    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Tell git to ignore `config.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This is a more complex setup, but allows the config files to be stored within, and tracked by, git.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index.html). Anyone who's tried this normally ends up hating it.
  6. @canton7 canton7 revised this gist Feb 13, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ If you can modify your application

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore.html).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set those variables as approapriate (e.g. in your `.bashrc` for shell scripts, or somewhere in your webserver's config for web apps). Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.

    If you can't modify your application
    ------------------------------------
  7. @canton7 canton7 revised this gist Jan 24, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -17,5 +17,5 @@ If you can't modify your application

    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This is a more complex setup, but allows the config files to be stored within git.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This is a more complex setup, but allows the config files to be stored within, and tracked by, git.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index.html). Anyone who's tried this normally ends up hating it.
  8. @canton7 canton7 revised this gist Jan 24, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -17,5 +17,5 @@ If you can't modify your application

    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html).
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This is a more complex setup, but allows the config files to be stored within git.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index.html). Anyone who's tried this normally ends up hating it.
  9. @canton7 canton7 revised this gist Jan 24, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -17,5 +17,5 @@ If you can't modify your application

    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html).
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index.html). Anyone who's tried this normally ends up hating it.
  10. @canton7 canton7 revised this gist Jan 3, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ If you can't modify your application
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index.html). Anyone who's tried this normally ends up hating it.
  11. @canton7 canton7 revised this gist Jan 3, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ These are the most common techniques:
    If you can modify your application
    ----------------------------------

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore).
    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore.html).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.

  12. @canton7 canton7 revised this gist Jan 2, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0main.md
    Original file line number Diff line number Diff line change
    @@ -11,11 +11,11 @@ If you can modify your application
    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.

    If you can't modify your application
    ------------------------------------

    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it.
  13. @canton7 canton7 revised this gist Dec 19, 2011. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -5,10 +5,17 @@ This is a fairly common question, and there isn't a One True Answer.

    These are the most common techniques:

    If you can modify your application
    ----------------------------------

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want. You don't need to modify your app for this approach.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.

    If you can't modify your application
    ------------------------------------

    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it.
  14. @canton7 canton7 revised this gist Dec 19, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gitattributes_magic.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Having per-repo untracked config using gitattributes
    This approach was presented by SethRobertson on #git.
    I haven't had a chance to play with it, and it has some caveats (see below), but it's a nice idea.

    First, read up on gitattributes. [One](http://jk.gs/gitattributes) [Two](http://progit.org/book/ch7-2.html).
    First, read up on gitattributes. [One](http://jk.gs/gitattributes.html) [Two](http://progit.org/book/ch7-2.html).
    Pay attention to the smudge/clean filters.

    Create a local branch called "private", which contains your personal config.
  15. @canton7 canton7 revised this gist Dec 16, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -11,4 +11,4 @@ These are the most common techniques:
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it, though.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it.
  16. @canton7 canton7 revised this gist Dec 16, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ This is a fairly common question, and there isn't a One True Answer.
    These are the most common techniques:

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` needs to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want. You don't need to modify your app for this approach.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
  17. @canton7 canton7 revised this gist Dec 8, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ This is a fairly common question, and there isn't a One True Answer.

    These are the most common techniques:

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`, and loads it instead if it exists. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.ini`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want. You don't need to modify your app for this approach.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
  18. @canton7 canton7 revised this gist Dec 8, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 0main.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,5 @@ These are the most common techniques:
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want. You don't need to modify your app for this approach.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use a [local configuration branch](http://thomasrast.ch/git/local-config.html). This seems pretty painful, though.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it, though.
  19. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ This is a fairly common question, and there isn't a One True Answer.
    These are the most common techniques:

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override.
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override. Thanks to shrugger for this one.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want. You don't need to modify your app for this approach.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
  20. @canton7 canton7 revised this gist Dec 2, 2011. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ How to have local versions of tracked config files in git

    This is a fairly common question, and there isn't a One True Answer.

    These are the most common techniques.
    These are the most common techniques:

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override.
    2 changes: 1 addition & 1 deletion gitattributes_magic.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ This approach was presented by SethRobertson on #git.
    I haven't had a chance to play with it, and it has some caveats (see below), but it's a nice idea.

    First, read up on gitattributes. [One](http://jk.gs/gitattributes) [Two](http://progit.org/book/ch7-2.html).
    Pay attention to the smudge/clean filterss.
    Pay attention to the smudge/clean filters.

    Create a local branch called "private", which contains your personal config.

  21. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ These are the most common techniques.

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want. You don't need to modify your app for this approach.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it, though.
  22. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,4 @@ These are the most common techniques.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. **Not recommended**. If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it, though.
    1. **Not recommended**: If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it, though.
  23. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions 0main.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,8 @@ This is a fairly common question, and there isn't a One True Answer.
    These are the most common techniques.

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify options that you don't want to override.
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify only options that you don't want to override.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
    1. **Not recommended**. If all of the previous suggestions won't work for some reason, look at the "assume unchanged" section in [man git-update-index](http://jk.gs/git-update-index). Anyone who's tried this normally ends up hating it, though.
  24. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 0main.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@ This is a fairly common question, and there isn't a One True Answer.
    These are the most common techniques.

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that it first loads e.g. `config.ini`, but then attempts to load e.g. `config.mine.ini`, and if it exists, uses keys from `config.mine.ini` to override those obtained from `config.ini`. This is similar to the first approach, but means that `config.mine.ini` need to specify options that you don't want to override.
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
  25. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -7,5 +7,5 @@ These are the most common techniques.

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config, but can be a useful behaviour for simple apps.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
  26. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0main.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ This is a fairly common question, and there isn't a One True Answer.

    These are the most common techniques.

    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the defaults, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Modify your app such that, before loading its config from e.g. `config.ini`, it first looks for e.g. `config.mine.ini`. Track a standard `config.ini` in your repo, but if you need to override the values in it, copy it to `config.mine.ini` and modify. Then [configure git to ignore `config.mine.php`](http://jk.gs/gitignore).
    1. Have your app just look for e.g. `config.ini`, but *don't* track this file. Instead create and track e.g. `config.sample.ini`. Everyone who clones the repo has to copy `config.sample.ini` to `config.ini`, but they can modify `config.ini` as much as they want.
    1. Have your app look at environmental variables for its config, before using the values from its config file. Then set your your shell to load those environmental variables on login. Only works if your app doesn't need much config.
    1. Use some gitattributes clean/smudge magic as suggested by SethRobertson, see the other file in this gist.
  27. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gitattributes_magic.md
    Original file line number Diff line number Diff line change
    @@ -53,7 +53,7 @@ Notes
    -----

    Note that there's no way to tell *which* branch is being checked out.
    Therefore, before checkout out the "private" branch, you have to disable the filters.
    Therefore, before checking out out the "private" branch, you have to disable the filters.
    Renaming .gitattributes is one way of doing this.

    Also, SethRobertson alluded to the presence of an undocumented "%f", which would remove the need to create a separate smudge/clean filter pair for every file.
  28. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gitattributes_magic.md
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@ git show "private:$1"
    /tmp/clean
    ----------

    The clean filter is executed on `git add`, and replaces the contents of the (locally modified) files identified by the setup script with their tracked versions.
    The clean filter is executed on `git add`, and replaces the contents of the (locally modified) files identified by the setup script with their tracked versions from the current branch.

    ```bash
    #!/bin/sh
  29. @canton7 canton7 revised this gist Dec 2, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gitattributes_magic.md
    Original file line number Diff line number Diff line change
    @@ -46,7 +46,7 @@ The clean filter is executed on `git add`, and replaces the contents of the (loc

    ```bash
    #!/bin/sh
    git show "private:$1"
    git show "HEAD:$1"
    ```

    Notes
  30. @canton7 canton7 renamed this gist Dec 2, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.