{"thread":{"id":"16079","subject":"Do most people feel tracking branches useful?","startedAt":"2008-10-29T08:55:48Z","lastAt":"2008-10-29T13:29:13Z","messageCount":9,"participants":["Liu Yubao","Miles Bader","Andreas Ericsson","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"94168","messageId":"49082514.9050405@gmail.com","threadId":"16079","inReplyTo":null,"subject":"Do most people feel tracking branches useful?","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2008-10-29T08:55:48Z","receivedAt":"2008-10-29T08:55:48Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"Hi,\n\nI often feel tracking branches are useless to me, because there are remote\nbranches and I work on my private branch in most time.\n\n   repos\n     |\n     |-- my               (private branch, do my dirty work)\n     |-- master           (tracking branch)\n     |-- origin/master    (remote branch)\n\nTo avoid conflict when execute `git pull` and make the history linear, I work\non branch \"my\" instead of \"master\". Here is my work flow:\n\n1) use `git fetch` or `git remote update` to synchronize branch \"origin/master\"\nwith branch \"master\" in remote repository;\n2) create a new private branch to polish my commits and rebase it against\n\"origin/master\";\n3) at last push this new branch to the remote repository or ask the upstream\ndeveloper to fetch it(no `git pull` because we want history as linear as possible).\n\nI don't want to bother with the tracking branch \"master\", it's identical\nwith \"origin/master\".  Because `git checkout -b xxx <remote_branch>`\nwill create a tracking branch \"xxx\" by default, so my question is:\ndo most people feel tracking branches useful?\n\n\nBTW: I feel the terminalogy \"remote branch\" is confused, because I must\nsynchronize it with `git fetch`. I feel it's better to call it \"tracking\nbranch\" // seems will lead to bigger confusion to experienced git users:-(\n"},{"id":"94169","messageId":"buoprlj4vle.fsf@dhapc248.dev.necel.com","threadId":"16079","inReplyTo":"49082514.9050405@gmail.com","subject":"Re: Do most people feel tracking branches useful?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2008-10-29T09:08:29Z","receivedAt":"2008-10-29T09:08:29Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Liu Yubao <yubao.liu@gmail.com> writes:\n> do most people feel tracking branches useful?\n\nExtremely useful.  I usually keep local branches closely synchronized\nwith a remote \"central\" version, and tracking branches make the frequent\npush/pull much more convenient.\n\nI often delete the default local \"master\" branch though, and have only\none local branch per working directory (and like you, use origin/... for\nmuch interbranch synchronization, e.g. rebasing).\n\n-Miles\n\n-- \n\"Whatever you do will be insignificant, but it is very important that\n you do it.\"  Mahatma Gandhi\n"},{"id":"94170","messageId":"49083166.7090804@op5.se","threadId":"16079","inReplyTo":"49082514.9050405@gmail.com","subject":"Re: Do most people feel tracking branches useful?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-10-29T09:48:22Z","receivedAt":"2008-10-29T09:48:22Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Liu Yubao wrote:\n> Hi,\n> \n> I often feel tracking branches are useless to me, because there are remote\n> branches and I work on my private branch in most time.\n> \n>    repos\n>      |\n>      |-- my               (private branch, do my dirty work)\n>      |-- master           (tracking branch)\n>      |-- origin/master    (remote branch)\n> \n> To avoid conflict when execute `git pull` and make the history linear, I work\n> on branch \"my\" instead of \"master\". Here is my work flow:\n> \n\nUse \"git fetch\" instead of \"git pull\" and you won't need the 'my' branch.\nIf you use \"git pull --rebase\" you won't need to bother at all.\n\n> 1) use `git fetch` or `git remote update` to synchronize branch \"origin/master\"\n> with branch \"master\" in remote repository;\n> 2) create a new private branch to polish my commits and rebase it against\n> \"origin/master\";\n> 3) at last push this new branch to the remote repository or ask the upstream\n> developer to fetch it(no `git pull` because we want history as linear as possible).\n> \n> I don't want to bother with the tracking branch \"master\", it's identical\n> with \"origin/master\".\n\nNot unless you \"git pull\" when there's only fast-forward changes.\n\n>  Because `git checkout -b xxx <remote_branch>`\n> will create a tracking branch \"xxx\" by default, so my question is:\n> do most people feel tracking branches useful?\n> \n\nI use them all the time. They're immensely useful to me.\n\nI can't understand why you're working so hard for a linear history, but perhaps\nthat's just an effect of only having leaf developers. I also can't understand\nwhy you'd want to sync with upstream at all if you're just working on a single\nfeature/bugfix at the time, since you'd probably be better off by just completing\nthat single feature in your own time and doing \"git pull --rebase && git push\"\nwhen you're done.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"94171","messageId":"490833AD.70806@gmail.com","threadId":"16079","inReplyTo":"buoprlj4vle.fsf@dhapc248.dev.necel.com","subject":"Re: Do most people feel tracking branches useful?","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2008-10-29T09:58:05Z","receivedAt":"2008-10-29T09:58:05Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"Miles Bader wrote:\n> Liu Yubao <yubao.liu@gmail.com> writes:\n>> do most people feel tracking branches useful?\n> \n> Extremely useful.  I usually keep local branches closely synchronized\n> with a remote \"central\" version, and tracking branches make the frequent\n> push/pull much more convenient.\n> \nIn my work flow, I don't keep changes in local branch for long time,\nI rebase it regularly and push them to central branch or discard them\nif the upstream rejects.\n\nYou are right, I realize tracking branches is useful for people who keeps\nlocal changes for long time and track the upstream branch at the same time.\n\nBut I guess an auto-rebasing policy is more sensible than auto-merging policy\nbecause I won't get many useless \"Merge branch 'xxx' of ...\" messages in the\nhistory.\n\nAnother problem about tracking branch is `git pull` won't merge tracking branch\nwith remote branch when the current branch isn't tracking branch, it warns me\n\"You asked me to pull without telling me which branch you ....\". It's not\nconvenient to checkout tracking branch and execute `git pull` then switch back\nto my working branch.\n"},{"id":"94172","messageId":"20081029100313.GP3612@atjola.homenet","threadId":"16079","inReplyTo":"49082514.9050405@gmail.com","subject":"Re: Do most people feel tracking branches useful?","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-10-29T10:03:13Z","receivedAt":"2008-10-29T10:03:13Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.10.29 16:55:48 +0800, Liu Yubao wrote:\n> Hi,\n> \n> I often feel tracking branches are useless to me, because there are remote\n> branches and I work on my private branch in most time.\n> \n>    repos\n>      |\n>      |-- my               (private branch, do my dirty work)\n>      |-- master           (tracking branch)\n>      |-- origin/master    (remote branch)\n\nActually, origin/master is the \"[remote] tracking branch\". master is\njust a branch that has config settings for \"git pull\" defaults. ;-)\n\n\"Remote branches\" are the actual branches on a remote repository.\n\n> To avoid conflict when execute `git pull` and make the history linear, I work\n> on branch \"my\" instead of \"master\". Here is my work flow:\n> \n> 1) use `git fetch` or `git remote update` to synchronize branch\n> \"origin/master\" with branch \"master\" in remote repository;\n> 2) create a new private branch to polish my commits and rebase it against\n> \"origin/master\";\n> 3) at last push this new branch to the remote repository or ask the upstream\n> developer to fetch it(no `git pull` because we want history as linear\n> as possible).\n\ngit pull --rebase\n\n> I don't want to bother with the tracking branch \"master\", it's identical\n> with \"origin/master\".  Because `git checkout -b xxx <remote_branch>`\n> will create a tracking branch \"xxx\" by default, so my question is:\n> do most people feel tracking branches useful?\n\nTracking branches (origin/* etc.) are very useful :-) And branches that\nhave \"git pull\" defaults (what you called \"tracking branch\") are also\nuseful.\n\nIn your case, you probably want:\ngit checkout -b my-stuff origin/master\ngit config branch.my-stuff.rebase true\n\nand then you can do:\ngit pull\n\nInstead of:\ngit fetch origin\ngit rebase origin/master\n\nYou can also setup branch.autosetuprebase, to automatically get the\nrebase setup, so you can skip the call to \"git config\" above.\n\nAnd you can just delete the \"master\" branch if you don't use it. There's\nnothing that forces you to keep any branches around that you don't use.\nBut that doesn't affect the usefulness of tracking branches or branches\nthat have \"git pull\" defaults :-)\n\n> BTW: I feel the terminalogy \"remote branch\" is confused, because I must\n> synchronize it with `git fetch`. I feel it's better to call it \"tracking\n> branch\" // seems will lead to bigger confusion to experienced git users:-(\n\nSee above, that's already the case ;-)\n\nBjörn\n"},{"id":"94173","messageId":"49083957.2060702@gmail.com","threadId":"16079","inReplyTo":"49083166.7090804@op5.se","subject":"Re: Do most people feel tracking branches useful?","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2008-10-29T10:22:15Z","receivedAt":"2008-10-29T10:22:15Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"Andreas Ericsson wrote:\n> Liu Yubao wrote:\n> \n> Use \"git fetch\" instead of \"git pull\" and you won't need the 'my' branch.\n> If you use \"git pull --rebase\" you won't need to bother at all.\n> \nThank you very much, I didn't know the \"--rebase\" option, now I learn\nthe 'branch.<name>.rebase' configuration too by \"git help pull\".\n\n[...snip...]\n\n> \n> I can't understand why you're working so hard for a linear history, but\n> perhaps\n> that's just an effect of only having leaf developers. I also can't\n> understand\nYou got it exactly, we are leaf developers and make enhancement mostly,\nwe don't want the upstream branch full of merging commit for many\nnot so major changes. I remember keeping linear history is recommended\nin git's documentation.\n\n> why you'd want to sync with upstream at all if you're just working on a\n> single\n> feature/bugfix at the time, since you'd probably be better off by just\n> completing\n> that single feature in your own time and doing \"git pull --rebase && git\n> push\"\n> when you're done.\nI only sync when I have finished my enhancement, I don't like merging\nwhen pull.\n\nYes, I'd better use \"git pull --rebase\", \"pull\" is a wonderful command:\npull = fetch + merge, pull --rebase = fetch + rebase, wow!\n"},{"id":"94176","messageId":"49083D2D.4020202@gmail.com","threadId":"16079","inReplyTo":"20081029100313.GP3612@atjola.homenet","subject":"Re: Do most people feel tracking branches useful?","fromName":"Liu Yubao","fromEmail":"yubao.liu@gmail.com","sentAt":"2008-10-29T10:38:37Z","receivedAt":"2008-10-29T10:38:37Z","isPatch":false,"sender":{"key":"yubao.liu@gmail.com","avatar":null},"body":"Björn Steinbrink wrote:\n> On 2008.10.29 16:55:48 +0800, Liu Yubao wrote:\n>> Hi,\n>>\n>> I often feel tracking branches are useless to me, because there are remote\n>> branches and I work on my private branch in most time.\n>>\n>>    repos\n>>      |\n>>      |-- my               (private branch, do my dirty work)\n>>      |-- master           (tracking branch)\n>>      |-- origin/master    (remote branch)\n> \n> Actually, origin/master is the \"[remote] tracking branch\". master is\n> just a branch that has config settings for \"git pull\" defaults. ;-)\n> \n> \"Remote branches\" are the actual branches on a remote repository.\n> \nOh, I'm misguided by the --track option, thank you for clarifying it!\n\n> In your case, you probably want:\n> git checkout -b my-stuff origin/master\n> git config branch.my-stuff.rebase true\n> \n> and then you can do:\n> git pull\n> \n> Instead of:\n> git fetch origin\n> git rebase origin/master\n> \n> You can also setup branch.autosetuprebase, to automatically get the\n> rebase setup, so you can skip the call to \"git config\" above.\nA new config setting, git amazes me again @_@\n\nIt's great, thanks!\n> \n> And you can just delete the \"master\" branch if you don't use it. There's\n> nothing that forces you to keep any branches around that you don't use.\n> But that doesn't affect the usefulness of tracking branches or branches\n> that have \"git pull\" defaults :-)\n> \n>> BTW: I feel the terminalogy \"remote branch\" is confused, because I must\n>> synchronize it with `git fetch`. I feel it's better to call it \"tracking\n>> branch\" // seems will lead to bigger confusion to experienced git users:-(\n> \n> See above, that's already the case ;-)\n> \n\nGot it, --rebase and config.<branch>.rebase and config.autosetuprebase, thank\nyou again:-)\n\n> Björn\n> \n"},{"id":"94178","messageId":"49084EB7.1000109@op5.se","threadId":"16079","inReplyTo":"49083957.2060702@gmail.com","subject":"Re: Do most people feel tracking branches useful?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-10-29T11:53:27Z","receivedAt":"2008-10-29T11:53:27Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Liu Yubao wrote:\n> Andreas Ericsson wrote:\n>> Liu Yubao wrote:\n>>\n>> Use \"git fetch\" instead of \"git pull\" and you won't need the 'my' branch.\n>> If you use \"git pull --rebase\" you won't need to bother at all.\n>>\n> Thank you very much, I didn't know the \"--rebase\" option, now I learn\n> the 'branch.<name>.rebase' configuration too by \"git help pull\".\n> \n> [...snip...]\n> \n>> I can't understand why you're working so hard for a linear history, but\n>> perhaps\n>> that's just an effect of only having leaf developers. I also can't\n>> understand\n> You got it exactly, we are leaf developers and make enhancement mostly,\n> we don't want the upstream branch full of merging commit for many\n> not so major changes. I remember keeping linear history is recommended\n> in git's documentation.\n> \n\nThat should probably be rephrased to \"Think before you merge\" or something\nlike that. Keeping history linear provides very little value in itself,\nbut mindlessly criss-cross-merging makes history difficul to review for\nno good reason. Any perceived value of mindless merging is quickly\nnullified once one starts looking at \"git rerere\".\n\nThe only time you'll run into problems with non-linear history is when\nyou're bisecting, and bisection ends up at a merge-commit where all the\nmerged branhces tips' pre-merge work flawlessly, but the merge-commit\nitself introduces breakage by erroneously resolving a conflict, or by\nintroducing changes of its own (git commit --amend, fe).\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"94179","messageId":"fc339e4a0810290629g57c6cec3idcbc4b1c1d5d0159@mail.gmail.com","threadId":"16079","inReplyTo":"490833AD.70806@gmail.com","subject":"Re: Do most people feel tracking branches useful?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2008-10-29T13:29:13Z","receivedAt":"2008-10-29T13:29:13Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"On Oct 29, 2008 6:58pm, Liu Yubao <yubao.liu@gmail.com> wrote:\n> > Extremely useful. I usually keep local branches closely synchronized\n> > with a remote \"central\" version, and tracking branches make the frequent\n> > push/pull much more convenient.\n>\n> In my work flow, I don't keep changes in local branch for long time,\n> I rebase it regularly and push them to central branch or discard them\n> if the upstream rejects.\n>\n> You are right, I realize tracking branches is useful for people who keeps\n> local changes for long time and track the upstream branch at the same\n> time.\n\nI don't keep local changes for a long time, I push daily. The local\ntracking branch and the corresponding remote branch are basically copies of\neach other, in different locations. I also do regularly rebasing, but\nagainst a _different_ remote branch.\n\nThere are never merge commits, because all merges done by pull are\nfast-forwards. If I were to push changes from multiple working directories\nto the central location, I'd have to be more careful about the pull-merging\n-- a rebase-on-pull as you suggest would be useful -- but I generally don't.\n\n-Miles\n-- \nDo not taunt Happy Fun Ball.\n"}]}