@matheusbsbs / matheus-bagliano / commits / 44db136cad
Fork 0

Everyday: some examples.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Dec 12, 2005 at 16:20 UTC 44db136cad84c003506e231a38935ca6acba4d7d
1 file changed +68 -4
Documentation/everyday.txt
+68 -4
@@ -59,9 +59,6 @@ following commands.
59
60 * gitlink:git-show-branch[1] to see where you are.
61
62 - * gitlink:git-diff[1] and gitlink:git-status[1] to see what
63 - you are in the middle of doing.
64 -
62 * gitlink:git-log[1] to see what happened.
63
64 * gitlink:git-whatchanged[1] to find out where things have
@@ -70,7 +67,11 @@ following commands.
67 * gitlink:git-checkout[1] and gitlink:git-branch[1] to switch
68 branches.
69
73 - * gitlink:git-update-index[1] to manage the index file.
70 + * gitlink:git-add[1] and gitlink:git-update-index[1] to manage
71 + the index file.
72 +
73 + * gitlink:git-diff[1] and gitlink:git-status[1] to see what
74 + you are in the middle of doing.
75
76 * gitlink:git-commit[1] to advance the current branch.
77
@@ -83,6 +84,37 @@ following commands.
84 * gitlink:git-rebase[1] to maintain topic branches.
85
86
87 +Examples
88 +~~~~~~~~
89 +
90 +* Extract a tarball and create a working tree and a new repository to keep track of it.
91 +------------
92 +$ tar zxf frotz.tar.gz
93 +$ cd frotz
94 +$ git-init-db
95 +$ git add .
96 +$ git commit -m 'import of frotz source tree.'
97 +------------
98 +
99 +* Create a topic branch and develop
100 +------------
101 +$ git checkout -b private
102 +$ edit/compile/test
103 +$ git diff <1>
104 +$ git checkout -- foo.c <2>
105 +$ edit/compile/test
106 +$ git commit -a -s <3>
107 +$ git checkout master <4>
108 +$ git pull . private <5>
109 +
110 +<1> to see what changes you are committing.
111 +<2> revert your botched changes in selected path "foo.c".
112 +<3> commit everything as you have tested.
113 +<4> switch to the master branch.
114 +<5> merge a topic branch into your master branch
115 +------------
116 +
117 +
118 Individual Developer (Participant)[[Individual Developer (Participant)]]
119 ------------------------------------------------------------------------
120
@@ -100,6 +132,38 @@ addition to the ones needed by a standalone developer.
132 you adopt Linux kernel-style public forum workflow.
133
134
135 +Examples
136 +~~~~~~~~
137 +
138 +* Clone the upstream and work on it. Feed changes to upstream.
139 +------------
140 +$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
141 +$ cd my2.6
142 +$ edit/compile/test; git commit -a -s <1>
143 +$ git format-patch master <2>
144 +$ git pull <3>
145 +$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <4>
146 +
147 +<1> repeat as needed.
148 +<2> extract patches from your branch for e-mail submission.
149 +<3> "pull" fetches from "origin" by default and merges.
150 +<4> fetch from a specific branch from a specific repository and and merge.
151 +------------
152 +
153 +* Branch off of a specific tag.
154 +------------
155 +$ git checkout -b private2.6.14 v2.6.14 <1>
156 +$ edit/compile/test; git commit -a
157 +$ git checkout master
158 +$ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
159 + git am -3 -k <2>
160 +<1> create a private branch based on a well known (but somewhat behind)
161 +tag.
162 +<2> forward port all changes in private2.6.14 branch to master
163 +branch without formal "merging".
164 +------------
165 +
166 +
167 Integrator[[Integrator]]
168 ------------------------
169