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

gitrevisions.7 (21008B)


  1. '\" t
  2. .\" Title: gitrevisions
  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 "GITREVISIONS" "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. gitrevisions \- Specifying revisions and ranges for Git
  32. .SH "SYNOPSIS"
  33. .sp
  34. gitrevisions
  35. .SH "DESCRIPTION"
  36. .sp
  37. Many Git commands take revision parameters as arguments\&. Depending on the command, they denote a specific commit or, for commands which walk the revision graph (such as \fBgit-log\fR(1)), all commits which are reachable from that commit\&. For commands that walk the revision graph one can also specify a range of revisions explicitly\&.
  38. .sp
  39. In addition, some Git commands (such as \fBgit-show\fR(1) and \fBgit-push\fR(1)) can also take revision parameters which denote other objects than commits, e\&.g\&. blobs ("files") or trees ("directories of files")\&.
  40. .SH "SPECIFYING REVISIONS"
  41. .sp
  42. A revision parameter \fI<rev>\fR typically, but not necessarily, names a commit object\&. It uses what is called an \fIextended SHA\-1\fR syntax\&. Here are various ways to spell object names\&. The ones listed near the end of this list name trees and blobs contained in a commit\&.
  43. .if n \{\
  44. .sp
  45. .\}
  46. .RS 4
  47. .it 1 an-trap
  48. .nr an-no-space-flag 1
  49. .nr an-break-flag 1
  50. .br
  51. .ps +1
  52. \fBNote\fR
  53. .ps -1
  54. .br
  55. .sp
  56. This document shows the "raw" syntax as seen by git\&. The shell and other UIs might require additional quoting to protect special characters and to avoid word splitting\&.
  57. .sp .5v
  58. .RE
  59. .PP
  60. \fI<sha1>\fR, e\&.g\&. \fIdae86e1950b1277e545cee180551750029cfe735\fR, \fIdae86e\fR
  61. .RS 4
  62. The full SHA\-1 object name (40\-byte hexadecimal string), or a leading substring that is unique within the repository\&. E\&.g\&. dae86e1950b1277e545cee180551750029cfe735 and dae86e both name the same commit object if there is no other object in your repository whose object name starts with dae86e\&.
  63. .RE
  64. .PP
  65. \fI<describeOutput>\fR, e\&.g\&. \fIv1\&.7\&.4\&.2\-679\-g3bee7fb\fR
  66. .RS 4
  67. Output from
  68. \fBgit\fR
  69. \fBdescribe\fR; i\&.e\&. a closest tag, optionally followed by a dash and a number of commits, followed by a dash, a
  70. \fIg\fR, and an abbreviated object name\&.
  71. .RE
  72. .PP
  73. \fI<refname>\fR, e\&.g\&. \fImaster\fR, \fIheads/master\fR, \fIrefs/heads/master\fR
  74. .RS 4
  75. A symbolic ref name\&. E\&.g\&.
  76. \fImaster\fR
  77. typically means the commit object referenced by
  78. \fIrefs/heads/master\fR\&. If you happen to have both
  79. \fIheads/master\fR
  80. and
  81. \fItags/master\fR, you can explicitly say
  82. \fIheads/master\fR
  83. to tell Git which one you mean\&. When ambiguous, a
  84. \fI<refname>\fR
  85. is disambiguated by taking the first match in the following rules:
  86. .sp
  87. .RS 4
  88. .ie n \{\
  89. \h'-04' 1.\h'+01'\c
  90. .\}
  91. .el \{\
  92. .sp -1
  93. .IP " 1." 4.2
  94. .\}
  95. If
  96. \fI$GIT_DIR/<refname>\fR
  97. exists, that is what you mean (this is usually useful only for
  98. \fBHEAD\fR,
  99. \fBFETCH_HEAD\fR,
  100. \fBORIG_HEAD\fR,
  101. \fBMERGE_HEAD\fR,
  102. \fBREBASE_HEAD\fR,
  103. \fBREVERT_HEAD\fR,
  104. \fBCHERRY_PICK_HEAD\fR,
  105. \fBBISECT_HEAD\fR
  106. and
  107. \fBAUTO_MERGE\fR);
  108. .RE
  109. .sp
  110. .RS 4
  111. .ie n \{\
  112. \h'-04' 2.\h'+01'\c
  113. .\}
  114. .el \{\
  115. .sp -1
  116. .IP " 2." 4.2
  117. .\}
  118. otherwise,
  119. \fIrefs/<refname>\fR
  120. if it exists;
  121. .RE
  122. .sp
  123. .RS 4
  124. .ie n \{\
  125. \h'-04' 3.\h'+01'\c
  126. .\}
  127. .el \{\
  128. .sp -1
  129. .IP " 3." 4.2
  130. .\}
  131. otherwise,
  132. \fIrefs/tags/<refname>\fR
  133. if it exists;
  134. .RE
  135. .sp
  136. .RS 4
  137. .ie n \{\
  138. \h'-04' 4.\h'+01'\c
  139. .\}
  140. .el \{\
  141. .sp -1
  142. .IP " 4." 4.2
  143. .\}
  144. otherwise,
  145. \fIrefs/heads/<refname>\fR
  146. if it exists;
  147. .RE
  148. .sp
  149. .RS 4
  150. .ie n \{\
  151. \h'-04' 5.\h'+01'\c
  152. .\}
  153. .el \{\
  154. .sp -1
  155. .IP " 5." 4.2
  156. .\}
  157. otherwise,
  158. \fIrefs/remotes/<refname>\fR
  159. if it exists;
  160. .RE
  161. .sp
  162. .RS 4
  163. .ie n \{\
  164. \h'-04' 6.\h'+01'\c
  165. .\}
  166. .el \{\
  167. .sp -1
  168. .IP " 6." 4.2
  169. .\}
  170. otherwise,
  171. \fIrefs/remotes/<refname>/HEAD\fR
  172. if it exists\&.
  173. .PP
  174. \fBHEAD\fR
  175. .RS 4
  176. names the commit on which you based the changes in the working tree\&.
  177. .RE
  178. .PP
  179. \fBFETCH_HEAD\fR
  180. .RS 4
  181. records the branch which you fetched from a remote repository with your last
  182. \fBgit\fR
  183. \fBfetch\fR
  184. invocation\&.
  185. .RE
  186. .PP
  187. \fBORIG_HEAD\fR
  188. .RS 4
  189. is created by commands that move your
  190. \fBHEAD\fR
  191. in a drastic way (\fBgit\fR
  192. \fBam\fR,
  193. \fBgit\fR
  194. \fBmerge\fR,
  195. \fBgit\fR
  196. \fBrebase\fR,
  197. \fBgit\fR
  198. \fBreset\fR), to record the position of the
  199. \fBHEAD\fR
  200. before their operation, so that you can easily change the tip of the branch back to the state before you ran them\&.
  201. .RE
  202. .PP
  203. \fBMERGE_HEAD\fR
  204. .RS 4
  205. records the commit(s) which you are merging into your branch when you run
  206. \fBgit\fR
  207. \fBmerge\fR\&.
  208. .RE
  209. .PP
  210. \fBREBASE_HEAD\fR
  211. .RS 4
  212. during a rebase, records the commit at which the operation is currently stopped, either because of conflicts or an
  213. \fBedit\fR
  214. command in an interactive rebase\&.
  215. .RE
  216. .PP
  217. \fBREVERT_HEAD\fR
  218. .RS 4
  219. records the commit which you are reverting when you run
  220. \fBgit\fR
  221. \fBrevert\fR\&.
  222. .RE
  223. .PP
  224. \fBCHERRY_PICK_HEAD\fR
  225. .RS 4
  226. records the commit which you are cherry\-picking when you run
  227. \fBgit\fR
  228. \fBcherry\-pick\fR\&.
  229. .RE
  230. .PP
  231. \fBBISECT_HEAD\fR
  232. .RS 4
  233. records the current commit to be tested when you run
  234. \fBgit\fR
  235. \fBbisect\fR
  236. \fB\-\-no\-checkout\fR\&.
  237. .RE
  238. .PP
  239. \fBAUTO_MERGE\fR
  240. .RS 4
  241. records a tree object corresponding to the state the
  242. \fIort\fR
  243. merge strategy wrote to the working tree when a merge operation resulted in conflicts\&.
  244. .RE
  245. .RE
  246. .sp
  247. Note that any of the
  248. \fIrefs/*\fR
  249. cases above may come either from the
  250. \fB$GIT_DIR/refs\fR
  251. directory or from the
  252. \fB$GIT_DIR/packed\-refs\fR
  253. file\&. While the ref name encoding is unspecified, UTF\-8 is preferred as some output processing may assume ref names in UTF\-8\&.
  254. .RE
  255. .PP
  256. \fI@\fR
  257. .RS 4
  258. \fI@\fR
  259. alone is a shortcut for
  260. \fBHEAD\fR\&.
  261. .RE
  262. .PP
  263. \fI[<refname>]@{<date>}\fR, e\&.g\&. \fImaster@{yesterday}\fR, \fIHEAD@{5 minutes ago}\fR
  264. .RS 4
  265. A ref followed by the suffix
  266. \fI@\fR
  267. with a date specification enclosed in a brace pair (e\&.g\&.
  268. \fI{yesterday}\fR,
  269. \fI{1 month 2 weeks 3 days 1 hour 1 second ago}\fR
  270. or
  271. \fI{1979\-02\-26 18:30:00}\fR) specifies the value of the ref at a prior point in time\&. This suffix may only be used immediately following a ref name and the ref must have an existing log (\fI$GIT_DIR/logs/<ref>\fR)\&. Note that this looks up the state of your
  272. \fBlocal\fR
  273. ref at a given time; e\&.g\&., what was in your local
  274. \fImaster\fR
  275. branch last week\&. If you want to look at commits made during certain times, see
  276. \fB\-\-since\fR
  277. and
  278. \fB\-\-until\fR\&.
  279. .RE
  280. .PP
  281. \fI<refname>@{<n>}\fR, e\&.g\&. \fImaster@{1}\fR
  282. .RS 4
  283. A ref followed by the suffix
  284. \fI@\fR
  285. with an ordinal specification enclosed in a brace pair (e\&.g\&.
  286. \fI{1}\fR,
  287. \fI{15}\fR) specifies the n\-th prior value of that ref\&. For example
  288. \fImaster@{1}\fR
  289. is the immediate prior value of
  290. \fImaster\fR
  291. while
  292. \fImaster@{5}\fR
  293. is the 5th prior value of
  294. \fImaster\fR\&. This suffix may only be used immediately following a ref name and the ref must have an existing log (\fI$GIT_DIR/logs/<refname>\fR)\&.
  295. .RE
  296. .PP
  297. \fI@{<n>}\fR, e\&.g\&. \fI@{1}\fR
  298. .RS 4
  299. You can use the
  300. \fI@\fR
  301. construct with an empty ref part to get at a reflog entry of the current branch\&. For example, if you are on branch
  302. \fIblabla\fR
  303. then
  304. \fI@{1}\fR
  305. means the same as
  306. \fIblabla@{1}\fR\&.
  307. .RE
  308. .PP
  309. \fI@{\-<n>}\fR, e\&.g\&. \fI@{\-1}\fR
  310. .RS 4
  311. The construct
  312. \fI@{\-<n>}\fR
  313. means the <n>th branch/commit checked out before the current one\&.
  314. .RE
  315. .PP
  316. \fI[<branchname>]@{upstream}\fR, e\&.g\&. \fImaster@{upstream}\fR, \fI@{u}\fR
  317. .RS 4
  318. A branch B may be set up to build on top of a branch X (configured with
  319. \fBbranch\&.\fR\fI<name>\fR\fB\&.merge\fR) at a remote R (configured with
  320. \fBbranch\&.\fR\fI<name>\fR\fB\&.remote\fR)\&. B@{u} refers to the remote\-tracking branch for the branch X taken from remote R, typically found at
  321. \fBrefs/remotes/R/X\fR\&.
  322. .RE
  323. .PP
  324. \fI[<branchname>]@{push}\fR, e\&.g\&. \fImaster@{push}\fR, \fI@{push}\fR
  325. .RS 4
  326. The suffix
  327. \fI@{push}\fR
  328. reports the branch "where we would push to" if
  329. \fBgit\fR
  330. \fBpush\fR
  331. were run while
  332. \fBbranchname\fR
  333. was checked out (or the current
  334. \fBHEAD\fR
  335. if no branchname is specified)\&. Like for
  336. \fI@{upstream}\fR, we report the remote\-tracking branch that corresponds to that branch at the remote\&.
  337. .sp
  338. Here\(cqs an example to make it more clear:
  339. .sp
  340. .if n \{\
  341. .RS 4
  342. .\}
  343. .nf
  344. $ git config push\&.default current
  345. $ git config remote\&.pushdefault myfork
  346. $ git switch \-c mybranch origin/master
  347. $ git rev\-parse \-\-symbolic\-full\-name @{upstream}
  348. refs/remotes/origin/master
  349. $ git rev\-parse \-\-symbolic\-full\-name @{push}
  350. refs/remotes/myfork/mybranch
  351. .fi
  352. .if n \{\
  353. .RE
  354. .\}
  355. .sp
  356. Note in the example that we set up a triangular workflow, where we pull from one location and push to another\&. In a non\-triangular workflow,
  357. \fI@{push}\fR
  358. is the same as
  359. \fI@{upstream}\fR, and there is no need for it\&.
  360. .sp
  361. This suffix is also accepted when spelled in uppercase, and means the same thing no matter the case\&.
  362. .RE
  363. .PP
  364. \fI<rev>^[<n>]\fR, e\&.g\&. \fIHEAD^, v1\&.5\&.1^0\fR
  365. .RS 4
  366. A suffix
  367. \fI^\fR
  368. to a revision parameter means the first parent of that commit object\&.
  369. \fI^<n>\fR
  370. means the <n>th parent (i\&.e\&.
  371. \fI<rev>^\fR
  372. is equivalent to
  373. \fI<rev>^1\fR)\&. As a special rule,
  374. \fI<rev>^0\fR
  375. means the commit itself and is used when
  376. \fI<rev>\fR
  377. is the object name of a tag object that refers to a commit object\&.
  378. .RE
  379. .PP
  380. \fI<rev>~[<n>]\fR, e\&.g\&. \fIHEAD~, master~3\fR
  381. .RS 4
  382. A suffix
  383. \fI~\fR
  384. to a revision parameter means the first parent of that commit object\&. A suffix
  385. \fI~<n>\fR
  386. to a revision parameter means the commit object that is the <n>th generation ancestor of the named commit object, following only the first parents\&. I\&.e\&.
  387. \fI<rev>~3\fR
  388. is equivalent to
  389. \fI<rev>^^^\fR
  390. which is equivalent to
  391. \fI<rev>^1^1^1\fR\&. See below for an illustration of the usage of this form\&.
  392. .RE
  393. .PP
  394. \fI<rev>^{<type>}\fR, e\&.g\&. \fIv0\&.99\&.8^{commit}\fR
  395. .RS 4
  396. A suffix
  397. \fI^\fR
  398. followed by an object type name enclosed in brace pair means dereference the object at
  399. \fI<rev>\fR
  400. recursively until an object of type
  401. \fI<type>\fR
  402. is found or the object cannot be dereferenced anymore (in which case, barf)\&. For example, if
  403. \fI<rev>\fR
  404. is a commit\-ish,
  405. \fI<rev>^{commit}\fR
  406. describes the corresponding commit object\&. Similarly, if
  407. \fI<rev>\fR
  408. is a tree\-ish,
  409. \fI<rev>^{tree}\fR
  410. describes the corresponding tree object\&.
  411. \fI<rev>^0\fR
  412. is a short\-hand for
  413. \fI<rev>^{commit}\fR\&.
  414. .sp
  415. \fI<rev>^{object}\fR
  416. can be used to make sure
  417. \fI<rev>\fR
  418. names an object that exists, without requiring
  419. \fI<rev>\fR
  420. to be a tag, and without dereferencing
  421. \fI<rev>\fR; because a tag is already an object, it does not have to be dereferenced even once to get to an object\&.
  422. .sp
  423. \fI<rev>^{tag}\fR
  424. can be used to ensure that
  425. \fI<rev>\fR
  426. identifies an existing tag object\&.
  427. .RE
  428. .PP
  429. \fI<rev>^{}\fR, e\&.g\&. \fIv0\&.99\&.8^{}\fR
  430. .RS 4
  431. A suffix
  432. \fI^\fR
  433. followed by an empty brace pair means the object could be a tag, and dereference the tag recursively until a non\-tag object is found\&.
  434. .RE
  435. .PP
  436. \fI<rev>^{/<text>}\fR, e\&.g\&. \fIHEAD^{/fix nasty bug}\fR
  437. .RS 4
  438. A suffix
  439. \fI^\fR
  440. to a revision parameter, followed by a brace pair that contains a text led by a slash, is the same as the
  441. \fI:/fix nasty bug\fR
  442. syntax below except that it returns the youngest matching commit which is reachable from the
  443. \fI<rev>\fR
  444. before
  445. \fI^\fR\&.
  446. .RE
  447. .PP
  448. \fI:/<text>\fR, e\&.g\&. \fI:/fix nasty bug\fR
  449. .RS 4
  450. A colon, followed by a slash, followed by a text, names a commit whose commit message matches the specified regular expression\&. This name returns the youngest matching commit which is reachable from any ref, including HEAD\&. The regular expression can match any part of the commit message\&. To match messages starting with a string, one can use e\&.g\&.
  451. \fI:/^foo\fR\&. The special sequence
  452. \fI:/!\fR
  453. is reserved for modifiers to what is matched\&.
  454. \fI:/!\-foo\fR
  455. performs a negative match, while
  456. \fI:/!!foo\fR
  457. matches a literal
  458. \fI!\fR
  459. character, followed by
  460. \fIfoo\fR\&. Any other sequence beginning with
  461. \fI:/!\fR
  462. is reserved for now\&. Depending on the given text, the shell\(cqs word splitting rules might require additional quoting\&.
  463. .RE
  464. .PP
  465. \fI<rev>:<path>\fR, e\&.g\&. \fIHEAD:README\fR, \fImaster:\&./README\fR
  466. .RS 4
  467. A suffix
  468. \fI:\fR
  469. followed by a path names the blob or tree at the given path in the tree\-ish object named by the part before the colon\&. A path starting with
  470. \fI\&./\fR
  471. or
  472. \fI\&.\&./\fR
  473. is relative to the current working directory\&. The given path will be converted to be relative to the working tree\(cqs root directory\&. This is most useful to address a blob or tree from a commit or tree that has the same tree structure as the working tree\&.
  474. .RE
  475. .PP
  476. \fI:[<n>:]<path>\fR, e\&.g\&. \fI:0:README\fR, \fI:README\fR
  477. .RS 4
  478. A colon, optionally followed by a stage number (0 to 3) and a colon, followed by a path, names a blob object in the index at the given path\&. A missing stage number (and the colon that follows it) names a stage 0 entry\&. During a merge, stage 1 is the common ancestor, stage 2 is the target branch\(cqs version (typically the current branch), and stage 3 is the version from the branch which is being merged\&.
  479. .RE
  480. .sp
  481. Here is an illustration, by Jon Loeliger\&. Both commit nodes B and C are parents of commit node A\&. Parent commits are ordered left\-to\-right\&.
  482. .sp
  483. .if n \{\
  484. .RS 4
  485. .\}
  486. .nf
  487. G H I J
  488. \e / \e /
  489. D E F
  490. \e | / \e
  491. \e | / |
  492. \e|/ |
  493. B C
  494. \e /
  495. \e /
  496. A
  497. .fi
  498. .if n \{\
  499. .RE
  500. .\}
  501. .sp
  502. .if n \{\
  503. .RS 4
  504. .\}
  505. .nf
  506. A = = A^0
  507. B = A^ = A^1 = A~1
  508. C = = A^2
  509. D = A^^ = A^1^1 = A~2
  510. E = B^2 = A^^2
  511. F = B^3 = A^^3
  512. G = A^^^ = A^1^1^1 = A~3
  513. H = D^2 = B^^2 = A^^^2 = A~2^2
  514. I = F^ = B^3^ = A^^3^
  515. J = F^2 = B^3^2 = A^^3^2
  516. .fi
  517. .if n \{\
  518. .RE
  519. .\}
  520. .SH "SPECIFYING RANGES"
  521. .sp
  522. History traversing commands such as \fBgit\fR \fBlog\fR operate on a set of commits, not just a single commit\&.
  523. .sp
  524. For these commands, specifying a single revision, using the notation described in the previous section, means the set of commits \fBreachable\fR from the given commit\&.
  525. .sp
  526. Specifying several revisions means the set of commits reachable from any of the given commits\&.
  527. .sp
  528. A commit\(cqs reachable set is the commit itself and the commits in its ancestry chain\&.
  529. .sp
  530. There are several notations to specify a set of connected commits (called a "revision range"), illustrated below\&.
  531. .SS "Commit Exclusions"
  532. .PP
  533. \fI^<rev>\fR (caret) Notation
  534. .RS 4
  535. To exclude commits reachable from a commit, a prefix
  536. \fI^\fR
  537. notation is used\&. E\&.g\&.
  538. \fI^r1 r2\fR
  539. means commits reachable from
  540. \fIr2\fR
  541. but exclude the ones reachable from
  542. \fIr1\fR
  543. (i\&.e\&.
  544. \fIr1\fR
  545. and its ancestors)\&.
  546. .RE
  547. .SS "Dotted Range Notations"
  548. .PP
  549. The \fI\&.\&.\fR (two\-dot) Range Notation
  550. .RS 4
  551. The
  552. \fI^r1 r2\fR
  553. set operation appears so often that there is a shorthand for it\&. When you have two commits
  554. \fIr1\fR
  555. and
  556. \fIr2\fR
  557. (named according to the syntax explained in SPECIFYING REVISIONS above), you can ask for commits that are reachable from r2 excluding those that are reachable from r1 by
  558. \fI^r1 r2\fR
  559. and it can be written as
  560. \fIr1\&.\&.r2\fR\&.
  561. .RE
  562. .PP
  563. The \fI\&.\&.\&.\fR (three\-dot) Symmetric Difference Notation
  564. .RS 4
  565. A similar notation
  566. \fIr1\&.\&.\&.r2\fR
  567. is called symmetric difference of
  568. \fIr1\fR
  569. and
  570. \fIr2\fR
  571. and is defined as
  572. \fIr1 r2 \-\-not $(git merge\-base \-\-all r1 r2)\fR\&. It is the set of commits that are reachable from either one of
  573. \fIr1\fR
  574. (left side) or
  575. \fIr2\fR
  576. (right side) but not from both\&.
  577. .RE
  578. .sp
  579. In these two shorthand notations, you can omit one end and let it default to HEAD\&. For example, \fIorigin\&.\&.\fR is a shorthand for \fIorigin\&.\&.HEAD\fR and asks "What did I do since I forked from the origin branch?" Similarly, \fI\&.\&.origin\fR is a shorthand for \fIHEAD\&.\&.origin\fR and asks "What did the origin do since I forked from them?" Note that \fI\&.\&.\fR would mean \fIHEAD\&.\&.HEAD\fR which is an empty range that is both reachable and unreachable from HEAD\&.
  580. .sp
  581. Commands that are specifically designed to take two distinct ranges (e\&.g\&. "git range\-diff R1 R2" to compare two ranges) do exist, but they are exceptions\&. Unless otherwise noted, all "git" commands that operate on a set of commits work on a single revision range\&. In other words, writing two "two\-dot range notation" next to each other, e\&.g\&.
  582. .sp
  583. .if n \{\
  584. .RS 4
  585. .\}
  586. .nf
  587. $ git log A\&.\&.B C\&.\&.D
  588. .fi
  589. .if n \{\
  590. .RE
  591. .\}
  592. .sp
  593. does \fBnot\fR specify two revision ranges for most commands\&. Instead it will name a single connected set of commits, i\&.e\&. those that are reachable from either B or D but are reachable from neither A or C\&. In a linear history like this:
  594. .sp
  595. .if n \{\
  596. .RS 4
  597. .\}
  598. .nf
  599. \-\-\-A\-\-\-B\-\-\-o\-\-\-o\-\-\-C\-\-\-D
  600. .fi
  601. .if n \{\
  602. .RE
  603. .\}
  604. .sp
  605. because A and B are reachable from C, the revision range specified by these two dotted ranges is a single commit D\&.
  606. .SS "Other <rev>^ Parent Shorthand Notations"
  607. .sp
  608. Three other shorthands exist, particularly useful for merge commits, for naming a set that is formed by a commit and its parent commits\&.
  609. .sp
  610. The \fIr1^@\fR notation means all parents of \fIr1\fR\&.
  611. .sp
  612. The \fIr1^!\fR notation includes commit \fIr1\fR but excludes all of its parents\&. By itself, this notation denotes the single commit \fIr1\fR\&.
  613. .sp
  614. The \fI<rev>^\-[<n>]\fR notation includes \fI<rev>\fR but excludes the <n>th parent (i\&.e\&. a shorthand for \fI<rev>^<n>\&.\&.<rev>\fR), with \fI<n>\fR = 1 if not given\&. This is typically useful for merge commits where you can just pass \fI<commit>^\-\fR to get all the commits in the branch that was merged in merge commit \fI<commit>\fR (including \fI<commit>\fR itself)\&.
  615. .sp
  616. While \fI<rev>^<n>\fR was about specifying a single commit parent, these three notations also consider its parents\&. For example you can say \fIHEAD^2^@\fR, however you cannot say \fIHEAD^@^2\fR\&.
  617. .SH "REVISION RANGE SUMMARY"
  618. .PP
  619. \fI<rev>\fR
  620. .RS 4
  621. Include commits that are reachable from <rev> (i\&.e\&. <rev> and its ancestors)\&.
  622. .RE
  623. .PP
  624. \fI^<rev>\fR
  625. .RS 4
  626. Exclude commits that are reachable from <rev> (i\&.e\&. <rev> and its ancestors)\&.
  627. .RE
  628. .PP
  629. \fI<rev1>\&.\&.<rev2>\fR
  630. .RS 4
  631. Include commits that are reachable from <rev2> but exclude those that are reachable from <rev1>\&. When either <rev1> or <rev2> is omitted, it defaults to
  632. \fBHEAD\fR\&.
  633. .RE
  634. .PP
  635. \fI<rev1>\&.\&.\&.<rev2>\fR
  636. .RS 4
  637. Include commits that are reachable from either <rev1> or <rev2> but exclude those that are reachable from both\&. When either <rev1> or <rev2> is omitted, it defaults to
  638. \fBHEAD\fR\&.
  639. .RE
  640. .PP
  641. \fI<rev>^@\fR, e\&.g\&. \fIHEAD^@\fR
  642. .RS 4
  643. A suffix
  644. \fI^\fR
  645. followed by an at sign is the same as listing all parents of
  646. \fI<rev>\fR
  647. (meaning, include anything reachable from its parents, but not the commit itself)\&.
  648. .RE
  649. .PP
  650. \fI<rev>^!\fR, e\&.g\&. \fIHEAD^!\fR
  651. .RS 4
  652. A suffix
  653. \fI^\fR
  654. followed by an exclamation mark is the same as giving commit
  655. \fI<rev>\fR
  656. and all its parents prefixed with
  657. \fI^\fR
  658. to exclude them (and their ancestors)\&.
  659. .RE
  660. .PP
  661. \fI<rev>^\-<n>\fR, e\&.g\&. \fIHEAD^\-, HEAD^\-2\fR
  662. .RS 4
  663. Equivalent to
  664. \fI<rev>^<n>\&.\&.<rev>\fR, with
  665. \fI<n>\fR
  666. = 1 if not given\&.
  667. .RE
  668. .sp
  669. Here are a handful of examples using the Loeliger illustration above, with each step in the notation\(cqs expansion and selection carefully spelt out:
  670. .sp
  671. .if n \{\
  672. .RS 4
  673. .\}
  674. .nf
  675. Args Expanded arguments Selected commits
  676. D G H D
  677. D F G H I J D F
  678. ^G D H D
  679. ^D B E I J F B
  680. ^D B C E I J F B C
  681. C I J F C
  682. B\&.\&.C = ^B C C
  683. B\&.\&.\&.C = B ^F C G H D E B C
  684. B^\- = B^\&.\&.B
  685. = ^B^1 B E I J F B
  686. C^@ = C^1
  687. = F I J F
  688. B^@ = B^1 B^2 B^3
  689. = D E F D G H E F I J
  690. C^! = C ^C^@
  691. = C ^C^1
  692. = C ^F C
  693. B^! = B ^B^@
  694. = B ^B^1 ^B^2 ^B^3
  695. = B ^D ^E ^F B
  696. F^! D = F ^I ^J D G H D F
  697. .fi
  698. .if n \{\
  699. .RE
  700. .\}
  701. .SH "SEE ALSO"
  702. .sp
  703. \fBgit-rev-parse\fR(1)
  704. .SH "GIT"
  705. .sp
  706. Part of the \fBgit\fR(1) suite