{"thread":{"id":"22247","subject":"Integration-Manager Workflow","startedAt":"2010-01-16T17:49:32Z","lastAt":"2010-01-17T02:53:44Z","messageCount":4,"participants":["Adrián Ribao Martínez","Michael Poole"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131890","messageId":"201001161849.32211.aribao@gmail.com","threadId":"22247","inReplyTo":null,"subject":"Integration-Manager Workflow","fromName":"Adrián Ribao Martínez","fromEmail":"aribao@gmail.com","sentAt":"2010-01-16T17:49:32Z","receivedAt":"2010-01-16T17:49:32Z","isPatch":false,"sender":{"key":"aribao@gmail.com","avatar":null},"body":"Hello everybody, I'm learning git since I'm planning moving from Bazaar.\n\nI've been reading the documentation and the progit book, which is excellent.\n\nI'm a bit confused In the chapter: http://progit.org/book/ch5-1.html#integrationmanager_workflow : \"Integration-Manager Workflow\"\n\nI need to manages a project with several developers. Those developers are split into teams.\n\nI'm planning these:\n * A central repository using the http protocol. This central repository would be only writable by myself, it would have http access for the developers and ssh access for me.\n * Every team would have ssh access to their repositories. i.e. team1.myserver.net, team2.myserver.net\n * I want at least three branches: master, test, and develop. The path would be: develop(development version) -> test (beta) -> master (stable)\n * I don't want any developer to write into the develop branch, and if they do by mistake, I don't want to take it into account.\n\nMy question is about the branches in the teams repositories. I want the developers to create feature/fix branches in their checkouts and when they have finished the work, I check and merge into develop if everything is OK.\n\nIs the following procedure correct?:\n1. They send me the path of the branch I should do: git checkout --track origin/feature1 (where origin could be: ssh://user@team1.myserver.net:/home/user/git/project)\n2. If everything is ok I merge into development and remove branch feature1.\n3. They fetch and the branch is deleted in their local checkouts, and the feature1 is in the develop branch: git pull origin\n\n\nWhat happens if they accidentally work in the develop branch instead of creating a new one? What should we do?\nI think I should never fetch from teamx.myserver.net to avoid this problem and instead track the branch like in step 2. Is this correct?\n\nThank you for your help, I'm a bit confused about git.\n\nRegards,\n\nAdrian Ribao\n"},{"id":"131899","messageId":"87r5ppx42f.fsf@troilus.org","threadId":"22247","inReplyTo":"201001161849.32211.aribao@gmail.com","subject":"Re: Integration-Manager Workflow","fromName":"Michael Poole","fromEmail":"mdpoole@troilus.org","sentAt":"2010-01-16T19:06:16Z","receivedAt":"2010-01-16T19:06:16Z","isPatch":false,"sender":{"key":"mdpoole@troilus.org","avatar":null},"body":"Adrián Ribao Martínez writes:\n\n> What happens if they accidentally work in the develop branch instead of creating a new one? What should we do?\n> I think I should never fetch from teamx.myserver.net to avoid this problem and instead track the branch like in step 2. Is this correct?\n\nIt is simpler than that.\n\nIf you just use \"git remote add teamx teamx.myserver.net:/....\" (rather\nthan cloning your integration repository from one of those\nrepositories), it will leave all your local branches alone -- any\nchanges to teamx.myserver.net's \"develop\" branch will only show up in\nthe teamx/develop tracking branch.\n\nThe reason is that a fetch or pull only merges into your develop branch\nif your branch.develop.merge git-config entry specifies an upstream\nbranch -- more detail can be found in the git-config man page under\nbranch.<name>.remote and branch.<name>.merge.\n\nThose entries are set up when you clone from a repository, and through\nsome other commands, but if teamx clones from the integration server,\nthey can only mess up their own develop branch.  If/when you push into\nteamx's repository from yours, you can forcibly overwrite any of those\naccidental changes.  (Normally, though, the push would only do a\nfast-forward merge -- so if teamx made such a mistake, the merge will\nfail until you address the mismatch.)\n\nMichael Poole\n"},{"id":"131906","messageId":"201001162047.38010.aribao@gmail.com","threadId":"22247","inReplyTo":"87r5ppx42f.fsf@troilus.org","subject":"Re: Integration-Manager Workflow","fromName":"Adrián Ribao Martínez","fromEmail":"aribao@gmail.com","sentAt":"2010-01-16T19:47:37Z","receivedAt":"2010-01-16T19:47:37Z","isPatch":false,"sender":{"key":"aribao@gmail.com","avatar":null},"body":"> Adrián Ribao Martínez writes:\n> \n> > What happens if they accidentally work in the develop branch instead of creating a new one? What should we do?\n> > I think I should never fetch from teamx.myserver.net to avoid this problem and instead track the branch like in step 2. Is this correct?\n> \n> It is simpler than that.\n> \n> If you just use \"git remote add teamx teamx.myserver.net:/....\" (rather\n> than cloning your integration repository from one of those\n> repositories), it will leave all your local branches alone -- any\n> changes to teamx.myserver.net's \"develop\" branch will only show up in\n> the teamx/develop tracking branch.\n\nI think this is a stupid question but, how do I bring the feature1 branch from teamx to my local repository?\n\n> \n> The reason is that a fetch or pull only merges into your develop branch\n> if your branch.develop.merge git-config entry specifies an upstream\n> branch -- more detail can be found in the git-config man page under\n> branch.<name>.remote and branch.<name>.merge.\n> \n> Those entries are set up when you clone from a repository, and through\n> some other commands, but if teamx clones from the integration server,\n> they can only mess up their own develop branch.  If/when you push into\n> teamx's repository from yours, you can forcibly overwrite any of those\n> accidental changes.  (Normally, though, the push would only do a\n> fast-forward merge -- so if teamx made such a mistake, the merge will\n> fail until you address the mismatch.)\n\nI'm not sure if I understand.\n\n1. I bring the feature1 to my local repository.\n2. Check if everything is ok\n3. Merge or rebase the branch into develop\n4. Push the develop changes into the in central repository\n5. Push and force the develop changes into the teamx server\n6. The developers pull their local repositories from teamx server\n\nIs this correct? What are the commands for all those actions?\n\n> \n> Michael Poole\n> \n\nThank you.\n"},{"id":"131920","messageId":"87my0dwifb.fsf@troilus.org","threadId":"22247","inReplyTo":"201001162047.38010.aribao@gmail.com","subject":"Re: Integration-Manager Workflow","fromName":"Michael Poole","fromEmail":"mdpoole@troilus.org","sentAt":"2010-01-17T02:53:44Z","receivedAt":"2010-01-17T02:53:44Z","isPatch":false,"sender":{"key":"mdpoole@troilus.org","avatar":null},"body":"Adrián Ribao Martínez writes:\n\n>> Adrián Ribao Martínez writes:\n>> \n>> > What happens if they accidentally work in the develop branch instead of creating a new one? What should we do?\n>> > I think I should never fetch from teamx.myserver.net to avoid this problem and instead track the branch like in step 2. Is this correct?\n>> \n>> It is simpler than that.\n>> \n>> If you just use \"git remote add teamx teamx.myserver.net:/....\" (rather\n>> than cloning your integration repository from one of those\n>> repositories), it will leave all your local branches alone -- any\n>> changes to teamx.myserver.net's \"develop\" branch will only show up in\n>> the teamx/develop tracking branch.\n>\n> I think this is a stupid question but, how do I bring the feature1 branch from teamx to my local repository?\n\nIn brief, \"git fetch teamx\" -- it will copy that repository's branches\ninto \"tracking\" branches.  In your repository, they will be named like\nteamx/develop, teamx/test, teamx/feature, and so on.\n\nWhen you run the \"git remote add teamx ${location}\" command, it creates\na section in .git/config that looks like this:\n\n[remote \"teamx\"]\n        url = ssh://teamx.myserver.net/home/teamx/product.git\n        fetch = +refs/heads/*:refs/remotes/teamx/*\n\nThis tells git to copy the remote branches to tracking branches; it will\nnot overwrite any of your own branches.  You can later add \"push\"\nentries to this section to change the default behavior for \"git push\nteamx\".  For example, adding:\n\n         push = refs/head/develop\n         push = refs/head/test:refs/head/test\n         push = +refs/head/master\n\nThese all tell git to push your local branch (develop, test or master)\nto the same branch name in the teamx repository.  The + in the last line\nsays to push even when it is not a fast-forward.  (The \"<refspec>\"\nsection of the git-push man pages has more discussion of the syntax.\nUsing these push entries makes sure that you don't accidentally modify a\nfeature branch on the team's repository.)\n\n>> \n>> The reason is that a fetch or pull only merges into your develop branch\n>> if your branch.develop.merge git-config entry specifies an upstream\n>> branch -- more detail can be found in the git-config man page under\n>> branch.<name>.remote and branch.<name>.merge.\n>> \n>> Those entries are set up when you clone from a repository, and through\n>> some other commands, but if teamx clones from the integration server,\n>> they can only mess up their own develop branch.  If/when you push into\n>> teamx's repository from yours, you can forcibly overwrite any of those\n>> accidental changes.  (Normally, though, the push would only do a\n>> fast-forward merge -- so if teamx made such a mistake, the merge will\n>> fail until you address the mismatch.)\n>\n> I'm not sure if I understand.\n\nThe process you listed looks workable, although I would swap 2 and 3 to\nsave commands when the change is good (with no extra commands if the\nchange is bad).  In addition, merging first will find merge conflicts\nbefore you do any verification.\n\n> 1. I bring the feature1 to my local repository.\n\ngit fetch teamx\n\n> 2. Check if everything is ok\n\ngit checkout teamx/feature1\nmake clean test (or whatever is appropriate)\n\n> 3. Merge or rebase the branch into develop\n\ngit checkout develop\ngit merge teamx/feature1\n\nIf I were to swap the two steps above, I would make sure I was on the\ndevelop branch, and then run:\n  git merge teamx/feature1\n  make clean test\nIf the check-out fails, \"git reset --hard HEAD^\" will back up to the\nfirst parent commit -- in this case, the previous tip commit for\n\"develop\".  If the check passes, the rest of the process is the same.\n\n> 4. Push the develop changes into the in central repository\n\ngit push central develop\n\n> 5. Push and force the develop changes into the teamx server\n\ngit push teamx develop\n\n> 6. The developers pull their local repositories from teamx server\n\ngit pull teamx\n\nHopefully this helps explain things.\n\nMichael Poole\n"}]}