{"thread":{"id":"1574","subject":"[PATCH] updates for Documentation/howto/using-topic-branches.txt","startedAt":"2005-08-18T16:42:56Z","lastAt":"2005-08-18T16:42:56Z","messageCount":1,"participants":["Luck, Tony"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7510","messageId":"200508181642.j7IGguq3008139@agluck-lia64.sc.intel.com","threadId":"1574","inReplyTo":null,"subject":"[PATCH] updates for Documentation/howto/using-topic-branches.txt","fromName":"Luck, Tony","fromEmail":"tony.luck@intel.com","sentAt":"2005-08-18T16:42:56Z","receivedAt":"2005-08-18T16:42:56Z","isPatch":true,"sender":{"key":"tony.luck@intel.com","avatar":"https://avatars.githubusercontent.com/u/5446021?v=4"},"body":"Small fix (use \"git branch\" to make branches, rather than \"git checkout -b\").\n\nOptimization for trivial patches (apply to release and merge to test).\n\nThree sample scripts appended.\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@@ -70,8 +70,8 @@ them too:\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 \n- $ git checkout -b test linus\n- $ git checkout -b release linus\n+ $ git branch test linus\n+ $ git branch release linus\n \n These can be easily kept up to date by merging from the \"linus\" branch:\n \n@@ -144,6 +144,11 @@ is empty.  At this point the branch can \n \n  $ rm .git/refs/heads/branchname\n \n+Some changes are so trivial that it is not necessary to create a separate\n+branch and then merge into each of the test and release branches.  For\n+these changes, just apply directly to the \"release\" branch, and then\n+merge that into the \"test\" branch.\n+\n To create diffstat and shortlog summaries of changes to include in a \"please\n pull\" request to Linus you can use:\n \n@@ -151,3 +156,109 @@ pull\" request to Linus you can use:\n and\n  $ git-whatchanged release ^linus | git-shortlog\n \n+\n+Here are some of the scripts that I use to simplify all this even further.\n+\n+==== update script ====\n+# Update a branch in my GIT tree.  If the branch to be updated\n+# is \"linus\", then pull from kernel.org.  Otherwise merge local\n+# linus branch into test|release branch\n+\n+case \"$1\" in\n+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+\tif [ $before != $after ]\n+\tthen\n+\t\tgit-whatchanged $after ^$before | git-shortlog\n+\tfi\n+\t;;\n+*)\n+\techo \"Usage: $0 linus|test|release\" 1>&2\n+\texit 1\n+\t;;\n+esac\n+\n+==== merge script ====\n+# Merge a branch into either the test or release branch\n+\n+pname=$0\n+\n+usage()\n+{\n+\techo \"Usage: $pname branch test|release\" 1>&2\n+\texit 1\n+}\n+\n+if [ ! -f .git/refs/heads/\"$1\" ]\n+then\n+\techo \"Can't see branch <$1>\" 1>&2\n+\tusage\n+fi\n+\n+case \"$2\" in\n+test|release)\n+\tif [ $(git-rev-list $1 ^$2 | wc -c) -eq 0 ]\n+\tthen\n+\t\techo $1 already merged into $2 1>&2\n+\t\texit 1\n+\tfi\n+\tgit checkout $2 && git resolve $2 $1 \"Pull $1 into $2 branch\"\n+\t;;\n+*)\n+\tusage\n+\t;;\n+esac\n+\n+==== status script ====\n+# report on status of my ia64 GIT tree\n+\n+gb=$(tput setab 2)\n+rb=$(tput setab 1)\n+restore=$(tput setab 9)\n+\n+if [ `git-rev-tree release ^test | wc -c` -gt 0 ]\n+then\n+\techo $rb Warning: commits in release that are not in test $restore\n+\tgit-whatchanged release ^test\n+fi\n+\n+for branch in `ls .git/refs/heads`\n+do\n+\tif [ $branch = linus -o $branch = test -o $branch = release ]\n+\tthen\n+\t\tcontinue\n+\tfi\n+\n+\techo -n $gb ======= $branch ====== $restore \" \"\n+\tstatus=\n+\tfor ref in test release linus\n+\tdo\n+\t\tif [ `git-rev-tree $branch ^$ref | wc -c` -gt 0 ]\n+\t\tthen\n+\t\t\tstatus=$status${ref:0:1}\n+\t\tfi\n+\tdone\n+\tcase $status in\n+\ttrl)\n+\t\techo $rb Need to pull into test $restore\n+\t\t;;\n+\trl)\n+\t\techo \"In test\"\n+\t\t;;\n+\tl)\n+\t\techo \"Waiting for linus\"\n+\t\t;;\n+\t\"\")\n+\t\techo $rb All done $restore\n+\t\t;;\n+\t*)\n+\t\techo $rb \"<$status>\" $restore\n+\t\t;;\n+\tesac\n+\tgit-whatchanged $branch ^linus | git-shortlog\n+done\n"}]}