logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

giteveryday.7 (20552B)


  1. '\" t
  2. .\" Title: giteveryday
  3. .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
  5. .\" Date: 2025-03-14
  6. .\" Manual: Git Manual
  7. .\" Source: Git 2.49.0
  8. .\" Language: English
  9. .\"
  10. .TH "GITEVERYDAY" "7" "2025-03-14" "Git 2\&.49\&.0" "Git Manual"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. giteveryday \- A useful minimum set of commands for Everyday Git
  32. .SH "SYNOPSIS"
  33. .sp
  34. Everyday Git With 20 Commands Or So
  35. .SH "DESCRIPTION"
  36. .sp
  37. Git users can broadly be grouped into four categories for the purposes of describing here a small set of useful commands for everyday Git\&.
  38. .sp
  39. .RS 4
  40. .ie n \{\
  41. \h'-04'\(bu\h'+03'\c
  42. .\}
  43. .el \{\
  44. .sp -1
  45. .IP \(bu 2.3
  46. .\}
  47. Individual Developer (Standalone)
  48. commands are essential for anybody who makes a commit, even for somebody who works alone\&.
  49. .RE
  50. .sp
  51. .RS 4
  52. .ie n \{\
  53. \h'-04'\(bu\h'+03'\c
  54. .\}
  55. .el \{\
  56. .sp -1
  57. .IP \(bu 2.3
  58. .\}
  59. If you work with other people, you will need commands listed in the
  60. Individual Developer (Participant)
  61. section as well\&.
  62. .RE
  63. .sp
  64. .RS 4
  65. .ie n \{\
  66. \h'-04'\(bu\h'+03'\c
  67. .\}
  68. .el \{\
  69. .sp -1
  70. .IP \(bu 2.3
  71. .\}
  72. People who play the
  73. Integrator
  74. role need to learn some more commands in addition to the above\&.
  75. .RE
  76. .sp
  77. .RS 4
  78. .ie n \{\
  79. \h'-04'\(bu\h'+03'\c
  80. .\}
  81. .el \{\
  82. .sp -1
  83. .IP \(bu 2.3
  84. .\}
  85. Repository Administration
  86. commands are for system administrators who are responsible for the care and feeding of Git repositories\&.
  87. .RE
  88. .SH "INDIVIDUAL DEVELOPER (STANDALONE)"
  89. .sp
  90. A standalone individual developer does not exchange patches with other people, and works alone in a single repository, using the following commands\&.
  91. .sp
  92. .RS 4
  93. .ie n \{\
  94. \h'-04'\(bu\h'+03'\c
  95. .\}
  96. .el \{\
  97. .sp -1
  98. .IP \(bu 2.3
  99. .\}
  100. \fBgit-init\fR(1)
  101. to create a new repository\&.
  102. .RE
  103. .sp
  104. .RS 4
  105. .ie n \{\
  106. \h'-04'\(bu\h'+03'\c
  107. .\}
  108. .el \{\
  109. .sp -1
  110. .IP \(bu 2.3
  111. .\}
  112. \fBgit-log\fR(1)
  113. to see what happened\&.
  114. .RE
  115. .sp
  116. .RS 4
  117. .ie n \{\
  118. \h'-04'\(bu\h'+03'\c
  119. .\}
  120. .el \{\
  121. .sp -1
  122. .IP \(bu 2.3
  123. .\}
  124. \fBgit-switch\fR(1)
  125. and
  126. \fBgit-branch\fR(1)
  127. to switch branches\&.
  128. .RE
  129. .sp
  130. .RS 4
  131. .ie n \{\
  132. \h'-04'\(bu\h'+03'\c
  133. .\}
  134. .el \{\
  135. .sp -1
  136. .IP \(bu 2.3
  137. .\}
  138. \fBgit-add\fR(1)
  139. to manage the index file\&.
  140. .RE
  141. .sp
  142. .RS 4
  143. .ie n \{\
  144. \h'-04'\(bu\h'+03'\c
  145. .\}
  146. .el \{\
  147. .sp -1
  148. .IP \(bu 2.3
  149. .\}
  150. \fBgit-diff\fR(1)
  151. and
  152. \fBgit-status\fR(1)
  153. to see what you are in the middle of doing\&.
  154. .RE
  155. .sp
  156. .RS 4
  157. .ie n \{\
  158. \h'-04'\(bu\h'+03'\c
  159. .\}
  160. .el \{\
  161. .sp -1
  162. .IP \(bu 2.3
  163. .\}
  164. \fBgit-commit\fR(1)
  165. to advance the current branch\&.
  166. .RE
  167. .sp
  168. .RS 4
  169. .ie n \{\
  170. \h'-04'\(bu\h'+03'\c
  171. .\}
  172. .el \{\
  173. .sp -1
  174. .IP \(bu 2.3
  175. .\}
  176. \fBgit-restore\fR(1)
  177. to undo changes\&.
  178. .RE
  179. .sp
  180. .RS 4
  181. .ie n \{\
  182. \h'-04'\(bu\h'+03'\c
  183. .\}
  184. .el \{\
  185. .sp -1
  186. .IP \(bu 2.3
  187. .\}
  188. \fBgit-merge\fR(1)
  189. to merge between local branches\&.
  190. .RE
  191. .sp
  192. .RS 4
  193. .ie n \{\
  194. \h'-04'\(bu\h'+03'\c
  195. .\}
  196. .el \{\
  197. .sp -1
  198. .IP \(bu 2.3
  199. .\}
  200. \fBgit-rebase\fR(1)
  201. to maintain topic branches\&.
  202. .RE
  203. .sp
  204. .RS 4
  205. .ie n \{\
  206. \h'-04'\(bu\h'+03'\c
  207. .\}
  208. .el \{\
  209. .sp -1
  210. .IP \(bu 2.3
  211. .\}
  212. \fBgit-tag\fR(1)
  213. to mark a known point\&.
  214. .RE
  215. .SS "Examples"
  216. .PP
  217. Use a tarball as a starting point for a new repository\&.
  218. .RS 4
  219. .sp
  220. .if n \{\
  221. .RS 4
  222. .\}
  223. .nf
  224. $ tar zxf frotz\&.tar\&.gz
  225. $ cd frotz
  226. $ git init
  227. $ git add \&. \fB(1)\fR
  228. $ git commit \-m "import of frotz source tree\&."
  229. $ git tag v2\&.43 \fB(2)\fR
  230. .fi
  231. .if n \{\
  232. .RE
  233. .\}
  234. .TS
  235. tab(:);
  236. r lw(\n(.lu*75u/100u).
  237. \fB1.\fR\h'-2n':T{
  238. add everything under the current directory\&.
  239. T}
  240. \fB2.\fR\h'-2n':T{
  241. make a lightweight, unannotated tag\&.
  242. T}
  243. .TE
  244. .RE
  245. .PP
  246. Create a topic branch and develop\&.
  247. .RS 4
  248. .sp
  249. .if n \{\
  250. .RS 4
  251. .\}
  252. .nf
  253. $ git switch \-c alsa\-audio \fB(1)\fR
  254. $ edit/compile/test
  255. $ git restore curses/ux_audio_oss\&.c \fB(2)\fR
  256. $ git add curses/ux_audio_alsa\&.c \fB(3)\fR
  257. $ edit/compile/test
  258. $ git diff HEAD \fB(4)\fR
  259. $ git commit \-a \-s \fB(5)\fR
  260. $ edit/compile/test
  261. $ git diff HEAD^ \fB(6)\fR
  262. $ git commit \-a \-\-amend \fB(7)\fR
  263. $ git switch master \fB(8)\fR
  264. $ git merge alsa\-audio \fB(9)\fR
  265. $ git log \-\-since=\*(Aq3 days ago\*(Aq \fB(10)\fR
  266. $ git log v2\&.43\&.\&. curses/ \fB(11)\fR
  267. .fi
  268. .if n \{\
  269. .RE
  270. .\}
  271. .TS
  272. tab(:);
  273. r lw(\n(.lu*75u/100u).
  274. \fB1.\fR\h'-2n':T{
  275. create a new topic branch\&.
  276. T}
  277. \fB2.\fR\h'-2n':T{
  278. revert your botched changes in
  279. \fBcurses/ux_audio_oss\&.c\fR\&.
  280. T}
  281. \fB3.\fR\h'-2n':T{
  282. you need to tell Git if you added a new file; removal and modification will be caught if you do
  283. \fBgit\fR
  284. \fBcommit\fR
  285. \fB\-a\fR
  286. later\&.
  287. T}
  288. \fB4.\fR\h'-2n':T{
  289. to see what changes you are committing\&.
  290. T}
  291. \fB5.\fR\h'-2n':T{
  292. commit everything, as you have tested, with your sign\-off\&.
  293. T}
  294. \fB6.\fR\h'-2n':T{
  295. look at all your changes including the previous commit\&.
  296. T}
  297. \fB7.\fR\h'-2n':T{
  298. amend the previous commit, adding all your new changes, using your original message\&.
  299. T}
  300. \fB8.\fR\h'-2n':T{
  301. switch to the master branch\&.
  302. T}
  303. \fB9.\fR\h'-2n':T{
  304. merge a topic branch into your master branch\&.
  305. T}
  306. \fB10.\fR\h'-2n':T{
  307. review commit logs; other forms to limit output can be combined and include
  308. \fB\-10\fR
  309. (to show up to 10 commits),
  310. \fB\-\-until=2005\-12\-10\fR, etc\&.
  311. T}
  312. \fB11.\fR\h'-2n':T{
  313. view only the changes that touch what\(cqs in
  314. \fBcurses/\fR
  315. directory, since
  316. \fBv2\&.43\fR
  317. tag\&.
  318. T}
  319. .TE
  320. .RE
  321. .SH "INDIVIDUAL DEVELOPER (PARTICIPANT)"
  322. .sp
  323. A developer working as a participant in a group project needs to learn how to communicate with others, and uses these commands in addition to the ones needed by a standalone developer\&.
  324. .sp
  325. .RS 4
  326. .ie n \{\
  327. \h'-04'\(bu\h'+03'\c
  328. .\}
  329. .el \{\
  330. .sp -1
  331. .IP \(bu 2.3
  332. .\}
  333. \fBgit-clone\fR(1)
  334. from the upstream to prime your local repository\&.
  335. .RE
  336. .sp
  337. .RS 4
  338. .ie n \{\
  339. \h'-04'\(bu\h'+03'\c
  340. .\}
  341. .el \{\
  342. .sp -1
  343. .IP \(bu 2.3
  344. .\}
  345. \fBgit-pull\fR(1)
  346. and
  347. \fBgit-fetch\fR(1)
  348. from "origin" to keep up\-to\-date with the upstream\&.
  349. .RE
  350. .sp
  351. .RS 4
  352. .ie n \{\
  353. \h'-04'\(bu\h'+03'\c
  354. .\}
  355. .el \{\
  356. .sp -1
  357. .IP \(bu 2.3
  358. .\}
  359. \fBgit-push\fR(1)
  360. to shared repository, if you adopt CVS style shared repository workflow\&.
  361. .RE
  362. .sp
  363. .RS 4
  364. .ie n \{\
  365. \h'-04'\(bu\h'+03'\c
  366. .\}
  367. .el \{\
  368. .sp -1
  369. .IP \(bu 2.3
  370. .\}
  371. \fBgit-format-patch\fR(1)
  372. to prepare e\-mail submission, if you adopt Linux kernel\-style public forum workflow\&.
  373. .RE
  374. .sp
  375. .RS 4
  376. .ie n \{\
  377. \h'-04'\(bu\h'+03'\c
  378. .\}
  379. .el \{\
  380. .sp -1
  381. .IP \(bu 2.3
  382. .\}
  383. \fBgit-send-email\fR(1)
  384. to send your e\-mail submission without corruption by your MUA\&.
  385. .RE
  386. .sp
  387. .RS 4
  388. .ie n \{\
  389. \h'-04'\(bu\h'+03'\c
  390. .\}
  391. .el \{\
  392. .sp -1
  393. .IP \(bu 2.3
  394. .\}
  395. \fBgit-request-pull\fR(1)
  396. to create a summary of changes for your upstream to pull\&.
  397. .RE
  398. .SS "Examples"
  399. .PP
  400. Clone the upstream and work on it\&. Feed changes to upstream\&.
  401. .RS 4
  402. .sp
  403. .if n \{\
  404. .RS 4
  405. .\}
  406. .nf
  407. $ git clone git://git\&.kernel\&.org/pub/scm/\&.\&.\&./torvalds/linux\-2\&.6 my2\&.6
  408. $ cd my2\&.6
  409. $ git switch \-c mine master \fB(1)\fR
  410. $ edit/compile/test; git commit \-a \-s \fB(2)\fR
  411. $ git format\-patch master \fB(3)\fR
  412. $ git send\-email \-\-to="person <email@example\&.com>" 00*\&.patch \fB(4)\fR
  413. $ git switch master \fB(5)\fR
  414. $ git pull \fB(6)\fR
  415. $ git log \-p ORIG_HEAD\&.\&. arch/i386 include/asm\-i386 \fB(7)\fR
  416. $ git ls\-remote \-\-heads http://git\&.kernel\&.org/\&.\&.\&./jgarzik/libata\-dev\&.git \fB(8)\fR
  417. $ git pull git://git\&.kernel\&.org/pub/\&.\&.\&./jgarzik/libata\-dev\&.git ALL \fB(9)\fR
  418. $ git reset \-\-hard ORIG_HEAD \fB(10)\fR
  419. $ git gc \fB(11)\fR
  420. .fi
  421. .if n \{\
  422. .RE
  423. .\}
  424. .TS
  425. tab(:);
  426. r lw(\n(.lu*75u/100u).
  427. \fB1.\fR\h'-2n':T{
  428. checkout a new branch
  429. \fBmine\fR
  430. from master\&.
  431. T}
  432. \fB2.\fR\h'-2n':T{
  433. repeat as needed\&.
  434. T}
  435. \fB3.\fR\h'-2n':T{
  436. extract patches from your branch, relative to master,
  437. T}
  438. \fB4.\fR\h'-2n':T{
  439. and email them\&.
  440. T}
  441. \fB5.\fR\h'-2n':T{
  442. return to
  443. \fBmaster\fR, ready to see what\(cqs new
  444. T}
  445. \fB6.\fR\h'-2n':T{
  446. \fBgit\fR
  447. \fBpull\fR
  448. fetches from
  449. \fBorigin\fR
  450. by default and merges into the current branch\&.
  451. T}
  452. \fB7.\fR\h'-2n':T{
  453. immediately after pulling, look at the changes done upstream since last time we checked, only in the area we are interested in\&.
  454. T}
  455. \fB8.\fR\h'-2n':T{
  456. check the branch names in an external repository (if not known)\&.
  457. T}
  458. \fB9.\fR\h'-2n':T{
  459. fetch from a specific branch
  460. \fBALL\fR
  461. from a specific repository and merge it\&.
  462. T}
  463. \fB10.\fR\h'-2n':T{
  464. revert the pull\&.
  465. T}
  466. \fB11.\fR\h'-2n':T{
  467. garbage collect leftover objects from reverted pull\&.
  468. T}
  469. .TE
  470. .RE
  471. .PP
  472. Push into another repository\&.
  473. .RS 4
  474. .sp
  475. .if n \{\
  476. .RS 4
  477. .\}
  478. .nf
  479. satellite$ git clone mothership:frotz frotz \fB(1)\fR
  480. satellite$ cd frotz
  481. satellite$ git config \-\-get\-regexp \*(Aq^(remote|branch)\e\&.\*(Aq \fB(2)\fR
  482. remote\&.origin\&.url mothership:frotz
  483. remote\&.origin\&.fetch refs/heads/*:refs/remotes/origin/*
  484. branch\&.master\&.remote origin
  485. branch\&.master\&.merge refs/heads/master
  486. satellite$ git config remote\&.origin\&.push \e
  487. +refs/heads/*:refs/remotes/satellite/* \fB(3)\fR
  488. satellite$ edit/compile/test/commit
  489. satellite$ git push origin \fB(4)\fR
  490. mothership$ cd frotz
  491. mothership$ git switch master
  492. mothership$ git merge satellite/master \fB(5)\fR
  493. .fi
  494. .if n \{\
  495. .RE
  496. .\}
  497. .TS
  498. tab(:);
  499. r lw(\n(.lu*75u/100u).
  500. \fB1.\fR\h'-2n':T{
  501. mothership machine has a frotz repository under your home directory; clone from it to start a repository on the satellite machine\&.
  502. T}
  503. \fB2.\fR\h'-2n':T{
  504. clone sets these configuration variables by default\&. It arranges
  505. \fBgit\fR
  506. \fBpull\fR
  507. to fetch and store the branches of mothership machine to local
  508. \fBremotes/origin/\fR* remote\-tracking branches\&.
  509. T}
  510. \fB3.\fR\h'-2n':T{
  511. arrange
  512. \fBgit\fR
  513. \fBpush\fR
  514. to push all local branches to their corresponding branch of the mothership machine\&.
  515. T}
  516. \fB4.\fR\h'-2n':T{
  517. push will stash all our work away on
  518. \fBremotes/satellite/\fR* remote\-tracking branches on the mothership machine\&. You could use this as a back\-up method\&. Likewise, you can pretend that mothership "fetched" from you (useful when access is one sided)\&.
  519. T}
  520. \fB5.\fR\h'-2n':T{
  521. on mothership machine, merge the work done on the satellite machine into the master branch\&.
  522. T}
  523. .TE
  524. .RE
  525. .PP
  526. Branch off of a specific tag\&.
  527. .RS 4
  528. .sp
  529. .if n \{\
  530. .RS 4
  531. .\}
  532. .nf
  533. $ git switch \-c private2\&.6\&.14 v2\&.6\&.14 \fB(1)\fR
  534. $ edit/compile/test; git commit \-a
  535. $ git checkout master
  536. $ git cherry\-pick v2\&.6\&.14\&.\&.private2\&.6\&.14 \fB(2)\fR
  537. .fi
  538. .if n \{\
  539. .RE
  540. .\}
  541. .TS
  542. tab(:);
  543. r lw(\n(.lu*75u/100u).
  544. \fB1.\fR\h'-2n':T{
  545. create a private branch based on a well known (but somewhat behind) tag\&.
  546. T}
  547. \fB2.\fR\h'-2n':T{
  548. forward port all changes in
  549. \fBprivate2\&.6\&.14\fR
  550. branch to
  551. \fBmaster\fR
  552. branch without a formal "merging"\&. Or longhand
  553. \fBgit\fR
  554. \fBformat\-patch\fR
  555. \fB\-k\fR
  556. \fB\-m\fR
  557. \fB\-\-stdout\fR
  558. \fBv2\&.6\&.14\fR\fB\&.\&.\fR\fBprivate2\&.6\&.14\fR
  559. |
  560. \fBgit\fR
  561. \fBam\fR
  562. \fB\-3\fR
  563. \fB\-k\fR
  564. T}
  565. .TE
  566. .RE
  567. .sp
  568. An alternate participant submission mechanism is using the \fBgit\fR \fBrequest\-pull\fR or pull\-request mechanisms (e\&.g\&. as used on GitHub (www\&.github\&.com) to notify your upstream of your contribution\&.
  569. .SH "INTEGRATOR"
  570. .sp
  571. A fairly central person acting as the integrator in a group project receives changes made by others, reviews and integrates them and publishes the result for others to use, using these commands in addition to the ones needed by participants\&.
  572. .sp
  573. This section can also be used by those who respond to \fBgit\fR \fBrequest\-pull\fR or pull\-request on GitHub (www\&.github\&.com) to integrate the work of others into their history\&. A sub\-area lieutenant for a repository will act both as a participant and as an integrator\&.
  574. .sp
  575. .RS 4
  576. .ie n \{\
  577. \h'-04'\(bu\h'+03'\c
  578. .\}
  579. .el \{\
  580. .sp -1
  581. .IP \(bu 2.3
  582. .\}
  583. \fBgit-am\fR(1)
  584. to apply patches e\-mailed in from your contributors\&.
  585. .RE
  586. .sp
  587. .RS 4
  588. .ie n \{\
  589. \h'-04'\(bu\h'+03'\c
  590. .\}
  591. .el \{\
  592. .sp -1
  593. .IP \(bu 2.3
  594. .\}
  595. \fBgit-pull\fR(1)
  596. to merge from your trusted lieutenants\&.
  597. .RE
  598. .sp
  599. .RS 4
  600. .ie n \{\
  601. \h'-04'\(bu\h'+03'\c
  602. .\}
  603. .el \{\
  604. .sp -1
  605. .IP \(bu 2.3
  606. .\}
  607. \fBgit-format-patch\fR(1)
  608. to prepare and send suggested alternative to contributors\&.
  609. .RE
  610. .sp
  611. .RS 4
  612. .ie n \{\
  613. \h'-04'\(bu\h'+03'\c
  614. .\}
  615. .el \{\
  616. .sp -1
  617. .IP \(bu 2.3
  618. .\}
  619. \fBgit-revert\fR(1)
  620. to undo botched commits\&.
  621. .RE
  622. .sp
  623. .RS 4
  624. .ie n \{\
  625. \h'-04'\(bu\h'+03'\c
  626. .\}
  627. .el \{\
  628. .sp -1
  629. .IP \(bu 2.3
  630. .\}
  631. \fBgit-push\fR(1)
  632. to publish the bleeding edge\&.
  633. .RE
  634. .SS "Examples"
  635. .PP
  636. A typical integrator\(cqs Git day\&.
  637. .RS 4
  638. .sp
  639. .if n \{\
  640. .RS 4
  641. .\}
  642. .nf
  643. $ git status \fB(1)\fR
  644. $ git branch \-\-no\-merged master \fB(2)\fR
  645. $ mailx \fB(3)\fR
  646. & s 2 3 4 5 \&./+to\-apply
  647. & s 7 8 \&./+hold\-linus
  648. & q
  649. $ git switch \-c topic/one master
  650. $ git am \-3 \-i \-s \&./+to\-apply \fB(4)\fR
  651. $ compile/test
  652. $ git switch \-c hold/linus && git am \-3 \-i \-s \&./+hold\-linus \fB(5)\fR
  653. $ git switch topic/one && git rebase master \fB(6)\fR
  654. $ git switch \-C seen next \fB(7)\fR
  655. $ git merge topic/one topic/two && git merge hold/linus \fB(8)\fR
  656. $ git switch maint
  657. $ git cherry\-pick master~4 \fB(9)\fR
  658. $ compile/test
  659. $ git tag \-s \-m "GIT 0\&.99\&.9x" v0\&.99\&.9x \fB(10)\fR
  660. $ git fetch ko && for branch in master maint next seen \fB(11)\fR
  661. do
  662. git show\-branch ko/$branch $branch \fB(12)\fR
  663. done
  664. $ git push \-\-follow\-tags ko \fB(13)\fR
  665. .fi
  666. .if n \{\
  667. .RE
  668. .\}
  669. .TS
  670. tab(:);
  671. r lw(\n(.lu*75u/100u).
  672. \fB1.\fR\h'-2n':T{
  673. see what you were in the middle of doing, if anything\&.
  674. T}
  675. \fB2.\fR\h'-2n':T{
  676. see which branches haven\(cqt been merged into
  677. \fBmaster\fR
  678. yet\&. Likewise for any other integration branches e\&.g\&.
  679. \fBmaint\fR,
  680. \fBnext\fR
  681. and
  682. \fBseen\fR\&.
  683. T}
  684. \fB3.\fR\h'-2n':T{
  685. read mails, save ones that are applicable, and save others that are not quite ready (other mail readers are available)\&.
  686. T}
  687. \fB4.\fR\h'-2n':T{
  688. apply them, interactively, with your sign\-offs\&.
  689. T}
  690. \fB5.\fR\h'-2n':T{
  691. create topic branch as needed and apply, again with sign\-offs\&.
  692. T}
  693. \fB6.\fR\h'-2n':T{
  694. rebase internal topic branch that has not been merged to the master or exposed as a part of a stable branch\&.
  695. T}
  696. \fB7.\fR\h'-2n':T{
  697. restart
  698. \fBseen\fR
  699. every time from the next\&.
  700. T}
  701. \fB8.\fR\h'-2n':T{
  702. and bundle topic branches still cooking\&.
  703. T}
  704. \fB9.\fR\h'-2n':T{
  705. backport a critical fix\&.
  706. T}
  707. \fB10.\fR\h'-2n':T{
  708. create a signed tag\&.
  709. T}
  710. \fB11.\fR\h'-2n':T{
  711. make sure master was not accidentally rewound beyond that already pushed out\&.
  712. T}
  713. \fB12.\fR\h'-2n':T{
  714. In the output from
  715. \fBgit\fR
  716. \fBshow\-branch\fR,
  717. \fBmaster\fR
  718. should have everything
  719. \fBko/master\fR
  720. has, and
  721. \fBnext\fR
  722. should have everything
  723. \fBko/next\fR
  724. has, etc\&.
  725. T}
  726. \fB13.\fR\h'-2n':T{
  727. push out the bleeding edge, together with new tags that point into the pushed history\&.
  728. T}
  729. .TE
  730. .RE
  731. .sp
  732. In this example, the \fBko\fR shorthand points at the Git maintainer\(cqs repository at kernel\&.org, and looks like this:
  733. .sp
  734. .if n \{\
  735. .RS 4
  736. .\}
  737. .nf
  738. (in \&.git/config)
  739. [remote "ko"]
  740. url = kernel\&.org:/pub/scm/git/git\&.git
  741. fetch = refs/heads/*:refs/remotes/ko/*
  742. push = refs/heads/master
  743. push = refs/heads/next
  744. push = +refs/heads/seen
  745. push = refs/heads/maint
  746. .fi
  747. .if n \{\
  748. .RE
  749. .\}
  750. .SH "REPOSITORY ADMINISTRATION"
  751. .sp
  752. A repository administrator uses the following tools to set up and maintain access to the repository by developers\&.
  753. .sp
  754. .RS 4
  755. .ie n \{\
  756. \h'-04'\(bu\h'+03'\c
  757. .\}
  758. .el \{\
  759. .sp -1
  760. .IP \(bu 2.3
  761. .\}
  762. \fBgit-daemon\fR(1)
  763. to allow anonymous download from repository\&.
  764. .RE
  765. .sp
  766. .RS 4
  767. .ie n \{\
  768. \h'-04'\(bu\h'+03'\c
  769. .\}
  770. .el \{\
  771. .sp -1
  772. .IP \(bu 2.3
  773. .\}
  774. \fBgit-shell\fR(1)
  775. can be used as a
  776. \fIrestricted login shell\fR
  777. for shared central repository users\&.
  778. .RE
  779. .sp
  780. .RS 4
  781. .ie n \{\
  782. \h'-04'\(bu\h'+03'\c
  783. .\}
  784. .el \{\
  785. .sp -1
  786. .IP \(bu 2.3
  787. .\}
  788. \fBgit-http-backend\fR(1)
  789. provides a server side implementation of Git\-over\-HTTP ("Smart http") allowing both fetch and push services\&.
  790. .RE
  791. .sp
  792. .RS 4
  793. .ie n \{\
  794. \h'-04'\(bu\h'+03'\c
  795. .\}
  796. .el \{\
  797. .sp -1
  798. .IP \(bu 2.3
  799. .\}
  800. \fBgitweb\fR(1)
  801. provides a web front\-end to Git repositories, which can be set\-up using the
  802. \fBgit-instaweb\fR(1)
  803. script\&.
  804. .RE
  805. .sp
  806. \m[blue]\fBupdate hook howto\fR\m[]\&\s-2\u[1]\d\s+2 has a good example of managing a shared central repository\&.
  807. .sp
  808. In addition there are a number of other widely deployed hosting, browsing and reviewing solutions such as:
  809. .sp
  810. .RS 4
  811. .ie n \{\
  812. \h'-04'\(bu\h'+03'\c
  813. .\}
  814. .el \{\
  815. .sp -1
  816. .IP \(bu 2.3
  817. .\}
  818. gitolite, gerrit code review, cgit and others\&.
  819. .RE
  820. .SS "Examples"
  821. .PP
  822. We assume the following in /etc/services
  823. .RS 4
  824. .sp
  825. .if n \{\
  826. .RS 4
  827. .\}
  828. .nf
  829. $ grep 9418 /etc/services
  830. git 9418/tcp # Git Version Control System
  831. .fi
  832. .if n \{\
  833. .RE
  834. .\}
  835. .RE
  836. .PP
  837. Run git\-daemon to serve /pub/scm from inetd\&.
  838. .RS 4
  839. .sp
  840. .if n \{\
  841. .RS 4
  842. .\}
  843. .nf
  844. $ grep git /etc/inetd\&.conf
  845. git stream tcp nowait nobody \e
  846. /usr/bin/git\-daemon git\-daemon \-\-inetd \-\-export\-all /pub/scm
  847. .fi
  848. .if n \{\
  849. .RE
  850. .\}
  851. .sp
  852. The actual configuration line should be on one line\&.
  853. .RE
  854. .PP
  855. Run git\-daemon to serve /pub/scm from xinetd\&.
  856. .RS 4
  857. .sp
  858. .if n \{\
  859. .RS 4
  860. .\}
  861. .nf
  862. $ cat /etc/xinetd\&.d/git\-daemon
  863. # default: off
  864. # description: The Git server offers access to Git repositories
  865. service git
  866. {
  867. disable = no
  868. type = UNLISTED
  869. port = 9418
  870. socket_type = stream
  871. wait = no
  872. user = nobody
  873. server = /usr/bin/git\-daemon
  874. server_args = \-\-inetd \-\-export\-all \-\-base\-path=/pub/scm
  875. log_on_failure += USERID
  876. }
  877. .fi
  878. .if n \{\
  879. .RE
  880. .\}
  881. .sp
  882. Check your xinetd(8) documentation and setup, this is from a Fedora system\&. Others might be different\&.
  883. .RE
  884. .PP
  885. Give push/pull only access to developers using git\-over\-ssh\&.
  886. .RS 4
  887. e\&.g\&. those using:
  888. \fB$\fR
  889. \fBgit\fR
  890. \fBpush/pull\fR
  891. \fBssh://host\&.xz/pub/scm/project\fR
  892. .sp
  893. .if n \{\
  894. .RS 4
  895. .\}
  896. .nf
  897. $ grep git /etc/passwd \fB(1)\fR
  898. alice:x:1000:1000::/home/alice:/usr/bin/git\-shell
  899. bob:x:1001:1001::/home/bob:/usr/bin/git\-shell
  900. cindy:x:1002:1002::/home/cindy:/usr/bin/git\-shell
  901. david:x:1003:1003::/home/david:/usr/bin/git\-shell
  902. $ grep git /etc/shells \fB(2)\fR
  903. /usr/bin/git\-shell
  904. .fi
  905. .if n \{\
  906. .RE
  907. .\}
  908. .TS
  909. tab(:);
  910. r lw(\n(.lu*75u/100u).
  911. \fB1.\fR\h'-2n':T{
  912. log\-in shell is set to /usr/bin/git\-shell, which does not allow anything but
  913. \fBgit\fR
  914. \fBpush\fR
  915. and
  916. \fBgit\fR
  917. \fBpull\fR\&. The users require ssh access to the machine\&.
  918. T}
  919. \fB2.\fR\h'-2n':T{
  920. in many distributions /etc/shells needs to list what is used as the login shell\&.
  921. T}
  922. .TE
  923. .RE
  924. .PP
  925. CVS\-style shared repository\&.
  926. .RS 4
  927. .sp
  928. .if n \{\
  929. .RS 4
  930. .\}
  931. .nf
  932. $ grep git /etc/group \fB(1)\fR
  933. git:x:9418:alice,bob,cindy,david
  934. $ cd /home/devo\&.git
  935. $ ls \-l \fB(2)\fR
  936. lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD \-> refs/heads/master
  937. drwxrwsr\-x 2 david git 4096 Dec 4 22:40 branches
  938. \-rw\-rw\-r\-\- 1 david git 84 Dec 4 22:40 config
  939. \-rw\-rw\-r\-\- 1 david git 58 Dec 4 22:40 description
  940. drwxrwsr\-x 2 david git 4096 Dec 4 22:40 hooks
  941. \-rw\-rw\-r\-\- 1 david git 37504 Dec 4 22:40 index
  942. drwxrwsr\-x 2 david git 4096 Dec 4 22:40 info
  943. drwxrwsr\-x 4 david git 4096 Dec 4 22:40 objects
  944. drwxrwsr\-x 4 david git 4096 Nov 7 14:58 refs
  945. drwxrwsr\-x 2 david git 4096 Dec 4 22:40 remotes
  946. $ ls \-l hooks/update \fB(3)\fR
  947. \-r\-xr\-xr\-x 1 david git 3536 Dec 4 22:40 update
  948. $ cat info/allowed\-users \fB(4)\fR
  949. refs/heads/master alice\e|cindy
  950. refs/heads/doc\-update bob
  951. refs/tags/v[0\-9]* david
  952. .fi
  953. .if n \{\
  954. .RE
  955. .\}
  956. .TS
  957. tab(:);
  958. r lw(\n(.lu*75u/100u).
  959. \fB1.\fR\h'-2n':T{
  960. place the developers into the same git group\&.
  961. T}
  962. \fB2.\fR\h'-2n':T{
  963. and make the shared repository writable by the group\&.
  964. T}
  965. \fB3.\fR\h'-2n':T{
  966. use update\-hook example by Carl from Documentation/howto/ for branch policy control\&.
  967. T}
  968. \fB4.\fR\h'-2n':T{
  969. alice and cindy can push into master, only bob can push into doc\-update\&. david is the release manager and is the only person who can create and push version tags\&.
  970. T}
  971. .TE
  972. .RE
  973. .SH "GIT"
  974. .sp
  975. Part of the \fBgit\fR(1) suite
  976. .SH "NOTES"
  977. .IP " 1." 4
  978. update hook howto
  979. .RS 4
  980. \%git-htmldocs/howto/update-hook-example.html
  981. .RE