rebase -i: introduce --rebase-merges=[no-]rebase-cousins

When running `git rebase --rebase-merges` non-interactively with an
ancestor of HEAD as <upstream> (or leaving the todo list unmodified),
we would ideally recreate the exact same commits as before the rebase.

However, if there are commits in the commit range <upstream>.. that do not
have <upstream> as direct ancestor (i.e. if `git log <upstream>..` would
show commits that are omitted by `git log --ancestry-path <upstream>..`),
this is currently not the case: we would turn them into commits that have
<upstream> as direct ancestor.

Let's illustrate that with a diagram:

        C
      /   \
A - B - E - F
  \   /
    D

Currently, after running `git rebase -i --rebase-merges B`, the new branch
structure would be (pay particular attention to the commit `D`):

       --- C' --
      /         \
A - B ------ E' - F'
      \    /
        D'

This is not really preserving the branch topology from before! The
reason is that the commit `D` does not have `B` as ancestor, and
therefore it gets rebased onto `B`.

This is unintuitive behavior. Even worse, when recreating branch
structure, most use cases would appear to want cousins *not* to be
rebased onto the new base commit. For example, Git for Windows (the
heaviest user of the Git garden shears, which served as the blueprint
for --rebase-merges) frequently merges branches from `next` early, and
these branches certainly do *not* want to be rebased. In the example
above, the desired outcome would look like this:

       --- C' --
      /         \
A - B ------ E' - F'
  \        /
   -- D' --

Let's introduce the term "cousins" for such commits ("D" in the
example), and let's not rebase them by default. For hypothetical
use cases where cousins *do* need to be rebased, `git rebase
--rebase=merges=rebase-cousins` needs to be used.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 files changed
tree: 86fdce64f8c39f3994e2c6635f2cd3070b17d434
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. perl/
  14. po/
  15. ppc/
  16. refs/
  17. sha1dc/
  18. t/
  19. templates/
  20. vcs-svn/
  21. xdiff/
  22. .clang-format
  23. .gitattributes
  24. .gitignore
  25. .gitmodules
  26. .mailmap
  27. .travis.yml
  28. .tsan-suppressions
  29. abspath.c
  30. aclocal.m4
  31. advice.c
  32. advice.h
  33. alias.c
  34. alloc.c
  35. apply.c
  36. apply.h
  37. archive-tar.c
  38. archive-zip.c
  39. archive.c
  40. archive.h
  41. argv-array.c
  42. argv-array.h
  43. attr.c
  44. attr.h
  45. base85.c
  46. bisect.c
  47. bisect.h
  48. blame.c
  49. blame.h
  50. blob.c
  51. blob.h
  52. branch.c
  53. branch.h
  54. builtin.h
  55. bulk-checkin.c
  56. bulk-checkin.h
  57. bundle.c
  58. bundle.h
  59. cache-tree.c
  60. cache-tree.h
  61. cache.h
  62. chdir-notify.c
  63. chdir-notify.h
  64. check-builtins.sh
  65. check-racy.c
  66. check_bindir
  67. checkout.c
  68. checkout.h
  69. color.c
  70. color.h
  71. column.c
  72. column.h
  73. combine-diff.c
  74. command-list.txt
  75. commit-slab.h
  76. commit.c
  77. commit.h
  78. common-main.c
  79. config.c
  80. config.h
  81. config.mak.in
  82. config.mak.uname
  83. configure.ac
  84. connect.c
  85. connect.h
  86. connected.c
  87. connected.h
  88. convert.c
  89. convert.h
  90. copy.c
  91. COPYING
  92. credential-cache--daemon.c
  93. credential-cache.c
  94. credential-store.c
  95. credential.c
  96. credential.h
  97. csum-file.c
  98. csum-file.h
  99. ctype.c
  100. daemon.c
  101. date.c
  102. decorate.c
  103. decorate.h
  104. delta.h
  105. diff-delta.c
  106. diff-lib.c
  107. diff-no-index.c
  108. diff.c
  109. diff.h
  110. diffcore-break.c
  111. diffcore-delta.c
  112. diffcore-order.c
  113. diffcore-pickaxe.c
  114. diffcore-rename.c
  115. diffcore.h
  116. dir-iterator.c
  117. dir-iterator.h
  118. dir.c
  119. dir.h
  120. editor.c
  121. entry.c
  122. environment.c
  123. exec-cmd.c
  124. exec-cmd.h
  125. fast-import.c
  126. fetch-object.c
  127. fetch-object.h
  128. fetch-pack.c
  129. fetch-pack.h
  130. fmt-merge-msg.h
  131. fsck.c
  132. fsck.h
  133. fsmonitor.c
  134. fsmonitor.h
  135. generate-cmdlist.sh
  136. gettext.c
  137. gettext.h
  138. git-add--interactive.perl
  139. git-archimport.perl
  140. git-bisect.sh
  141. git-compat-util.h
  142. git-cvsexportcommit.perl
  143. git-cvsimport.perl
  144. git-cvsserver.perl
  145. git-difftool--helper.sh
  146. git-filter-branch.sh
  147. git-instaweb.sh
  148. git-merge-octopus.sh
  149. git-merge-one-file.sh
  150. git-merge-resolve.sh
  151. git-mergetool--lib.sh
  152. git-mergetool.sh
  153. git-p4.py
  154. git-parse-remote.sh
  155. git-quiltimport.sh
  156. git-rebase--am.sh
  157. git-rebase--interactive.sh
  158. git-rebase--merge.sh
  159. git-rebase.sh
  160. git-remote-testgit.sh
  161. git-request-pull.sh
  162. git-send-email.perl
  163. git-sh-i18n.sh
  164. git-sh-setup.sh
  165. git-stash.sh
  166. git-submodule.sh
  167. git-svn.perl
  168. GIT-VERSION-GEN
  169. git-web--browse.sh
  170. git.c
  171. git.rc
  172. gpg-interface.c
  173. gpg-interface.h
  174. graph.c
  175. graph.h
  176. grep.c
  177. grep.h
  178. hash.h
  179. hashmap.c
  180. hashmap.h
  181. help.c
  182. help.h
  183. hex.c
  184. http-backend.c
  185. http-fetch.c
  186. http-push.c
  187. http-walker.c
  188. http.c
  189. http.h
  190. ident.c
  191. imap-send.c
  192. INSTALL
  193. iterator.h
  194. khash.h
  195. kwset.c
  196. kwset.h
  197. levenshtein.c
  198. levenshtein.h
  199. LGPL-2.1
  200. line-log.c
  201. line-log.h
  202. line-range.c
  203. line-range.h
  204. list-objects-filter-options.c
  205. list-objects-filter-options.h
  206. list-objects-filter.c
  207. list-objects-filter.h
  208. list-objects.c
  209. list-objects.h
  210. list.h
  211. ll-merge.c
  212. ll-merge.h
  213. lockfile.c
  214. lockfile.h
  215. log-tree.c
  216. log-tree.h
  217. mailinfo.c
  218. mailinfo.h
  219. mailmap.c
  220. mailmap.h
  221. Makefile
  222. match-trees.c
  223. mem-pool.c
  224. mem-pool.h
  225. merge-blobs.c
  226. merge-blobs.h
  227. merge-recursive.c
  228. merge-recursive.h
  229. merge.c
  230. mergesort.c
  231. mergesort.h
  232. name-hash.c
  233. notes-cache.c
  234. notes-cache.h
  235. notes-merge.c
  236. notes-merge.h
  237. notes-utils.c
  238. notes-utils.h
  239. notes.c
  240. notes.h
  241. object-store.h
  242. object.c
  243. object.h
  244. oidmap.c
  245. oidmap.h
  246. oidset.c
  247. oidset.h
  248. pack-bitmap-write.c
  249. pack-bitmap.c
  250. pack-bitmap.h
  251. pack-check.c
  252. pack-objects.c
  253. pack-objects.h
  254. pack-revindex.c
  255. pack-revindex.h
  256. pack-write.c
  257. pack.h
  258. packfile.c
  259. packfile.h
  260. pager.c
  261. parse-options-cb.c
  262. parse-options.c
  263. parse-options.h
  264. patch-delta.c
  265. patch-ids.c
  266. patch-ids.h
  267. path.c
  268. path.h
  269. pathspec.c
  270. pathspec.h
  271. pkt-line.c
  272. pkt-line.h
  273. preload-index.c
  274. pretty.c
  275. pretty.h
  276. prio-queue.c
  277. prio-queue.h
  278. progress.c
  279. progress.h
  280. prompt.c
  281. prompt.h
  282. protocol.c
  283. protocol.h
  284. quote.c
  285. quote.h
  286. reachable.c
  287. reachable.h
  288. read-cache.c
  289. README.md
  290. ref-filter.c
  291. ref-filter.h
  292. reflog-walk.c
  293. reflog-walk.h
  294. refs.c
  295. refs.h
  296. remote-curl.c
  297. remote-testsvn.c
  298. remote.c
  299. remote.h
  300. replace-object.c
  301. repository.c
  302. repository.h
  303. rerere.c
  304. rerere.h
  305. resolve-undo.c
  306. resolve-undo.h
  307. revision.c
  308. revision.h
  309. run-command.c
  310. run-command.h
  311. send-pack.c
  312. send-pack.h
  313. sequencer.c
  314. sequencer.h
  315. server-info.c
  316. setup.c
  317. sh-i18n--envsubst.c
  318. sha1-array.c
  319. sha1-array.h
  320. sha1-file.c
  321. sha1-lookup.c
  322. sha1-lookup.h
  323. sha1-name.c
  324. sha1dc_git.c
  325. sha1dc_git.h
  326. shallow.c
  327. shell.c
  328. shortlog.h
  329. show-index.c
  330. sideband.c
  331. sideband.h
  332. sigchain.c
  333. sigchain.h
  334. split-index.c
  335. split-index.h
  336. strbuf.c
  337. strbuf.h
  338. streaming.c
  339. streaming.h
  340. string-list.c
  341. string-list.h
  342. sub-process.c
  343. sub-process.h
  344. submodule-config.c
  345. submodule-config.h
  346. submodule.c
  347. submodule.h
  348. symlinks.c
  349. tag.c
  350. tag.h
  351. tar.h
  352. tempfile.c
  353. tempfile.h
  354. thread-utils.c
  355. thread-utils.h
  356. tmp-objdir.c
  357. tmp-objdir.h
  358. trace.c
  359. trace.h
  360. trailer.c
  361. trailer.h
  362. transport-helper.c
  363. transport-internal.h
  364. transport.c
  365. transport.h
  366. tree-diff.c
  367. tree-walk.c
  368. tree-walk.h
  369. tree.c
  370. tree.h
  371. unicode-width.h
  372. unimplemented.sh
  373. unix-socket.c
  374. unix-socket.h
  375. unpack-trees.c
  376. unpack-trees.h
  377. upload-pack.c
  378. url.c
  379. url.h
  380. urlmatch.c
  381. urlmatch.h
  382. usage.c
  383. userdiff.c
  384. userdiff.h
  385. utf8.c
  386. utf8.h
  387. varint.c
  388. varint.h
  389. version.c
  390. version.h
  391. versioncmp.c
  392. walker.c
  393. walker.h
  394. wildmatch.c
  395. wildmatch.h
  396. worktree.c
  397. worktree.h
  398. wrap-for-bin.sh
  399. wrapper.c
  400. write-or-die.c
  401. ws.c
  402. wt-status.c
  403. wt-status.h
  404. xdiff-interface.c
  405. xdiff-interface.h
  406. zlib.c
README.md

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://public-inbox.org/git/, http://marc.info/?l=git and other archival sites.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks