@matheusbsbs / matheus-bagliano / commits / 180c474647
Fork 0

Everyday: a bit more example.

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

Junio C Hamano committed Dec 12, 2005 at 18:29 UTC 180c4746479892a9e58918b0d45f89911cb48716
1 file changed +93 -17
Documentation/everyday.txt
+93 -17
@@ -83,6 +83,7 @@ following commands.
83
84 * gitlink:git-rebase[1] to maintain topic branches.
85
86 + * gitlink:git-tag[1] to mark known point.
87
88 Examples
89 ~~~~~~~~
@@ -92,26 +93,48 @@ Examples
93 $ tar zxf frotz.tar.gz
94 $ cd frotz
95 $ git-init-db
95 -$ git add .
96 +$ git add . <1>
97 $ git commit -m 'import of frotz source tree.'
98 +$ git tag v2.43 <2>
99 +
100 +<1> add everything under the current directory.
101 +<2> make a lightweight, unannotated tag.
102 ------------
103
104 * Create a topic branch and develop
105 ------------
101 -$ git checkout -b private
106 +$ git checkout -b alsa-audio <1>
107 +$ edit/compile/test
108 +$ git checkout -- curses/ux_audio_oss.c <2>
109 +$ git add curses/ux_audio_alsa.c <3>
110 +$ edit/compile/test
111 +$ git diff <4>
112 +$ git commit -a -s <5>
113 $ edit/compile/test
103 -$ git diff <1>
104 -$ git checkout -- foo.c <2>
114 +$ git reset --soft HEAD^ <6>
115 $ 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
116 +$ git diff ORIG_HEAD <7>
117 +$ git commit -a -c ORIG_HEAD <8>
118 +$ git checkout master <9>
119 +$ git pull . alsa-audio <10>
120 +$ git log --since='3 days ago' <11>
121 +$ git log v2.43.. curses/ <12>
122 +
123 +<1> create a new topic branch.
124 +<2> revert your botched changes in "curses/ux_audio_oss.c".
125 +<3> you need to tell git if you added a new file; removal and
126 +modification will be caught if you do "commit -a" later.
127 +<4> to see what changes you are committing.
128 +<5> commit everything as you have tested, with your sign-off.
129 +<6> take the last commit back, keeping what is in the working tree.
130 +<7> look at the changes since the premature commit we took back.
131 +<8> redo the commit undone in the previous step, using the message
132 +you originally wrote.
133 +<9> switch to the master branch.
134 +<10> merge a topic branch into your master branch
135 +<11> or --since='aug 1', --max-count=10
136 +<12> view only the changes that touch what's in curses/
137 +directory, since v2.43 tag.
138 ------------
139
140
@@ -142,12 +165,19 @@ $ cd my2.6
165 $ edit/compile/test; git commit -a -s <1>
166 $ git format-patch master <2>
167 $ git pull <3>
145 -$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <4>
168 +$ git whatchanged -p ORIG_HEAD.. arch/i386 include/asm-i386 <4>
169 +$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5>
170 +$ git reset --hard ORIG_HEAD <6>
171 +$ git prune <7>
172
173 <1> repeat as needed.
174 <2> extract patches from your branch for e-mail submission.
175 <3> "pull" fetches from "origin" by default and merges.
150 -<4> fetch from a specific branch from a specific repository and and merge.
176 +<4> look at the changes since last time we checked, only in the
177 +area we are interested in.
178 +<5> fetch from a specific branch from a specific repository and and merge.
179 +<6> revert the pull.
180 +<7> garbage collect leftover objects from reverted pull.
181 ------------
182
183 * Branch off of a specific tag.
@@ -157,10 +187,11 @@ $ edit/compile/test; git commit -a
187 $ git checkout master
188 $ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
189 git am -3 -k <2>
190 +
191 <1> create a private branch based on a well known (but somewhat behind)
192 tag.
162 -<2> forward port all changes in private2.6.14 branch to master
163 -branch without formal "merging".
193 +<2> forward port all changes in private2.6.14 branch to master branch
194 +without a formal "merging".
195 ------------
196
197
@@ -185,6 +216,51 @@ commands in addition to the ones needed by participants.
216 * gitlink:git-push[1] to publish the bleeding edge.
217
218
219 +Examples
220 +~~~~~~~~
221 +
222 +* My typical GIT day.
223 +------------
224 +$ git status <1>
225 +$ git show-branch <2>
226 +$ mailx <3>
227 +& s 2 3 4 5 ./+to-apply
228 +& s 7 8 ./+hold-linus
229 +& q
230 +$ git checkout master
231 +$ git am -3 -i -s -u ./+to-apply <4>
232 +$ compile/test
233 +$ git checkout -b hold/linus && git am -3 -i -s -u ./+hold-linus <5>
234 +$ git checkout pu && git reset --hard master <6>
235 +$ git pull . topic/one topic/two && git pull . hold/linus <7>
236 +$ git fetch ko master:refs/tags/ko-master &&
237 + git show-branch master ko-master <8>
238 +$ git push ko <9>
239 +$ git checkout maint
240 +$ git cherry-pick master~4 <10>
241 +$ compile/test
242 +$ git tag -s -m 'GIT 0.99.9x' v0.99.9x <11>
243 +$ git push ko v0.99.9x <12>
244 +
245 +<1> see what I was in the middle of doing, if any.
246 +<2> see what topic branches I have and think about how ready
247 +they are.
248 +<3> read mails, save ones that are applicable, and save others
249 +that are not quite ready.
250 +<4> apply them, interactively, with my sign-offs.
251 +<5> create topic branch as needed and apply, again with my
252 +sign-offs.
253 +<6> restart "pu" every time from the master.
254 +<7> and bundle topic branches still cooking.
255 +<8> make sure I did not accidentally rewound master beyond what I
256 +already pushed out.
257 +<9> push out the bleeding edge.
258 +<10> backport a critical fix.
259 +<11> create a signed tag.
260 +<12> push the tag out.
261 +------------
262 +
263 +
264 Repository Administration[[Repository Administration]]
265 ------------------------------------------------------
266