Skip to content

Commit 23e8673

Browse files
aeglJunio C Hamano
authored andcommitted
[PATCH] update howto/using-topic-branches.txt
Various updates and cleanups for my howto on using branches in GIT as a Linux subsystem maintainer. Three categories of changes: 1) Updates for new features in GIT 0.99.5 2) Changes to use "git fetch" rather than "git pull" to update local linus branch. 3) Cleanups suggested by Len Brown Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 248542e commit 23e8673

File tree

1 file changed

+45
-23
lines changed

1 file changed

+45
-23
lines changed

Documentation/howto/using-topic-branches.txt

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ Subject: Some tutorial text (was git/cogito workshop/bof at linuxconf au?)
55
Here's something that I've been putting together on how I'm using
66
GIT as a Linux subsystem maintainer.
77

8-
I suspect that I'm a bit slap-happy with the "git checkout" commands in
9-
the examples below, and perhaps missing some of the _true-git_ ways of
10-
doing things.
11-
128
-Tony
139

10+
Last updated w.r.t. GIT 0.99.5
11+
1412
Linux subsystem maintenance using GIT
1513
-------------------------------------
1614

@@ -48,24 +46,38 @@ Change directory into the cloned tree you just created
4846

4947
$ cd work
5048

51-
Make a GIT branch named "linus", and rename the "origin" branch as linus too:
49+
Set up a remotes file so that you can fetch the latest from Linus' master
50+
branch into a local branch named "linus":
51+
52+
$ cat > .git/remotes/linus
53+
URL: rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
54+
Pull: master:linus
55+
^D
5256

53-
$ git checkout -b linus
54-
$ mv .git/branches/origin .git/branches/linus
57+
and create the linus branch:
58+
59+
$ git branch linus
5560

5661
The "linus" branch will be used to track the upstream kernel. To update it,
5762
you simply run:
5863

59-
$ git checkout linus && git pull linus
64+
$ git fetch linus
65+
66+
you can do this frequently (and it should be safe to do so with pending
67+
work in your tree, but perhaps not if you are in mid-merge).
6068

61-
you can do this frequently (as long as you don't have any uncommited work
62-
in your tree).
69+
If you need to keep track of other public trees, you can add remote branches
70+
for them too:
6371

64-
If you need to keep track of other public trees, you can add branches for
65-
them too:
72+
$ git branch another
73+
$ cat > .git/remotes/another
74+
URL: ... insert URL here ...
75+
Pull: name-of-branch-in-this-remote-tree:another
76+
^D
6677

67-
$ git checkout -b another linus
68-
$ echo URL-for-another-public-tree > .git/branches/another
78+
and run:
79+
80+
$ git fetch another
6981

7082
Now create the branches in which you are going to work, these start
7183
out at the current tip of the linus branch.
@@ -78,15 +90,25 @@ These can be easily kept up to date by merging from the "linus" branch:
7890
$ git checkout test && git resolve test linus "Auto-update from upstream"
7991
$ git checkout release && git resolve release linus "Auto-update from upstream"
8092

81-
Set up so that you can push upstream to your public tree:
93+
Set up so that you can push upstream to your public tree (you need to
94+
log-in to the remote system and create an empty tree there before the
95+
first push).
8296

83-
$ echo master.kernel.org:/ftp/pub/scm/linux/kernel/git/aegl/linux-2.6.git > .git/branches/origin
97+
$ cat > .git/remotes/mytree
98+
URL: master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
99+
Push: release
100+
Push: test
101+
^D
84102

85-
and then push each of the test and release branches using:
103+
and the push both the test and release trees using:
86104

87-
$ git push origin test
88-
and
89-
$ git push origin release
105+
$ git push mytree
106+
107+
or push just one of the test and release branches using:
108+
109+
$ git push mytree test
110+
or
111+
$ git push mytree release
90112

91113
Now to apply some patches from the community. Think of a short
92114
snappy name for a branch to hold this patch (or related group of
@@ -169,9 +191,9 @@ test|release)
169191
git checkout $1 && git resolve $1 linus "Auto-update from upstream"
170192
;;
171193
linus)
172-
before=$(cat .git/HEAD)
173-
git checkout linus && git pull linus
174-
after=$(cat .git/HEAD)
194+
before=$(cat .git/refs/heads/linus)
195+
git fetch linus
196+
after=$(cat .git/refs/heads/linus)
175197
if [ $before != $after ]
176198
then
177199
git-whatchanged $after ^$before | git-shortlog

0 commit comments

Comments
 (0)