tags:

views:

55

answers:

3

I have two repositories. I started a project locally on my development machine, later cloned it to a testing environment on the customers server. I mimic the environment on the customers server, but for that I need to have some files (and some lines in some other files) to be only present on my local machine, but they must not appear on the remote environment.

I've deleted these files and lines just after I cloned the project and committed these changes on a single commit in the remote repository, but after a push (back to the origin repository) I would have to ignore this commit on my local repository. I would like to have both repositories in sync, except for this single commit, so the project would run on both, slightly different, environments.

How would I do that? How can I ignore a commit locally without altering it on the remote repo after a push/pull?

+1  A: 

The simple answer is not to keep anything machine-specific in version control, or at least to keep machine-specific commits in files which are copies or templates of the file actually being used by the application.

See: http://stackoverflow.com/questions/1578694/is-there-a-way-to-make-tortoisesvn-temporarily-ignore-versioned-files/1578737#1578737

Ben James
Ok, maybe I can live without tracking those additional files. The changed files... damn, there is a .htaccess file with a path in it, I would have to untrack it completely as I can't split it. Isn't there any way to make some changes "private", so they won't get pushed to another clone? Or will I have to fill a feature request for it?
craesh
+1  A: 

How about creating a branch to contain your local changes ?

Dominik
Keeping a separate branch would mean to rebase them after every push/pull. I hope for a more straightforward solution.
craesh
A: 

Usually, for config files, you keep in the repo a template config file, along with a script able to generate a "private" (i.e. not versioned) config file with the right values depending on the current environment/platform.

That way, you do not have to deal with any "conditional" commit.

See also the SO question "How to track config files of submodules in Git?"

Note: I realize you are not necessarily talking about config file per se, but that still can give you an idea about how to manage similar files.

VonC