doc: modernise everyday.txt wording and format in man page style
Refresh the contents of everyday.txt contents to a more modern command style. Also update the mark-up so that it can be formatted as a man page with AsciiDoc ready for transfer to the Git guides. The transfer is in subsequent commits. Guidance on modernising the command style provided by Junio at [1], [2] and [3]. [1] Individual Developer, both Standalone and Participant http://article.gmane.org/gmane.comp.version-control.git/254269 [2] Integrator http://article.gmane.org/gmane.comp.version-control.git/254502 [3] Administrator http://article.gmane.org/gmane.comp.version-control.git/254824 Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philip Oakley committed
Oct 10, 2014 at 22:25 UTC
992cb20688033dfa3cf8ceff29ac655f1a0ad6d9
1 file changed
+151
-109
Documentation/everyday.txt
+151
-109
@@ -1,22 +1,37 @@
1
+giteveryday(7)
2
+===============
3
+
4
+NAME
5
+----
6
+giteveryday - A useful minimum set of commands for Everyday Git
7
+
8
+SYNOPSIS
9
+--------
10
+
11
Everyday Git With 20 Commands Or So
2
-===================================
12
4
-<<Individual Developer (Standalone)>> commands are essential for
5
-anybody who makes a commit, even for somebody who works alone.
13
+DESCRIPTION
14
+-----------
15
7
-If you work with other people, you will need commands listed in
8
-the <<Individual Developer (Participant)>> section as well.
16
+Git users can broadly be grouped into four categories for the purposes of
17
+describing here a small set of useful command for everyday Git.
18
10
-People who play the <<Integrator>> role need to learn some more
11
-commands in addition to the above.
19
+* <<STANDALONE,Individual Developer (Standalone)>> commands are essential
20
+ for anybody who makes a commit, even for somebody who works alone.
21
13
-<<Repository Administration>> commands are for system
14
-administrators who are responsible for the care and feeding
15
-of Git repositories.
22
+* If you work with other people, you will need commands listed in
23
+ the <<PARTICIPANT,Individual Developer (Participant)>> section as well.
24
25
+* People who play the <<INTEGRATOR,Integrator>> role need to learn some
26
+ more commands in addition to the above.
27
18
-Individual Developer (Standalone)[[Individual Developer (Standalone)]]
19
-----------------------------------------------------------------------
28
+* <<ADMINISTRATION,Repository Administration>> commands are for system
29
+ administrators who are responsible for the care and feeding
30
+ of Git repositories.
31
+
32
+
33
+Individual Developer (Standalone)[[STANDALONE]]
34
+-----------------------------------------------
35
36
A standalone individual developer does not exchange patches with
37
other people, and works alone in a single repository, using the
@@ -24,8 +39,6 @@ following commands.
39
40
* linkgit:git-init[1] to create a new repository.
41
27
- * linkgit:git-show-branch[1] to see where you are.
28
-
42
* linkgit:git-log[1] to see what happened.
43
44
* linkgit:git-checkout[1] and linkgit:git-branch[1] to switch
@@ -45,7 +58,7 @@ following commands.
58
59
* linkgit:git-rebase[1] to maintain topic branches.
60
48
- * linkgit:git-tag[1] to mark known point.
61
+ * linkgit:git-tag[1] to mark a known point.
62
63
Examples
64
~~~~~~~~
@@ -75,14 +88,12 @@ $ edit/compile/test
88
$ git diff HEAD <4>
89
$ git commit -a -s <5>
90
$ edit/compile/test
78
-$ git reset --soft HEAD^ <6>
79
-$ edit/compile/test
80
-$ git diff ORIG_HEAD <7>
81
-$ git commit -a -c ORIG_HEAD <8>
82
-$ git checkout master <9>
83
-$ git merge alsa-audio <10>
84
-$ git log --since='3 days ago' <11>
85
-$ git log v2.43.. curses/ <12>
91
+$ git diff HEAD^ <6>
92
+$ git commit -a --amend <7>
93
+$ git checkout master <8>
94
+$ git merge alsa-audio <9>
95
+$ git log --since='3 days ago' <10>
96
+$ git log v2.43.. curses/ <11>
97
------------
98
+
99
<1> create a new topic branch.
@@ -90,22 +101,21 @@ $ git log v2.43.. curses/ <12>
101
<3> you need to tell Git if you added a new file; removal and
102
modification will be caught if you do `git commit -a` later.
103
<4> to see what changes you are committing.
93
-<5> commit everything as you have tested, with your sign-off.
94
-<6> take the last commit back, keeping what is in the working tree.
95
-<7> look at the changes since the premature commit we took back.
96
-<8> redo the commit undone in the previous step, using the message
97
-you originally wrote.
98
-<9> switch to the master branch.
99
-<10> merge a topic branch into your master branch.
100
-<11> review commit logs; other forms to limit output can be
101
-combined and include `--max-count=10` (show 10 commits),
104
+<5> commit everything, as you have tested, with your sign-off.
105
+<6> look at all your changes including the previous commit.
106
+<7> amend the previous commit, adding all your new changes,
107
+using your original message.
108
+<8> switch to the master branch.
109
+<9> merge a topic branch into your master branch.
110
+<10> review commit logs; other forms to limit output can be
111
+combined and include `-10` (to show up to 10 commits),
112
`--until=2005-12-10`, etc.
103
-<12> view only the changes that touch what's in `curses/`
113
+<11> view only the changes that touch what's in `curses/`
114
directory, since `v2.43` tag.
115
116
107
-Individual Developer (Participant)[[Individual Developer (Participant)]]
108
-------------------------------------------------------------------------
117
+Individual Developer (Participant)[[PARTICIPANT]]
118
+-------------------------------------------------
119
120
A developer working as a participant in a group project needs to
121
learn how to communicate with others, and uses these commands in
@@ -123,6 +133,13 @@ addition to the ones needed by a standalone developer.
133
* linkgit:git-format-patch[1] to prepare e-mail submission, if
134
you adopt Linux kernel-style public forum workflow.
135
136
+ * linkgit:git-send-email[1] to send your e-mail submission without
137
+ corruption by your MUA.
138
+
139
+ * linkgit:git-request-pull[1] to create a summary of changes
140
+ for your upstream to pull.
141
+
142
+
143
Examples
144
~~~~~~~~
145
@@ -131,28 +148,34 @@ Clone the upstream and work on it. Feed changes to upstream.::
148
------------
149
$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
150
$ cd my2.6
134
-$ edit/compile/test; git commit -a -s <1>
135
-$ git format-patch origin <2>
136
-$ git pull <3>
137
-$ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <4>
138
-$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <5>
139
-$ git reset --hard ORIG_HEAD <6>
140
-$ git gc <7>
141
-$ git fetch --tags <8>
151
+$ git checkout -b mine master <1>
152
+$ edit/compile/test; git commit -a -s <2>
153
+$ git format-patch master <3>
154
+$ git send-email --to="person <email@example.com>" 00*.patch <4>
155
+$ git checkout master <5>
156
+$ git pull <6>
157
+$ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <7>
158
+$ git ls-remote --heads http://git.kernel.org/.../jgarzik/libata-dev.git <8>
159
+$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <9>
160
+$ git reset --hard ORIG_HEAD <10>
161
+$ git gc <11>
162
------------
163
+
144
-<1> repeat as needed.
145
-<2> extract patches from your branch for e-mail submission.
146
-<3> `git pull` fetches from `origin` by default and merges into the
164
+<1> checkout a new branch `mine` from master.
165
+<2> repeat as needed.
166
+<3> extract patches from your branch, relative to master,
167
+<4> and email them.
168
+<5> return to `master`, ready to see what's new
169
+<6> `git pull` fetches from `origin` by default and merges into the
170
current branch.
148
-<4> immediately after pulling, look at the changes done upstream
171
+<7> immediately after pulling, look at the changes done upstream
172
since last time we checked, only in the
173
area we are interested in.
151
-<5> fetch from a specific branch from a specific repository and merge.
152
-<6> revert the pull.
153
-<7> garbage collect leftover objects from reverted pull.
154
-<8> from time to time, obtain official tags from the `origin`
155
-and store them under `.git/refs/tags/`.
174
+<8> check the branch names in an external repository (if not known).
175
+<9> fetch from a specific branch `ALL` from a specific repository
176
+and merge it.
177
+<10> revert the pull.
178
+<11> garbage collect leftover objects from reverted pull.
179
180
181
Push into another repository.::
@@ -166,7 +189,7 @@ remote.origin.fetch refs/heads/*:refs/remotes/origin/*
189
branch.master.remote origin
190
branch.master.merge refs/heads/master
191
satellite$ git config remote.origin.push \
169
- master:refs/remotes/satellite/master <3>
192
+ +refs/heads/*:refs/remotes/satellite/* <3>
193
satellite$ edit/compile/test/commit
194
satellite$ git push origin <4>
195
@@ -181,11 +204,12 @@ machine.
204
<2> clone sets these configuration variables by default.
205
It arranges `git pull` to fetch and store the branches of mothership
206
machine to local `remotes/origin/*` remote-tracking branches.
184
-<3> arrange `git push` to push local `master` branch to
185
-`remotes/satellite/master` branch of the mothership machine.
186
-<4> push will stash our work away on `remotes/satellite/master`
187
-remote-tracking branch on the mothership machine. You could use this
188
-as a back-up method.
207
+<3> arrange `git push` to push all local branches to
208
+their corresponding branch of the mothership machine.
209
+<4> push will stash all our work away on `remotes/satellite/*`
210
+remote-tracking branches on the mothership machine. You could use this
211
+as a back-up method. Likewise, you can pretend that mothership
212
+"fetched" from you (useful when access is one sided).
213
<5> on mothership machine, merge the work done on the satellite
214
machine into the master branch.
215
@@ -195,17 +219,22 @@ Branch off of a specific tag.::
219
$ git checkout -b private2.6.14 v2.6.14 <1>
220
$ edit/compile/test; git commit -a
221
$ git checkout master
198
-$ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
199
- git am -3 -k <2>
222
+$ git cherry-pick v2.6.14..private2.6.14 <2>
223
------------
224
+
225
<1> create a private branch based on a well known (but somewhat behind)
226
tag.
227
<2> forward port all changes in `private2.6.14` branch to `master` branch
205
-without a formal "merging".
228
+without a formal "merging". Or longhand +
229
+`git format-patch -k -m --stdout v2.6.14..private2.6.14 |
230
+ git am -3 -k`
231
232
+An alternate participant submission mechanism is using the
233
+`git request-pull` or pull-request mechanisms (e.g as used on
234
+GitHub (www.github.com) to notify your upstream of your
235
+contribution.
236
208
-Integrator[[Integrator]]
237
+Integrator[[INTEGRATOR]]
238
------------------------
239
240
A fairly central person acting as the integrator in a group
@@ -213,6 +242,13 @@ project receives changes made by others, reviews and integrates
242
them and publishes the result for others to use, using these
243
commands in addition to the ones needed by participants.
244
245
+This section can also be used by those who respond to `git
246
+request-pull` or pull-request on GitHub (www.github.com) to
247
+integrate the work of others into their history. An sub-area
248
+lieutenant for a repository will act both as a participant and
249
+as an integrator.
250
+
251
+
252
* linkgit:git-am[1] to apply patches e-mailed in from your
253
contributors.
254
@@ -229,19 +265,19 @@ commands in addition to the ones needed by participants.
265
Examples
266
~~~~~~~~
267
232
-My typical Git day.::
268
+A typical integrator's Git day.::
269
+
270
------------
271
$ git status <1>
236
-$ git show-branch <2>
272
+$ git branch --no-merged master <2>
273
$ mailx <3>
274
& s 2 3 4 5 ./+to-apply
275
& s 7 8 ./+hold-linus
276
& q
277
$ git checkout -b topic/one master
242
-$ git am -3 -i -s -u ./+to-apply <4>
278
+$ git am -3 -i -s ./+to-apply <4>
279
$ compile/test
244
-$ git checkout -b hold/linus && git am -3 -i -s -u ./+hold-linus <5>
280
+$ git checkout -b hold/linus && git am -3 -i -s ./+hold-linus <5>
281
$ git checkout topic/one && git rebase master <6>
282
$ git checkout pu && git reset --hard next <7>
283
$ git merge topic/one topic/two && git merge hold/linus <8>
@@ -249,51 +285,51 @@ $ git checkout maint
285
$ git cherry-pick master~4 <9>
286
$ compile/test
287
$ git tag -s -m "GIT 0.99.9x" v0.99.9x <10>
252
-$ git fetch ko && git show-branch master maint 'tags/ko-*' <11>
253
-$ git push ko <12>
254
-$ git push ko v0.99.9x <13>
288
+$ git fetch ko && for branch in master maint next pu <11>
289
+ do
290
+ git show-branch ko/$branch $branch <12>
291
+ done
292
+$ git push --follow-tags ko <13>
293
------------
294
+
257
-<1> see what I was in the middle of doing, if any.
258
-<2> see what topic branches I have and think about how ready
259
-they are.
295
+<1> see what you were in the middle of doing, if anything.
296
+<2> see which branches haven't been merged into `master` yet.
297
+Likewise for any other integration branches e.g. `maint`, `next`
298
+and `pu` (potential updates).
299
<3> read mails, save ones that are applicable, and save others
261
-that are not quite ready.
262
-<4> apply them, interactively, with my sign-offs.
263
-<5> create topic branch as needed and apply, again with my
264
-sign-offs.
300
+that are not quite ready (other mail readers are available).
301
+<4> apply them, interactively, with your sign-offs.
302
+<5> create topic branch as needed and apply, again with sign-offs.
303
<6> rebase internal topic branch that has not been merged to the
304
master or exposed as a part of a stable branch.
305
<7> restart `pu` every time from the next.
306
<8> and bundle topic branches still cooking.
307
<9> backport a critical fix.
308
<10> create a signed tag.
271
-<11> make sure I did not accidentally rewind master beyond what I
272
-already pushed out. `ko` shorthand points at the repository I have
273
-at kernel.org, and looks like this:
309
+<11> make sure master was not accidentally rewound beyond that
310
+already pushed out. `ko` shorthand points at the Git maintainer's
311
+repository at kernel.org, and looks like this:
312
+
313
------------
276
-$ cat .git/remotes/ko
277
-URL: kernel.org:/pub/scm/git/git.git
278
-Pull: master:refs/tags/ko-master
279
-Pull: next:refs/tags/ko-next
280
-Pull: maint:refs/tags/ko-maint
281
-Push: master
282
-Push: next
283
-Push: +pu
284
-Push: maint
314
+(in .git/config)
315
+[remote "ko"]
316
+ url = kernel.org:/pub/scm/git/git.git
317
+ fetch = refs/heads/*:refs/remotes/ko/*
318
+ push = refs/heads/master
319
+ push = refs/heads/next
320
+ push = +refs/heads/pu
321
+ push = refs/heads/maint
322
------------
323
+
287
-In the output from `git show-branch`, `master` should have
288
-everything `ko-master` has, and `next` should have
289
-everything `ko-next` has.
290
-
291
-<12> push out the bleeding edge.
292
-<13> push the tag out, too.
324
+<12> In the output from `git show-branch`, `master` should have
325
+everything `ko/master` has, and `next` should have
326
+everything `ko/next` has, etc.
327
+<13> push out the bleeding edge, together with new tags that point
328
+into the pushed history.
329
330
295
-Repository Administration[[Repository Administration]]
296
-------------------------------------------------------
331
+Repository Administration[[ADMINISTRATION]]
332
+-------------------------------------------
333
334
A repository administrator uses the following tools to set up
335
and maintain access to the repository by developers.
@@ -304,9 +340,19 @@ and maintain access to the repository by developers.
340
* linkgit:git-shell[1] can be used as a 'restricted login shell'
341
for shared central repository users.
342
343
+ * linkgit:git-http-backend[1] provides a server side implementation
344
+ of Git-over-HTTP ("Smart http") allowing both fetch and push services.
345
+
346
+ * linkgit:gitweb[1] provides a web front-end to Git repositories,
347
+ which can be set-up using the linkgit:git-instaweb[1] script.
348
+
349
link:howto/update-hook-example.html[update hook howto] has a good
350
example of managing a shared central repository.
351
352
+In addition there are a number of other widely deployed hosting, browsing
353
+and reviewing solutions such as:
354
+
355
+ * gitolite, gerrit code review, cgit and others.
356
357
Examples
358
~~~~~~~~
@@ -350,7 +396,10 @@ service git
396
Check your xinetd(8) documentation and setup, this is from a Fedora system.
397
Others might be different.
398
353
-Give push/pull only access to developers.::
399
+Give push/pull only access to developers using git-over-ssh.::
400
+
401
+e.g. those using:
402
+`$ git push/pull ssh://host.xz/pub/scm/project`
403
+
404
------------
405
$ grep git /etc/passwd <1>
@@ -363,8 +412,8 @@ $ grep git /etc/shells <2>
412
------------
413
+
414
<1> log-in shell is set to /usr/bin/git-shell, which does not
366
-allow anything but `git push` and `git pull`. The users should
367
-get an ssh access to the machine.
415
+allow anything but `git push` and `git pull`. The users require
416
+ssh access to the machine.
417
<2> in many distributions /etc/shells needs to list what is used
418
as the login shell.
419
@@ -401,13 +450,6 @@ for branch policy control.
450
david is the release manager and is the only person who can
451
create and push version tags.
452
404
-HTTP server to support dumb protocol transfer.::
405
-+
406
-------------
407
-dev$ git update-server-info <1>
408
-dev$ ftp user@isp.example.com <2>
409
-ftp> cp -r .git /home/user/myproject.git
410
-------------
411
-+
412
-<1> make sure your info/refs and objects/info/packs are up-to-date
413
-<2> upload to public HTTP server hosted by your ISP.
453
+GIT
454
+---
455
+Part of the linkgit:git[1] suite