{"thread":{"id":"27889","subject":"tracking file locally without pushing it to remote","startedAt":"2011-07-22T19:23:33Z","lastAt":"2011-07-23T12:35:45Z","messageCount":3,"participants":["neubyr","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171856","messageId":"CALFxCvzqGBbq0fqtLJdwTideh9Un-cAEeQi8WpC496qoyCLg4w@mail.gmail.com","threadId":"27889","inReplyTo":null,"subject":"tracking file locally without pushing it to remote","fromName":"neubyr","fromEmail":"neubyr@gmail.com","sentAt":"2011-07-22T19:23:33Z","receivedAt":"2011-07-22T19:23:33Z","isPatch":false,"sender":{"key":"neubyr@gmail.com","avatar":null},"body":"I have two configuration files in a project which I would like to\ntrack locally, however avoid pushing them to the remote repository. Is\nit possible do that? Any suggestions on how can it be done?\n\n--neu.by.r\n"},{"id":"171888","messageId":"CACsJy8BZSWaaNPjQYKXmTHvJ5vbNXBfNCtV78DUJVDuPqtp1Hg@mail.gmail.com","threadId":"27889","inReplyTo":"CALFxCvzqGBbq0fqtLJdwTideh9Un-cAEeQi8WpC496qoyCLg4w@mail.gmail.com","subject":"Re: tracking file locally without pushing it to remote","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-07-23T12:27:20Z","receivedAt":"2011-07-23T12:27:20Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Jul 23, 2011 at 2:23 AM, neubyr <neubyr@gmail.com> wrote:\n> I have two configuration files in a project which I would like to\n> track locally, however avoid pushing them to the remote repository. Is\n> it possible do that? Any suggestions on how can it be done?\n\nManage the configuration files in a different repository (but with the\nsame working tree). Git does not support sharing worktree this way, so\nit's a bit inconvenient. Maybe other people can give more suggestions.\n\n# Initialize a config repo, place it at $GIT_DIR/config.git so it's hidden\nGIT_DIR=`git rev-parse --git-dir`/config.git\nGIT_WORK_TREE=/path/to/worktree git init\n# Work on all files as usual, when you need to commit config files\nGIT_DIR=`git rev-parse --git-dir`/config.git git <command>\n\nCreate some aliases to shorten the commands. Branch switching will be\na problem, since you have to switch branch on two repositories\nconsistently.\n-- \nDuy\n"},{"id":"171891","messageId":"CACsJy8AaDj3QV-unj80cY4x18tHRDAr0hdgtiRuCs6SCYP33ng@mail.gmail.com","threadId":"27889","inReplyTo":"CACsJy8BZSWaaNPjQYKXmTHvJ5vbNXBfNCtV78DUJVDuPqtp1Hg@mail.gmail.com","subject":"Re: tracking file locally without pushing it to remote","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-07-23T12:35:45Z","receivedAt":"2011-07-23T12:35:45Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Jul 23, 2011 at 7:27 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> Manage the configuration files in a different repository (but with the\n> same working tree). Git does not support sharing worktree this way, so\n> it's a bit inconvenient.\n\nAnd if you still want to manage config template files with the same\nname in the main repository, to be pushed to a remote one. Set\nassume-unchanged bit (see update-index man page) on those files in\nmain repo, so you won't see their changes against the templates and\n\"git commit -a\" won't commit them. To be on the safe side, add a\npost-commit hook that disallows committing any changes to config\nfiles.\n\nAssume unchanged bits are not persistent (ie. you will need to set it\nafter branch switching, reset index...), but if this way works well,\nmaybe we can add a pattern file to automatically set it.\n-- \nDuy\n"}]}