{"thread":{"id":"41134","subject":"Re: Advice regarding inherited git repository","startedAt":"2016-01-06T08:20:22Z","lastAt":"2016-01-07T08:40:46Z","messageCount":2,"participants":["Jeff King","Danielle"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"275417","messageId":"20160106082022.GA19117@sigill.intra.peff.net","threadId":"41134","inReplyTo":"loom.20160105T183516-607@post.gmane.org","subject":"Re: Advice regarding inherited git repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-01-06T08:20:22Z","receivedAt":"2016-01-06T08:20:22Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 05, 2016 at 05:42:15PM +0000, Danielle wrote:\n\n> I inherited a web site and a git repository. the git repository is cloned \n> to the website and a sandbox website (two clones). No commits have been \n> done in more than 6 months. The main site has been updated a lot of times, \n> the sandbox has lots of test and exploratory code. To bring things up to \n> date, I thought of staging and committing all the files in the main site \n> and pushing to the remote repository, and then fetching into the sandbox \n> clone and merging what is needed (which will be sooo not trivial). Does \n> this make sense? Or would it be better to create a sandbox branch somehow? \n> I'm used to working with SVN, no real git experience, so I would \n> appreciate any advice on how to manage this.\n\nYou probably should create a sandbox branch, for your own sanity.\nBecause git is distributed, each separate repository is implicitly a\nbranch. So if you did something like:\n\n  1. Commit all the changes on the main site to \"master\". Push the\n     result to some common remote.\n\n  2. Commit all the changes in the sandbox to its \"master\". Do _not_\n     push to the remote.\n\n  3. Pull the changes from the remote into the sandbox. If they're worth\n     adding to the main site, push them up. If not, leave them there.\n\nThat works; \"master\" in the sandbox has the experimental changes, but\nyou don't have to push them anywhere.  However, you are one accidental\n\"git push\" away from sending all of those experimental features to your\nremote \"master\". So it's easy enough to make step 1.5 \"git checkout -b\nsandbox-cruft\" in the sandbox repository, so git knows not to ever push\nit to \"master\".\n\nIn general, I'd also say you may benefit from splitting the changes in\neach repository into as many separate logical commits as you can (and\npossibly even to separate topic branches that you can merge\nindependently). Given that you inherited this, that's _probably_ too\nmuch work. But if you do want to try it, I recommend \"git add -p\" for\npicking out individual hunks.\n\n-Peff\n"},{"id":"275467","messageId":"loom.20160107T093305-483@post.gmane.org","threadId":"41134","inReplyTo":"20160106082022.GA19117@sigill.intra.peff.net","subject":"Re: Advice regarding inherited git repository","fromName":"Danielle","fromEmail":"dsavir.h@gmail.com","sentAt":"2016-01-07T08:40:46Z","receivedAt":"2016-01-07T08:40:46Z","isPatch":false,"sender":{"key":"dsavir.h@gmail.com","avatar":null},"body":"> You probably should create a sandbox branch, for your own sanity.\n> Because git is distributed, each separate repository is implicitly a\n> branch. So if you did something like:\n> \n>   1. Commit all the changes on the main site to \"master\". Push the\n>      result to some common remote.\n> \n>   2. Commit all the changes in the sandbox to its \"master\". Do _not_\n>      push to the remote.\n> \n>   3. Pull the changes from the remote into the sandbox. If they're \nworth\n>      adding to the main site, push them up. If not, leave them there.\n> \n> That works; \"master\" in the sandbox has the experimental changes, but\n> you don't have to push them anywhere.  However, you are one accidental\n> \"git push\" away from sending all of those experimental features to \nyour\n> remote \"master\". So it's easy enough to make step 1.5 \"git checkout -b\n> sandbox-cruft\" in the sandbox repository, so git knows not to ever \npush\n> it to \"master\".\n> \n> In general, I'd also say you may benefit from splitting the changes in\n> each repository into as many separate logical commits as you can (and\n> possibly even to separate topic branches that you can merge\n> independently). Given that you inherited this, that's _probably_ too\n> much work. But if you do want to try it, I recommend \"git add -p\" for\n> picking out individual hunks.\n> \n> -Peff\n> \n\n\nThanks for answering!\n\nI've done the above, but it caused some problems, some of which I \nhaven't solved yet. What I have now is a master branch with the site in \nboth repositories; and in the sandbox an additional devel branch with \nthe changes done. I want to split the devel branch into the actual \nfeatures being explored, and then merge each into master and push when \ndone. The main trouble with that seems to be the settings.php file, \nwhich should be backed up but certainly shouldn't go from one site to \nanother. Removing it from the repository caused some problems, even when \nkeeping a local cache for some reason (it got lost when switching \nbranches and gave me a bad moment until I figured it out). Any \nsuggestions?\n\nAdd -p will certainly help in the feature branches, thanks for \nsuggesting it!\n"}]}