{"thread":{"id":"51772","subject":"How to track history of personal changes in a repository?","startedAt":"2019-08-29T14:32:33Z","lastAt":"2019-09-03T12:57:30Z","messageCount":6,"participants":["Matthew McClure","Elijah Newren","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"381513","messageId":"CAEV-cEryZZarfz5SQsRphBXeYMPJW7tdSfY8NYnzb_-ra-pGHw@mail.gmail.com","threadId":"51772","inReplyTo":null,"subject":"How to track history of personal changes in a repository?","fromName":"Matthew McClure","fromEmail":"matt@continuousdelta.com","sentAt":"2019-08-29T14:32:16Z","receivedAt":"2019-08-29T14:32:33Z","isPatch":false,"sender":{"key":"matt@continuousdelta.com","avatar":null},"body":"Hi,\n\nI'm looking for a way to track history of personal changes in a repository. I'd\nlike to protect against accidentally pushing the changes to a remote branch. I\nimagine this working a little like `git ignore`, and a little like a separate\nbranch. It might be like a personal sub-branch that is ignored by `git\npush`. Or it might be like a history of the work tree that runs parallel to the\nreflog and to the history of any given branch.\n\nDoes something like this exist in Git or a complementary tool?\n\nI found `git update-index --skip-worktree`. I imagine it might be relevant in\nsome kind of workflow where I can maintain a personal-worktree branch.\n\nDoes any of you have a personal workflow that addresses similar concerns?\n\nThanks.\n\n-- \nMatthew McClure\nContinuous Delta\nhttps://www.continuousdelta.com/\n"},{"id":"381523","messageId":"CABPp-BE0ij8zF22xbvjbcq3vG-VwWjUmjNo45Lsm0BEnH=iZ-A@mail.gmail.com","threadId":"51772","inReplyTo":"CAEV-cEryZZarfz5SQsRphBXeYMPJW7tdSfY8NYnzb_-ra-pGHw@mail.gmail.com","subject":"Re: How to track history of personal changes in a repository?","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-08-29T17:04:29Z","receivedAt":"2019-08-29T17:04:42Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Thu, Aug 29, 2019 at 7:34 AM Matthew McClure\n<matt@continuousdelta.com> wrote:\n>\n> Hi,\n>\n> I'm looking for a way to track history of personal changes in a repository. I'd\n> like to protect against accidentally pushing the changes to a remote branch. I\n> imagine this working a little like `git ignore`, and a little like a separate\n> branch. It might be like a personal sub-branch that is ignored by `git\n> push`. Or it might be like a history of the work tree that runs parallel to the\n> reflog and to the history of any given branch.\n>\n> Does something like this exist in Git or a complementary tool?\n>\n> I found `git update-index --skip-worktree`. I imagine it might be relevant in\n> some kind of workflow where I can maintain a personal-worktree branch.\n>\n> Does any of you have a personal workflow that addresses similar concerns?\n\nPerhaps put all the changes in a specific branch and run:\n  git config branch.${personalBranchName}.pushRemote\nDo.Not.Push.Changes.From.This.Branch\n?  (And make sure that push.default is not set to 'matching'.)\n"},{"id":"381526","messageId":"CAEV-cEp19ehfBwHxh7OGsvTxTchNJLSRZGZXqAsDjyQg-W3rFA@mail.gmail.com","threadId":"51772","inReplyTo":"CABPp-BE0ij8zF22xbvjbcq3vG-VwWjUmjNo45Lsm0BEnH=iZ-A@mail.gmail.com","subject":"Re: How to track history of personal changes in a repository?","fromName":"Matthew McClure","fromEmail":"matt@continuousdelta.com","sentAt":"2019-08-29T17:55:55Z","receivedAt":"2019-08-29T17:56:10Z","isPatch":false,"sender":{"key":"matt@continuousdelta.com","avatar":null},"body":"On Thu, Aug 29, 2019 at 1:04 PM Elijah Newren <newren@gmail.com> wrote:\n>\n> Perhaps put all the changes in a specific branch and run:\n>   git config branch.${personalBranchName}.pushRemote\n> Do.Not.Push.Changes.From.This.Branch\n> ?  (And make sure that push.default is not set to 'matching'.)\n\nI imagine putting all the changes on a specific branch might be part\nof a solution. I'm looking for ways to keep the changes in the work\ntree as well, even as I switch among other branches I'm working on.\n\n--\nMatthew McClure\nContinuous Delta\nhttps://www.continuousdelta.com/\n"},{"id":"381586","messageId":"CABPp-BEWn1wHdxWM8cVqmvzYo8HDdUzuh4G-XTN51o8JdvkrCw@mail.gmail.com","threadId":"51772","inReplyTo":"CAEV-cEp19ehfBwHxh7OGsvTxTchNJLSRZGZXqAsDjyQg-W3rFA@mail.gmail.com","subject":"Re: How to track history of personal changes in a repository?","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-08-30T15:21:17Z","receivedAt":"2019-08-30T15:21:31Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Thu, Aug 29, 2019 at 10:58 AM Matthew McClure\n<matt@continuousdelta.com> wrote:\n>\n> On Thu, Aug 29, 2019 at 1:04 PM Elijah Newren <newren@gmail.com> wrote:\n> >\n> > Perhaps put all the changes in a specific branch and run:\n> >   git config branch.${personalBranchName}.pushRemote\n> > Do.Not.Push.Changes.From.This.Branch\n> > ?  (And make sure that push.default is not set to 'matching'.)\n>\n> I imagine putting all the changes on a specific branch might be part\n> of a solution. I'm looking for ways to keep the changes in the work\n> tree as well, even as I switch among other branches I'm working on.\n\nWell, here's some ideas...\n\nIf you want personal changes kept in the worktree and aren't worried\nabout versioning them:\n\n* If the changes are new files that are not tracked, just .gitignore them.\n* If the changes are to files that are tracked, AND you aren't making\nchanges to those same files that do need to be committed and pushed,\nuse the assume-unchanged bit (see git-update-index(1)).\n* If the changes are to files that are tracked and you need to make\nother changes to those same files, the best you've probably got is \"be\ncareful while using 'git add -p' to only select the bits that should\nbe staged\".\n\nIf you want to keep the personal changes in the worktree AND are\nworried about version control:\n\n* You could just make sure that any personal changes are made in\nseparate commits of their own and put a special string (e.g. \"DO NOT\nPUSH\") in the commit message.  Add a pre-push hook (see githooks) that\nchecks for this string in any of the commits to be pushed and denies\nthe push if it is found.  At that point, you'd just rebase to move the\n\"DO NOT PUSH\" to be the last commits in the series, and always make\nsure when pushing that you specify a commit older than the current tip\nof your branch to push (i.e. using refspecs; see the git-push manpage)\n* If you don't like the githook route and if the personal changes are\nall in different filenames than exist in other branches, and you're\nwilling to do a little low-level hackery...then you could put all\nthese changes in a different branch as mentioned previously, and use\nsome low-level commands to \"checkout\" the files from both branches\nsimultaneously.  The basic way it'd work is that the real branch would\nhave a .gitignore for all files in your personal changes (whereas the\npersonal changes branch would have no .gitignore because files have to\nbe independent; things will just be uglier when you're on that\nbranch).  You'd use 'git symbolic-ref HEAD $OTHER_BRANCH && git reset'\nto swap branches on the fly so you can commit different types of\nchanges.\n\nHope that helps,\nElijah\n"},{"id":"381626","messageId":"2737a9f3-769d-5dc7-ca4e-ef4dbdde70f6@iee.email","threadId":"51772","inReplyTo":"CABPp-BEWn1wHdxWM8cVqmvzYo8HDdUzuh4G-XTN51o8JdvkrCw@mail.gmail.com","subject":"Re: How to track history of personal changes in a repository?","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2019-08-31T13:32:28Z","receivedAt":"2019-08-31T13:32:44Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Hi Elijah, Matt\n\nOn 30/08/2019 16:21, Elijah Newren wrote:\n> * If the changes are to files that are tracked, AND you aren't making\n> changes to those same files that do need to be committed and pushed,\n> use the assume-unchanged bit (see git-update-index(1)).\nNot sure I parsed that well but...\n\nThe `assume-unchanged bit` is commonly miss-construed as a promise by \nGit that it will ignore changes to the file.\n\nThat is incorrect. The bit is a promise by the _user_ that they won't \nchange the file, so that, in general Git stops checking for updates to \nthe file.\nHowever it will check for updates sometimes, leading to unexpected \neffects if the user has the wrong mental model, thinking that Git would \nignore their changes...\n\nPhilip\n"},{"id":"381719","messageId":"CAEV-cEr1tHc4zY7hYSUVUFcqO60y1ssXHC1jO20606HzB4QxnA@mail.gmail.com","threadId":"51772","inReplyTo":"2737a9f3-769d-5dc7-ca4e-ef4dbdde70f6@iee.email","subject":"Re: How to track history of personal changes in a repository?","fromName":"Matthew McClure","fromEmail":"matt@continuousdelta.com","sentAt":"2019-09-03T12:57:15Z","receivedAt":"2019-09-03T12:57:30Z","isPatch":false,"sender":{"key":"matt@continuousdelta.com","avatar":null},"body":"On Sat, Aug 31, 2019 at 09:32 Philip Oakley <philipoakley@iee.email> wrote:\n>\n>\n> The `assume-unchanged bit` is commonly miss-construed as a promise by\n> Git that it will ignore changes to the file.\n\nMaybe `--skip-worktree` would be more appropriate.\n"}]}