# tracking file locally without pushing it to remote

3 messages from 2011-07-22 to 2011-07-23. Participants: neubyr, Nguyen Thai Ngoc Duy.
Thread: https://gitlist.dev/t/27889

## neubyr, 2011-07-22 19:23

Subject: tracking file locally without pushing it to remote
Message-ID: <CALFxCvzqGBbq0fqtLJdwTideh9Un-cAEeQi8WpC496qoyCLg4w@mail.gmail.com>
URL: https://gitlist.dev/e/CALFxCvzqGBbq0fqtLJdwTideh9Un-cAEeQi8WpC496qoyCLg4w%40mail.gmail.com

```
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

```

## Nguyen Thai Ngoc Duy, 2011-07-23 12:27

Subject: Re: tracking file locally without pushing it to remote
Message-ID: <CACsJy8BZSWaaNPjQYKXmTHvJ5vbNXBfNCtV78DUJVDuPqtp1Hg@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8BZSWaaNPjQYKXmTHvJ5vbNXBfNCtV78DUJVDuPqtp1Hg%40mail.gmail.com
In-Reply-To: <CALFxCvzqGBbq0fqtLJdwTideh9Un-cAEeQi8WpC496qoyCLg4w@mail.gmail.com>

```
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

```

## Nguyen Thai Ngoc Duy, 2011-07-23 12:35

Subject: Re: tracking file locally without pushing it to remote
Message-ID: <CACsJy8AaDj3QV-unj80cY4x18tHRDAr0hdgtiRuCs6SCYP33ng@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8AaDj3QV-unj80cY4x18tHRDAr0hdgtiRuCs6SCYP33ng%40mail.gmail.com
In-Reply-To: <CACsJy8BZSWaaNPjQYKXmTHvJ5vbNXBfNCtV78DUJVDuPqtp1Hg@mail.gmail.com>

```
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

```
