git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Locally manage user/branch setting files without pushing them remotely

From
Yann Simon <yann.simon.fr@gmail.com>
Date
Nov 11, 2009, 12:14 UTC
Message-ID
<551f769b0911110414j759bd4ayfedfa779307e1a63@mail.gmail.com>
In-Reply-To
<9accb4400911110401g5c44d011u50cafcfe736a2ec6@mail.gmail.com>
2009/11/11 Daniele Segato <daniele.bilug@gmail.com>:
Show 48 quoted lines
> I had a situation I don't know how to manage with Git.
>
> The project has a lot of setting that are really binded to the user
> and should not go pushed in a remote repository (example: database
> connections parameters / filesystem paths)
> We have a .template file for those settings but the actual settings
> are really binded to the user environment.
> I added those files to the .gitignore but now I can't keep an history
> of them and I can't use different version of them in different
> branches.
>
> I tell you what's the real situation but I will simplify things a
> little, suppose I only have two branches: master and experiments.
>
> I've a java application and some ANT script to automatizations like
> compiling, packaging and deploying stuffs.
>
> On my system I had two application servers and two databases one for
> "master" and the other for "experiment".
> There is a property files with the path of the two application servers
> and the parameters to connect at the DB.
>
> The ant script automatically deploy on the right application server
> and automatically set the properties to connect at the right database.
>
> This allow me to clean my experimantal database everytimes I need to
> and start over by a clean situation and keep the "master" one
> populated with all the data so I can do stress test/update procedures
> test and so on...
>
> At the moment I manually modify that property files when I checkout
> one of the two branches and I need to deploy it to test or whatever.
>
>
>
> Is there a way with Git to automatically switch that file when i
> switch through branches?
> It would be really perfect if I could also keep version of that file
> so that when I checkout an old commit I had the options I was using
> when I was testing that commit.
>
> Ideally that means that should be some files that are kept within each
> commit but they are not pushed to a remote repository.
> (Even if i'm talking about pushing I'm using git-svn because my
> company still use SVN as versioning system so I don't push but i do
> git svn dcommit when committing on a remote repository)
>
> How do you manage situation like this?

I am in the same situation. What I did is not to add these files to .gitignore. On my "work" branch, I commited these files in a separate commit "local changes". When I want to push to svn, I switch to the branch "master", and cherry-pick the commit I want to push. $ git checkout master $ git svn rebase $ git cherry-pick work $ git svn dcommit $ git checkout work $ git rebase master

This workflow could maybe be better. Suggestions welcome.
Yann
Previous: Daniele SegatoNext: Daniele Segato
Message 2 of 10 in “Locally manage user/branch setting files without pushing them remotely”
  1. Daniele SegatoNov 11, 2009
  2. Yann SimonNov 11, 2009
  3. Daniele SegatoNov 11, 2009
  4. Yann SimonNov 11, 2009
  5. Paolo CiarrocchiNov 11, 2009
  6. Nicolas SebrechtNov 11, 2009
  7. Daniele SegatoNov 12, 2009
  8. Nicolas SebrechtNov 12, 2009
  9. Daniele SegatoNov 12, 2009
  10. Nicolas SebrechtNov 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.