I have two configuration files in a project which I would like to track locally, however avoid pushing them to the remote repository. Is it possible do that? Any suggestions on how can it be done?
--neu.by.r
threads / discuss / 27889
Subject: tracking file locally without pushing it to remote
I have two configuration files in a project which I would like to track locally, however avoid pushing them to the remote repository. Is it possible do that? Any suggestions on how can it be done?
--neu.by.r
Re: tracking file locally without pushing it to remote
On Sat, Jul 23, 2011 at 2:23 AM, neubyr <neubyr@gmail.com> wrote:
> I have two configuration files in a project which I would like to > track locally, however avoid pushing them to the remote repository. Is > it possible do that? Any suggestions on how can it be done?
Manage the configuration files in a different repository (but with the same working tree). Git does not support sharing worktree this way, so it's a bit inconvenient. Maybe other people can give more suggestions.
# Initialize a config repo, place it at $GIT_DIR/config.git so it's hidden GIT_DIR=`git rev-parse --git-dir`/config.git GIT_WORK_TREE=/path/to/worktree git init # Work on all files as usual, when you need to commit config files GIT_DIR=`git rev-parse --git-dir`/config.git git <command>
Create some aliases to shorten the commands. Branch switching will be a problem, since you have to switch branch on two repositories consistently.
-- Duy
Re: tracking file locally without pushing it to remote
On Sat, Jul 23, 2011 at 7:27 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> Manage the configuration files in a different repository (but with the > same working tree). Git does not support sharing worktree this way, so > it's a bit inconvenient.
And if you still want to manage config template files with the same name in the main repository, to be pushed to a remote one. Set assume-unchanged bit (see update-index man page) on those files in main repo, so you won't see their changes against the templates and "git commit -a" won't commit them. To be on the safe side, add a post-commit hook that disallows committing any changes to config files.
Assume unchanged bits are not persistent (ie. you will need to set it after branch switching, reset index...), but if this way works well, maybe we can add a pattern file to automatically set it.
-- Duy