{"thread":{"id":"1649","subject":"[PATCH] update howto/using-topic-branches.txt","startedAt":"2005-08-26T05:11:08Z","lastAt":"2005-08-26T05:11:08Z","messageCount":1,"participants":["tony.luck@intel.com"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7768","messageId":"200508260511.j7Q5B83A021367@agluck-lia64.sc.intel.com","threadId":"1649","inReplyTo":null,"subject":"[PATCH] update howto/using-topic-branches.txt","fromName":"","fromEmail":"tony.luck@intel.com","sentAt":"2005-08-26T05:11:08Z","receivedAt":"2005-08-26T05:11:08Z","isPatch":true,"sender":{"key":"tony.luck@intel.com","avatar":"https://avatars.githubusercontent.com/u/5446021?v=4"},"body":"Various updates and cleanups for my howto on using branches in GIT\nas a Linux subsystem maintainer.  Three categories of changes:\n1) Updates for new features in GIT 0.99.5\n2) Changes to use \"git fetch\" rather than \"git pull\" to update local linus branch.\n3) Cleanups suggested by Len Brown\n\nSigned-off-by: Tony Luck <tony.luck@intel.com>\n\n---\n\ndiff --git a/Documentation/howto/using-topic-branches.txt b/Documentation/howto/using-topic-branches.txt\n--- a/Documentation/howto/using-topic-branches.txt\n+++ b/Documentation/howto/using-topic-branches.txt\n@@ -5,12 +5,10 @@ Subject: Some tutorial text (was git/cog\n Here's something that I've been putting together on how I'm using\n GIT as a Linux subsystem maintainer.\n \n-I suspect that I'm a bit slap-happy with the \"git checkout\" commands in\n-the examples below, and perhaps missing some of the _true-git_ ways of\n-doing things.\n-\n -Tony\n \n+Last updated w.r.t. GIT 0.99.5\n+\n Linux subsystem maintenance using GIT\n -------------------------------------\n \n@@ -48,24 +46,38 @@ Change directory into the cloned tree yo\n \n  $ cd work\n \n-Make a GIT branch named \"linus\", and rename the \"origin\" branch as linus too:\n+Set up a remotes file so that you can fetch the latest from Linus' master\n+branch into a local branch named \"linus\":\n+\n+ $ cat > .git/remotes/linus\n+ URL: rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n+ Pull: master:linus\n+ ^D\n \n- $ git checkout -b linus\n- $ mv .git/branches/origin .git/branches/linus\n+and create the linus branch:\n+\n+ $ git branch linus\n \n The \"linus\" branch will be used to track the upstream kernel.  To update it,\n you simply run:\n \n- $ git checkout linus && git pull linus\n+ $ git fetch linus\n+\n+you can do this frequently (and it should be safe to do so with pending\n+work in your tree, but perhaps not if you are in mid-merge).\n \n-you can do this frequently (as long as you don't have any uncommited work\n-in your tree).\n+If you need to keep track of other public trees, you can add remote branches\n+for them too:\n \n-If you need to keep track of other public trees, you can add branches for\n-them too:\n+ $ git branch another\n+ $ cat > .git/remotes/another\n+ URL: ... insert URL here ...\n+ Pull: name-of-branch-in-this-remote-tree:another\n+ ^D\n \n- $ git checkout -b another linus\n- $ echo URL-for-another-public-tree > .git/branches/another\n+and run:\n+\n+ $ git fetch another\n \n Now create the branches in which you are going to work, these start\n out at the current tip of the linus branch.\n@@ -78,15 +90,25 @@ These can be easily kept up to date by m\n  $ git checkout test && git resolve test linus \"Auto-update from upstream\"\n  $ git checkout release && git resolve release linus \"Auto-update from upstream\"\n \n-Set up so that you can push upstream to your public tree:\n+Set up so that you can push upstream to your public tree (you need to\n+log-in to the remote system and create an empty tree there before the\n+first push).\n \n- $ echo master.kernel.org:/ftp/pub/scm/linux/kernel/git/aegl/linux-2.6.git > .git/branches/origin\n+ $ cat > .git/remotes/mytree\n+ URL: master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git\n+ Push: release\n+ Push: test\n+ ^D\n \n-and then push each of the test and release branches using:\n+and the push both the test and release trees using:\n \n- $ git push origin test\n-and\n- $ git push origin release\n+ $ git push mytree\n+\n+or push just one of the test and release branches using:\n+\n+ $ git push mytree test\n+or\n+ $ git push mytree release\n \n Now to apply some patches from the community.  Think of a short\n snappy name for a branch to hold this patch (or related group of\n@@ -169,9 +191,9 @@ test|release)\n \tgit checkout $1 && git resolve $1 linus \"Auto-update from upstream\"\n \t;;\n linus)\n-\tbefore=$(cat .git/HEAD)\n-\tgit checkout linus && git pull linus\n-\tafter=$(cat .git/HEAD)\n+\tbefore=$(cat .git/refs/heads/linus)\n+\tgit fetch linus\n+\tafter=$(cat .git/refs/heads/linus)\n \tif [ $before != $after ]\n \tthen\n \t\tgit-whatchanged $after ^$before | git-shortlog\n"}]}