]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/git
77d898a0f1c62effa380f8147574e67cf3f7efd9
[plan9front.git] / sys / man / 1 / git
1 .TH GIT 1
2 .SH NAME
3 git, git/conf, git/query, git/walk, git/clone, git/branch,
4 git/commit, git/diff, git/init, git/log, git/merge, git/push,
5 git/pull, git/rm, git/serve
6 \- Manage git repositories.
7
8 .SH SYNOPSIS
9 .PP
10 .B git/add
11 [
12 .B -r
13 ]
14 .I path...
15 .PP
16 .B git/rm
17 .I path...
18 .PP
19 .B git/branch
20 [
21 .B -admns
22 ]
23 [
24 .B -b
25 .I base
26 ]
27 .I newbranch
28 .PP
29 .B git/clone
30 [
31 .I remote
32 [
33 .I local
34 ]
35 ]
36 .PP
37 .B git/commit
38 [
39 .B -re
40 ]
41 [
42 .B -m msg
43 ]
44 [
45 .I file...
46 ]
47 .PP
48 .B git/compat
49 .PP
50 .B git/conf
51 [
52 .B -r
53 ]
54 [
55 .B -f
56 .I file
57 ]
58 .I keys...
59 .PP
60 .B git/diff
61 [
62 .B -c
63 .I branch
64 ]
65 [
66 .B -s
67 ]
68 [
69 .I file...
70 ]
71 .PP
72 .B git/revert
73 [
74 .B -c
75 .I commit
76 ]
77 .I file...
78 .PP
79 .B git/export
80 [
81 .I commits...
82 ]
83 .PP
84 .B git/import
85 [
86 .I commits...
87 ]
88 .PP
89 .B git/init
90 [
91 .B -b
92 ]
93 [
94 .I dir
95 ]
96 [
97 .B -u
98 .I upstream
99 ]
100 .PP
101 .B git/log
102 [
103 .B -c
104 .I commit
105 .B | -e
106 .I expr
107 ]
108 [
109 .B -s
110 ]
111 [
112 .I files...
113 ]
114 .PP
115 .B git/merge
116 .I theirs
117 .PP
118 .B git/rebase
119 [
120 .B -ari
121 ]
122 [
123 .B onto
124 ]
125 .PP
126 .B git/pull
127 [
128 .B -f
129 ]
130 [
131 .B -q
132 ]
133 [
134 .B -a
135 ]
136 [
137 .B -u
138 .I upstream
139 ]
140 .PP
141 .B git/push
142 [
143 .B -a
144 ]
145 [
146 .B -u
147 .I upstream
148 ]
149 [
150 .B -b
151 .I branch
152 ]
153 [
154 .B -r
155 .I branch
156 ]
157 .PP
158 .B git/serve
159 [
160 .B -w
161 ]
162 [
163 .B -r
164 .I path
165 ]
166 .PP
167 .B git/query
168 [
169 .B -pcr
170 ]
171 .I query
172 .PP
173 .B git/walk
174 [
175 .B -qc
176 ]
177 [
178 .B -b
179 .I branch
180 ]
181 [
182 .B -f
183 .I filters
184 ]
185 [
186 .I [files...]
187 ]
188
189 .SH DESCRIPTION
190 .PP
191 Git is a distributed version control system.
192 This means that each repository contains a full copy of the history.
193 This history is then synced between computers as needed.
194
195 .PP
196 These programs provide tools to manage and interoperate with
197 repositories hosted in git.
198
199 .SH CONCEPTS
200
201 Git stores snapshots of the working directory.
202 Files can either be in a tracked or untracked state.
203 Each commit takes the current version of all tracked files and
204 adds them to a new commit.
205
206 This history is stored in the
207 .I .git
208 directory.
209 This suite of
210 .I git
211 tools provides a file interface to the
212 .I .git
213 directory mounted on
214 .I $repo/.git/fs.
215 Modifications to the repository are done directly to the
216 .I .git
217 directory, and are reflected in the file system interface.
218 This allows for easy scripting, without excessive complexity
219 in the file API.
220
221 .SH COMMANDS
222
223 .PP
224 .B Git/init
225 is used to create a new git repository, with no code or commits.
226 The repository is created in the current directory by default.
227 Passing a directory name will cause the repository to be created
228 there instead.
229 Passing the
230 .B -b
231 option will cause the repository to be initialized as a bare repository.
232 Passing the
233 .B -u
234 .I upstream
235 option will cause the upstream to be configured to
236 .I upstream.
237
238 .PP
239 .B Git/clone
240 will take an existing repository, served over either the
241 .I git://
242 or
243 .I ssh://
244 protocols.
245 The first argument is the repository to clone.
246 The second argument, optionally, specifies the location to clone into.
247 If not specified, the repository will be cloned into the last path component
248 of the clone source, with the
249 .I .git
250 stripped off if present.
251
252 .PP
253 .B Git/push
254 is used to push the current changes to a remote repository.
255 When no arguments are provided, the remote repository is taken from
256 the origin configured in
257 .I .git/config,
258 and only the changes on the current branch are pushed.
259 When passed the
260 .I -a
261 option, all branches are pushed.
262 When passed the
263 .I -u upstream
264 option, the changed are pushed to
265 .I upstream
266 instead of the configured origin.
267 When given the
268 .I -r
269 option, the branch is deleted from origin, instead of updated.
270
271 .PP
272 .B Git/revert
273 restores the named files from HEAD. When passed the -c flag, restores files from
274 the named commit.
275
276 .PP
277 .B Git/pull
278 behaves in a similar manner to git/push, however it gets changes from
279 the upstream repository.
280 After fetching, it checks out the changes into the working directory.
281 When passed the
282 .I -f
283 option, the update of the working copy is suppressed.
284 When passed the
285 .I -u upstream
286 option, the changes are pulled from
287 .I upstream
288 instead of the configured origin.
289
290 .PP
291 .B Git/serve
292 serves repositories using the
293 .I git://
294 protocol over stdin.
295 By default, it serves them read-only.
296 The 
297 .I -w
298 flag, it allows pushing into repositories.
299 The
300 .I -r
301 .B path
302 flag serves repositories relative to
303 .BR path .
304
305 .PP
306 .B Git/fs 
307 serves a file system on $repo/.git/fs.
308 For full documentation, see
309 .IR gitfs (4)
310
311 .PP
312 .B Git/add
313 adds a file to the list of tracked files. When passed the
314 .I -r
315 flag, the file is removed from the list of tracked files.
316 The copy of the file in the repository is left untouched.
317 .PP
318 .B Git/rm
319 is an alias for
320 .IR git/add -r .
321
322 .PP
323 .B Git/commit
324 creates a new commit consisting of all changes to the specified files.
325 By default, an editor is opened to prepare the commit message.
326 The
327 .I -m
328 flag supplies the commit message directly.
329 The
330 .I -r
331 flag revises the contents of the previous commit, reusing the message.
332 The
333 .I -e
334 flag opens an editor to finalize the commit message, regardless of
335 whether or not it was specified explicitly or reused.
336 To amend a commit message,
337 .I -r
338 can be used in conjuction with
339 .I -m
340 or
341 .IR -e .
342
343 .PP
344 .B Git/branch
345 is used to list or switch branches.
346 When invoked with no arguments, it lists the current branch.
347 To list all branches, pass the
348 .I -a
349 option.
350 To switch between branches, pass a branch name.
351 When passed the
352 .I -n
353 option, the branch will be created, overwriting existing branch.
354 When passed the
355 .I -b base
356 option, the branch created is based off of
357 .I base
358 instead of
359 .I HEAD.
360 When passed the
361 .I -s
362 option, the branch is created but the files are not checked out.
363 When passed the
364 .I -d
365 option, the branch is deleted.
366 .PP
367 When switching branches, git/branch will refuse to clobber
368 modificiations.
369 Passing the
370 .I -m
371 option will cause git9 to attempt to merge the changes between
372 the branches.
373
374 .PP
375 .B Git/log
376 shows a history of the current branch.
377 When passed a list of files, only commits affecting
378 those files are shown.
379 The
380 .I -c commit
381 option logs starting from the provided commit, instead of HEAD.
382 The
383 .I -s
384 option shows a summary of the commit, instead of the full message.
385 The
386 .I -e expr
387 option shows commits matching the query expression provided.
388 The expression is in the syntax of
389 .B git/query.
390
391 .PP
392 .B Git/diff
393 shows the differences between the currently checked out code and
394 the
395 .I HEAD
396 commit.
397 When passed the
398 .I -c base
399 option, the diff is computed against
400 .I base
401 instead of
402 .I HEAD.
403 When passed the
404 .I -s
405 option, only the file statuses are
406 printed.
407
408 .PP
409 .B Git/export
410 exports a list of commits in a format that
411 .B git/import
412 can apply.
413
414 .PP
415 .B Git/import
416 imports a commit with message, author, and
417 date information.
418
419 .PP
420 .B Git/merge
421 takes two branches and merges them filewise using
422 .I ape/diff3.
423 The next commit made will be a merge commmit.
424
425 .PP
426 .B Git/rebase
427 takes one branch and moves it onto another.
428 On error, the remaining commits to rebase are
429 saved, and can be resumed once the conflict is
430 resolved using the
431 .I -r
432 option.
433 If the rebase is to be aborted, the
434 .I -a
435 option will clean up the in progress rebase
436 and reset the state of the branch.
437 The
438 .I -i
439 option will open an editor to modify the todo-list before the rebase
440 begins.
441
442 .PP
443 The following rebase commands are supported:
444 .TP 10
445 .B pick
446 Apply the commit.
447 .TP
448 .B reword
449 Apply the commit, then edit its commit message.
450 .TP
451 .B edit
452 Apply the commit, then exit to allow further changes.
453 .TP
454 .B squash
455 Fold the commit into the previous commit, then edit the combined
456 commit message.
457 .TP
458 .B fixup
459 Fold the commit into the previous commit, discarding its commit
460 message.
461 .TP
462 .B break
463 Exit to allow for manual edits or inspection before continuing.
464
465 .PP
466 .B Git/conf
467 is a tool for querying the git configuration.
468 The configuration key is provided as a dotted string. Spaces
469 are accepted. For example, to find the URL of the origin
470 repository, one might pass
471 .I 'remote "origin".url".
472 When given the
473 .I -r
474 option, the root of the current repository is printed.
475
476 .B Git/query
477 takes an expression describing a commit, or set of commits,
478 and resolves it to a list of commits.
479 The
480 .I -r
481 option reverses the order of the commit list.
482 With the
483 .I -p
484 option, instead of printing the commit hashes, the full
485 path to their
486 .B git/fs
487 path is printed. With the
488 .I -c
489 option, the query must resolve to two commits. The blobs
490 that have changed in the commits are printed.
491
492 .PP
493 .B Git/walk
494 provides a tool for walking the list of tracked objects and printing their status.
495 With no arguments, it prints a list of paths prefixed with the status character.
496 When given the
497 .I -c
498 character, only the paths are printed.
499 When given the
500 .I -q
501 option, all output is suppressed, and only the status is printed.
502 When given the
503 .I -f
504 option, the output is filtered by status code, and only matching items are printed.
505
506 .PP
507 The status characters are as follows:
508 .TP
509 T
510 Tracked, not modified since last commit.
511 .TP
512 M
513 Modified since last commit.
514 .TP
515 R
516 Removed from either working directory tracking list.
517 .TP
518 A
519 Added, does not yet exist in a commit.
520
521 .PP
522 .B Git/compat
523 spawns an rc subshell with a compatibility stub in
524 .IR $path .
525 This compatibility stub provides enough of the unix
526 .I git
527 commands to run tools like
528 .I go get
529 but not much more.
530
531 .SH REF SYNTAX
532
533 .PP
534 Refs are specified with a simple query syntax.
535 A bare hash always evaluates to itself.
536 Ref names are resolved to their hashes.
537 The
538 .B a ^
539 suffix operator finds the parent of a commit.
540 The
541 .B a b @
542 suffix operator finds the common ancestor of the previous two commits.
543 The
544 .B a .. b
545 or
546 .B a : b
547 operator finds all commits between
548 .B a
549 and
550 .B b.
551 Between is defined as the set of all commits which are reachable from
552 .B b
553 but not reachable from
554 .B a.
555
556 .SH PROTOCOLS
557 .PP
558 Git9 supports URL schemes of the format
559 .BR transport://dial/repo/path .
560 The transport portion specifies the protocol to use.
561 If the transport portion is omitted, then the transport used is
562 .BR ssh .
563 The
564 .I dial
565 portion is either a plan 9 dial string, or a conventional
566 .I host:port
567 pair.
568 For the ssh protocol, it may also include a
569 .I user@
570 prefix.
571 .I repo/path
572 portion is the path of the repository on the server.
573
574 The supported transports are
575 .B ssh://, git://, hjgit://, gits://, http://,
576 and
577 .BR https .
578 Two of these are specific to git9:
579 .I gits://
580 and
581 .IR hjgit:// .
582 Both are the
583 .I git://
584 protocol, tunnelled over tls.
585 .I Hjgit://
586 authenticates with the server using Plan 9 authentication,
587 using
588 .IR tlsclient\ -a .
589 Any of these protocol names may be prefixed with
590 .IR git+ ,
591 for copy-paste compatibility with Unix git.
592
593 .SH EXAMPLES
594
595 .PP
596 In order to create a new repository, run
597 .B git/init:
598 .PP
599 .EX
600 git/init myrepo
601 .EE
602
603 .PP
604 To clone an existing repository from a git server, run:
605 .PP
606 .EX
607 git/clone git://github.com/Harvey-OS/harvey
608 cd harvey
609 # edit files
610 git/commit foo.c
611 git/push
612 .EE
613
614 .PP
615 To set a user and email for commits, run:
616 .PP
617 .EX
618 % mkdir $home/lib/git
619 % >$home/lib/git/config echo '
620 [user]
621         name = Ori Bernstein
622         email = ori@eigenstate.org'
623 .EE
624
625 .SH FILES
626 .TP
627 $repo/.git
628 The full git repository.
629 .TP
630 $repo/.git/config
631 The configuration file for a repository.
632 .TP
633 $home/lib/git/config
634 The user-wide configuration for git.
635 The contents of this file are used as fallbacks for the per-repository config.
636 .TP
637 /sys/lib/git/config
638 The system-wide configuration for git.
639 The contents of this file are used as fallbacks for the per-user config.
640
641 .SH SEE ALSO
642 .IR replica (1)
643 .IR patch (1)
644 .IR gitfs (4)
645 .IR diff3
646
647 .SH BUGS
648 .PP
649 Repositories with submodules are effectively read-only.
650 .PP
651 There are a some of missing commands, features, and tools
652 .PP
653 git/compat only works within a git repository.