Search code examples
gitclonecommit

Keep a commit locally to clone in Git


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?


Solution

  • 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: Is there a way to make TortoiseSVN temporarily ignore versioned files?