Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7827 lines
297 KiB

4 years ago
  1. This is magit.info, produced by makeinfo version 6.5 from magit.texi.
  2. Copyright (C) 2015-2019 Jonas Bernoulli <jonas@bernoul.li>
  3. You can redistribute this document and/or modify it under the terms
  4. of the GNU General Public License as published by the Free Software
  5. Foundation, either version 3 of the License, or (at your option)
  6. any later version.
  7. This document is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. INFO-DIR-SECTION Emacs
  12. START-INFO-DIR-ENTRY
  13. * Magit: (magit). Using Git from Emacs with Magit.
  14. END-INFO-DIR-ENTRY
  15. 
  16. File: magit.info, Node: Top, Next: Introduction, Up: (dir)
  17. Magit User Manual
  18. *****************
  19. Magit is an interface to the version control system Git, implemented as
  20. an Emacs package. Magit aspires to be a complete Git porcelain. While
  21. we cannot (yet) claim that Magit wraps and improves upon each and every
  22. Git command, it is complete enough to allow even experienced Git users
  23. to perform almost all of their daily version control tasks directly from
  24. within Emacs. While many fine Git clients exist, only Magit and Git
  25. itself deserve to be called porcelains.
  26. This manual is for Magit version 2.90.1 (v2.90.1-721-g2657293c6+1).
  27. Copyright (C) 2015-2019 Jonas Bernoulli <jonas@bernoul.li>
  28. You can redistribute this document and/or modify it under the terms
  29. of the GNU General Public License as published by the Free Software
  30. Foundation, either version 3 of the License, or (at your option)
  31. any later version.
  32. This document is distributed in the hope that it will be useful,
  33. but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  35. General Public License for more details.
  36. * Menu:
  37. * Introduction::
  38. * Installation::
  39. * Getting Started::
  40. * Interface Concepts::
  41. * Inspecting::
  42. * Manipulating::
  43. * Transferring::
  44. * Miscellaneous::
  45. * Customizing::
  46. * Plumbing::
  47. * FAQ::
  48. * Debugging Tools::
  49. * Keystroke Index::
  50. * Command Index::
  51. * Function Index::
  52. * Variable Index::
  53. — The Detailed Node Listing —
  54. Installation
  55. * Installing from Melpa::
  56. * Installing from the Git Repository::
  57. * Post-Installation Tasks::
  58. Interface Concepts
  59. * Modes and Buffers::
  60. * Sections::
  61. * Transient Commands::
  62. * Transient Arguments and Buffer Variables::
  63. * Completion, Confirmation and the Selection: Completion Confirmation and the Selection.
  64. * Running Git::
  65. Modes and Buffers
  66. * Switching Buffers::
  67. * Naming Buffers::
  68. * Quitting Windows::
  69. * Automatic Refreshing of Magit Buffers::
  70. * Automatic Saving of File-Visiting Buffers::
  71. * Automatic Reverting of File-Visiting Buffers::
  72. Sections
  73. * Section Movement::
  74. * Section Visibility::
  75. * Section Hooks::
  76. * Section Types and Values::
  77. * Section Options::
  78. Completion, Confirmation and the Selection
  79. * Action Confirmation::
  80. * Completion and Confirmation::
  81. * The Selection::
  82. * The hunk-internal region::
  83. * Support for Completion Frameworks::
  84. * Additional Completion Options::
  85. Running Git
  86. * Viewing Git Output::
  87. * Git Process Status::
  88. * Running Git Manually::
  89. * Git Executable::
  90. * Global Git Arguments::
  91. Inspecting
  92. * Status Buffer::
  93. * Repository List::
  94. * Logging::
  95. * Diffing::
  96. * Ediffing::
  97. * References Buffer::
  98. * Bisecting::
  99. * Visiting Files and Blobs::
  100. * Blaming::
  101. Status Buffer
  102. * Status Sections::
  103. * Status Header Sections::
  104. * Status Module Sections::
  105. * Status Options::
  106. Logging
  107. * Refreshing Logs::
  108. * Log Buffer::
  109. * Log Margin::
  110. * Select from Log::
  111. * Reflog::
  112. * Cherries::
  113. Diffing
  114. * Refreshing Diffs::
  115. * Commands Available in Diffs::
  116. * Diff Options::
  117. * Revision Buffer::
  118. References Buffer
  119. * References Sections::
  120. Visiting Files and Blobs
  121. * General-Purpose Visit Commands::
  122. * Visiting Files and Blobs from a Diff::
  123. Manipulating
  124. * Creating Repository::
  125. * Cloning Repository::
  126. * Staging and Unstaging::
  127. * Applying::
  128. * Committing::
  129. * Branching::
  130. * Merging::
  131. * Resolving Conflicts::
  132. * Rebasing::
  133. * Cherry Picking::
  134. * Resetting::
  135. * Stashing::
  136. Staging and Unstaging
  137. * Staging from File-Visiting Buffers::
  138. Committing
  139. * Initiating a Commit::
  140. * Editing Commit Messages::
  141. Branching
  142. * The Two Remotes::
  143. * Branch Commands::
  144. * Branch Git Variables::
  145. * Auxiliary Branch Commands::
  146. Rebasing
  147. * Editing Rebase Sequences::
  148. * Information About In-Progress Rebase::
  149. Cherry Picking
  150. * Reverting::
  151. Transferring
  152. * Remotes::
  153. * Fetching::
  154. * Pulling::
  155. * Pushing::
  156. * Plain Patches::
  157. * Maildir Patches::
  158. Remotes
  159. * Remote Commands::
  160. * Remote Git Variables::
  161. Miscellaneous
  162. * Tagging::
  163. * Notes::
  164. * Submodules::
  165. * Subtree::
  166. * Worktree::
  167. * Common Commands::
  168. * Wip Modes::
  169. * Minor Mode for Buffers Visiting Files::
  170. * Minor Mode for Buffers Visiting Blobs::
  171. Submodules
  172. * Listing Submodules::
  173. * Submodule Transient::
  174. Wip Modes
  175. * Wip Graph::
  176. * Legacy Wip Modes::
  177. Customizing
  178. * Per-Repository Configuration::
  179. * Essential Settings::
  180. Essential Settings
  181. * Safety::
  182. * Performance::
  183. Plumbing
  184. * Calling Git::
  185. * Section Plumbing::
  186. * Refreshing Buffers::
  187. * Conventions::
  188. Calling Git
  189. * Getting a Value from Git::
  190. * Calling Git for Effect::
  191. Section Plumbing
  192. * Creating Sections::
  193. * Section Selection::
  194. * Matching Sections::
  195. Conventions
  196. * Theming Faces::
  197. FAQ
  198. * FAQ - How to ...?::
  199. * FAQ - Issues and Errors::
  200. FAQ - How to ...?
  201. * How to show git's output?::
  202. * How to install the gitman info manual?::
  203. * How to show diffs for gpg-encrypted files?::
  204. * How does branching and pushing work?::
  205. * Can Magit be used as ediff-version-control-package?::
  206. FAQ - Issues and Errors
  207. * Magit is slow::
  208. * I changed several thousand files at once and now Magit is unusable::
  209. * I am having problems committing::
  210. * I am using MS Windows and cannot push with Magit::
  211. * I am using OS X and SOMETHING works in shell, but not in Magit: I am using OS X and SOMETHING works in shell but not in Magit.
  212. * Diffs contain control sequences::
  213. * Expanding a file to show the diff causes it to disappear::
  214. * Point is wrong in the COMMIT_EDITMSG buffer::
  215. * The mode-line information isn't always up-to-date::
  216. * A branch and tag sharing the same name breaks SOMETHING::
  217. * My Git hooks work on the command-line but not inside Magit::
  218. * git-commit-mode isn't used when committing from the command-line::
  219. * Point ends up inside invisible text when jumping to a file-visiting buffer::
  220. 
  221. File: magit.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top
  222. 1 Introduction
  223. **************
  224. Magit is an interface to the version control system Git, implemented as
  225. an Emacs package. Magit aspires to be a complete Git porcelain. While
  226. we cannot (yet) claim that Magit wraps and improves upon each and every
  227. Git command, it is complete enough to allow even experienced Git users
  228. to perform almost all of their daily version control tasks directly from
  229. within Emacs. While many fine Git clients exist, only Magit and Git
  230. itself deserve to be called porcelains.
  231. Staging and otherwise applying changes is one of the most important
  232. features in a Git porcelain and here Magit outshines anything else,
  233. including Git itself. Git’s own staging interface (‘git add --patch’)
  234. is so cumbersome that many users only use it in exceptional cases. In
  235. Magit staging a hunk or even just part of a hunk is as trivial as
  236. staging all changes made to a file.
  237. The most visible part of Magit’s interface is the status buffer,
  238. which displays information about the current repository. Its content is
  239. created by running several Git commands and making their output
  240. actionable. Among other things, it displays information about the
  241. current branch, lists unpulled and unpushed changes and contains
  242. sections displaying the staged and unstaged changes. That might sound
  243. noisy, but, since sections are collapsible, it’s not.
  244. To stage or unstage a change one places the cursor on the change and
  245. then types ‘s’ or ‘u’. The change can be a file or a hunk, or when the
  246. region is active (i.e. when there is a selection) several files or
  247. hunks, or even just part of a hunk. The change or changes that these
  248. commands - and many others - would act on are highlighted.
  249. Magit also implements several other "apply variants" in addition to
  250. staging and unstaging. One can discard or reverse a change, or apply it
  251. to the working tree. Git’s own porcelain only supports this for staging
  252. and unstaging and you would have to do something like ‘git diff ... |
  253. ??? | git apply ...’ to discard, revert, or apply a single hunk on the
  254. command line. In fact that’s exactly what Magit does internally (which
  255. is what lead to the term "apply variants").
  256. Magit isn’t just for Git experts, but it does assume some prior
  257. experience with Git as well as Emacs. That being said, many users have
  258. reported that using Magit was what finally taught them what Git is
  259. capable of and how to use it to its fullest. Other users wished they
  260. had switched to Emacs sooner so that they would have gotten their hands
  261. on Magit earlier.
  262. While one has to know the basic features of Emacs to be able to make
  263. full use of Magit, acquiring just enough Emacs skills doesn’t take long
  264. and is worth it, even for users who prefer other editors. Vim users are
  265. advised to give Evil (https://bitbucket.org/lyro/evil/wiki/Home), the
  266. "Extensible VI Layer for Emacs", and Spacemacs
  267. (https://github.com/syl20bnr/spacemacs), an "Emacs starter-kit focused
  268. on Evil" a try.
  269. Magit provides a consistent and efficient Git porcelain. After a
  270. short learning period, you will be able to perform most of your daily
  271. version control tasks faster than you would on the command line. You
  272. will likely also start using features that seemed too daunting in the
  273. past.
  274. Magit fully embraces Git. It exposes many advanced features using a
  275. simple but flexible interface instead of only wrapping the trivial ones
  276. like many GUI clients do. Of course Magit supports logging, cloning,
  277. pushing, and other commands that usually don’t fail in spectacular ways;
  278. but it also supports tasks that often cannot be completed in a single
  279. step. Magit fully supports tasks such as merging, rebasing,
  280. cherry-picking, reverting, and blaming by not only providing a command
  281. to initiate these tasks but also by displaying context sensitive
  282. information along the way and providing commands that are useful for
  283. resolving conflicts and resuming the sequence after doing so.
  284. Magit wraps and in many cases improves upon at least the following
  285. Git porcelain commands: ‘add’, ‘am’, ‘bisect’, ‘blame’, ‘branch’,
  286. ‘checkout’, ‘cherry’, ‘cherry-pick’, ‘clean’, ‘clone’, ‘commit’,
  287. ‘config’, ‘describe’, ‘diff’, ‘fetch’, ‘format-patch’, ‘init’, ‘log’,
  288. ‘merge’, ‘merge-tree’, ‘mv’, ‘notes’, ‘pull’, ‘rebase’, ‘reflog’,
  289. ‘remote’, ‘request-pull’, ‘reset’, ‘revert’, ‘rm’, ‘show’, ‘stash’,
  290. ‘submodule’, ‘subtree’, ‘tag’, and ‘worktree.’ Many more Magit porcelain
  291. commands are implemented on top of Git plumbing commands.
  292. 
  293. File: magit.info, Node: Installation, Next: Getting Started, Prev: Introduction, Up: Top
  294. 2 Installation
  295. **************
  296. Magit can be installed using Emacs’ package manager or manually from its
  297. development repository.
  298. * Menu:
  299. * Installing from Melpa::
  300. * Installing from the Git Repository::
  301. * Post-Installation Tasks::
  302. 
  303. File: magit.info, Node: Installing from Melpa, Next: Installing from the Git Repository, Up: Installation
  304. 2.1 Installing from Melpa
  305. =========================
  306. Magit is available from Melpa and Melpa-Stable. If you haven’t used
  307. Emacs’ package manager before, then it is high time you familiarize
  308. yourself with it by reading the documentation in the Emacs manual, see
  309. *note (emacs)Packages::. Then add one of the archives to
  310. ‘package-archives’:
  311. • To use Melpa:
  312. (require 'package)
  313. (add-to-list 'package-archives
  314. '("melpa" . "http://melpa.org/packages/") t)
  315. • To use Melpa-Stable:
  316. (require 'package)
  317. (add-to-list 'package-archives
  318. '("melpa-stable" . "http://stable.melpa.org/packages/") t)
  319. Once you have added your preferred archive, you need to update the
  320. local package list using:
  321. M-x package-refresh-contents RET
  322. Once you have done that, you can install Magit and its dependencies
  323. using:
  324. M-x package-install RET magit RET
  325. Now see *note Post-Installation Tasks::.
  326. 
  327. File: magit.info, Node: Installing from the Git Repository, Next: Post-Installation Tasks, Prev: Installing from Melpa, Up: Installation
  328. 2.2 Installing from the Git Repository
  329. ======================================
  330. Magit depends on the ‘dash’, ‘transient’ and ‘with-editor’ libraries
  331. which are available from Melpa and Melpa-Stable. Install them using
  332. ‘M-x package-install RET <package> RET’. Of course you may also install
  333. them manually from their repository.
  334. Then clone the Magit repository:
  335. $ git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit
  336. $ cd ~/.emacs.d/site-lisp/magit
  337. Then compile the libraries and generate the info manuals:
  338. $ make
  339. If you haven’t installed ‘dash’, ‘transient’ and ‘with-editor’ from
  340. Melpa or at ‘/path/to/magit/../<package>’, then you have to tell ‘make’
  341. where to find them. To do so create the file ‘/path/to/magit/config.mk’
  342. with the following content before running ‘make’:
  343. LOAD_PATH = -L /path/to/magit/lisp
  344. LOAD_PATH += -L /path/to/dash
  345. LOAD_PATH += -L /path/to/transient
  346. LOAD_PATH += -L /path/to/with-editor
  347. Finally add this to your init file:
  348. (add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
  349. (require 'magit)
  350. (with-eval-after-load 'info
  351. (info-initialize)
  352. (add-to-list 'Info-directory-list
  353. "~/.emacs.d/site-lisp/magit/Documentation/"))
  354. Note that you have to add the ‘lisp’ subdirectory to the ‘load-path’,
  355. not the top-level of the repository, and that elements of ‘load-path’
  356. should not end with a slash, while those of ‘Info-directory-list’
  357. should.
  358. Instead of requiring the feature ‘magit’, you could load just the
  359. autoload definitions, by loading the file ‘magit-autoloads.el’.
  360. (load "/path/to/magit/lisp/magit-autoloads")
  361. Instead of running Magit directly from the repository by adding that
  362. to the ‘load-path’, you might want to instead install it in some other
  363. directory using ‘sudo make install’ and setting ‘load-path’ accordingly.
  364. To update Magit use:
  365. $ git pull
  366. $ make
  367. At times it might be necessary to run ‘make clean all’ instead.
  368. To view all available targets use ‘make help’.
  369. Now see *note Post-Installation Tasks::.
  370. 
  371. File: magit.info, Node: Post-Installation Tasks, Prev: Installing from the Git Repository, Up: Installation
  372. 2.3 Post-Installation Tasks
  373. ===========================
  374. After installing Magit you should verify that you are indeed using the
  375. Magit, Git, and Emacs releases you think you are using. It’s best to
  376. restart Emacs before doing so, to make sure you are not using an
  377. outdated value for ‘load-path’.
  378. M-x magit-version RET
  379. should display something like
  380. Magit 2.8.0, Git 2.10.2, Emacs 25.1.1, gnu/linux
  381. Then you might also want to read about options that many users likely
  382. want to customize. See *note Essential Settings::.
  383. To be able to follow cross references to Git manpages found in this
  384. manual, you might also have to manually install the ‘gitman’ info
  385. manual, or advice ‘Info-follow-nearest-node’ to instead open the actual
  386. manpage. See *note How to install the gitman info manual?::.
  387. If you are completely new to Magit then see *note Getting Started::.
  388. If you run into problems, then please see the *note FAQ::. Also see
  389. the *note Debugging Tools::.
  390. And last but not least please consider making a donation, to ensure
  391. that I can keep working on Magit. See <https://magit.vc/donations>.
  392. for various donation options.
  393. 
  394. File: magit.info, Node: Getting Started, Next: Interface Concepts, Prev: Installation, Up: Top
  395. 3 Getting Started
  396. *****************
  397. This short tutorial describes the most essential features that many
  398. Magitians use on a daily basis. It only scratches the surface but
  399. should be enough to get you started.
  400. IMPORTANT: It is safest if you clone some repository just for this
  401. tutorial. Alternatively you can use an existing local repository, but
  402. if you do that, then you should commit all uncommitted changes before
  403. proceeding.
  404. To display information about the current Git repository, type ‘M-x
  405. magit-status RET’. You will be using this command a lot, and should
  406. therefore give it a global key binding. This is what we recommend:
  407. (global-set-key (kbd "C-x g") 'magit-status)
  408. Most Magit commands are commonly invoked from the status buffer. It
  409. can be considered the primary interface for interacting with Git using
  410. Magit. Many other Magit buffers may exist at a given time, but they are
  411. often created from this buffer.
  412. Depending on what state your repository is in, this buffer may
  413. contain sections titled "Staged changes", "Unstaged changes", "Unmerged
  414. into origin/master", "Unpushed to origin/master", and many others.
  415. Since we are starting from a safe state, which you can easily return
  416. to (by doing a ‘git reset --hard PRE-MAGIT-STATE’), there currently are
  417. no staged or unstaged changes. Edit some files and save the changes.
  418. Then go back to the status buffer, while at the same time refreshing it,
  419. by typing ‘C-x g’. (When the status buffer, or any Magit buffer for
  420. that matter, is the current buffer, then you can also use just ‘g’ to
  421. refresh it).
  422. Move between sections using ‘p’ and ‘n’. Note that the bodies of
  423. some sections are hidden. Type ‘TAB’ to expand or collapse the section
  424. at point. You can also use ‘C-tab’ to cycle the visibility of the
  425. current section and its children. Move to a file section inside the
  426. section named "Unstaged changes" and type ‘s’ to stage the changes you
  427. have made to that file. That file now appears under "Staged changes".
  428. Magit can stage and unstage individual hunks, not just complete
  429. files. Move to the file you have just staged, expand it using ‘TAB’,
  430. move to one of the hunks using ‘n’, and unstage just that by typing ‘u’.
  431. Note how the staging (‘s’) and unstaging (‘u’) commands operate on the
  432. change at point. Many other commands behave the same way.
  433. You can also un-/stage just part of a hunk. Inside the body of a
  434. hunk section (move there using ‘C-n’), set the mark using ‘C-SPC’ and
  435. move down until some added and/or removed lines fall inside the region
  436. but not all of them. Again type ‘s’ to stage.
  437. It is also possible to un-/stage multiple files at once. Move to a
  438. file section, type ‘C-SPC’, move to the next file using ‘n’, and then
  439. ‘s’ to stage both files. Note that both the mark and point have to be
  440. on the headings of sibling sections for this to work. If the region
  441. looks like it does in other buffers, then it doesn’t select Magit
  442. sections that can be acted on as a unit.
  443. And then of course you want to commit your changes. Type ‘c’. This
  444. shows the available commit commands and arguments in a buffer at the
  445. bottom of the frame. Each command and argument is prefixed with the key
  446. that invokes/sets it. Do not worry about this for now. We want to
  447. create a "normal" commit, which is done by typing ‘c’ again.
  448. Now two new buffers appear. One is for writing the commit message,
  449. the other shows a diff with the changes that you are about to committed.
  450. Write a message and then type ‘C-c C-c’ to actually create the commit.
  451. You probably don’t want to push the commit you just created because
  452. you just committed some random changes, but if that is not the case you
  453. could push it by typing ‘P’ to show all the available push commands and
  454. arguments and then ‘p’ to push to a branch with the same name as the
  455. local branch onto the remote configured as the push-remote. (If the
  456. push-remote is not configured yet, then you would first be prompted for
  457. the remote to push to.)
  458. So far we have mentioned the commit, push, and log transient prefix
  459. commands. These are probably among the transients you will be using the
  460. most, but many others exist. To show a transient that lists all other
  461. transients (as well as the various apply commands and some other
  462. essential commands), type ‘h’. Try a few.
  463. The key bindings in that transient correspond to the bindings in
  464. Magit buffers, including but not limited to the status buffer. So you
  465. could type ‘h d’ to bring up the diff transient, but once you remember
  466. that "d" stands for "diff", you would usually do so by just typing ‘d’.
  467. But this "prefix of prefixes" is useful even once you have memorized all
  468. the bindings, as it can provide easy access to Magit commands from
  469. non-Magit buffers. You should create a global key binding for this
  470. command too:
  471. (global-set-key (kbd "C-x M-g") 'magit-dispatch)
  472. In the same vein, you might also want to enable
  473. ‘global-magit-file-mode’ to get some more Magit key bindings in regular
  474. file-visiting buffers (see *note Minor Mode for Buffers Visiting
  475. Files::).
  476. It is not necessary that you do so now, but if you stick with Magit,
  477. then it is highly recommended that you read the next section too.
  478. 
  479. File: magit.info, Node: Interface Concepts, Next: Inspecting, Prev: Getting Started, Up: Top
  480. 4 Interface Concepts
  481. ********************
  482. * Menu:
  483. * Modes and Buffers::
  484. * Sections::
  485. * Transient Commands::
  486. * Transient Arguments and Buffer Variables::
  487. * Completion, Confirmation and the Selection: Completion Confirmation and the Selection.
  488. * Running Git::
  489. 
  490. File: magit.info, Node: Modes and Buffers, Next: Sections, Up: Interface Concepts
  491. 4.1 Modes and Buffers
  492. =====================
  493. Magit provides several major-modes. For each of these modes there
  494. usually exists only one buffer per repository. Separate modes and thus
  495. buffers exist for commits, diffs, logs, and some other things.
  496. Besides these special purpose buffers, there also exists an overview
  497. buffer, called the *status buffer*. It’s usually from this buffer that
  498. the user invokes Git commands, or creates or visits other buffers.
  499. In this manual we often speak about "Magit buffers". By that we mean
  500. buffers whose major-modes derive from ‘magit-mode’.
  501. ‘M-x magit-toggle-buffer-lock’ (‘magit-toggle-buffer-lock’)
  502. This command locks the current buffer to its value or if the buffer
  503. is already locked, then it unlocks it.
  504. Locking a buffer to its value prevents it from being reused to
  505. display another value. The name of a locked buffer contains its
  506. value, which allows telling it apart from other locked buffers and
  507. the unlocked buffer.
  508. Not all Magit buffers can be locked to their values; for example,
  509. it wouldn’t make sense to lock a status buffer.
  510. There can only be a single unlocked buffer using a certain
  511. major-mode per repository. So when a buffer is being unlocked and
  512. another unlocked buffer already exists for that mode and
  513. repository, then the former buffer is instead deleted and the
  514. latter is displayed in its place.
  515. * Menu:
  516. * Switching Buffers::
  517. * Naming Buffers::
  518. * Quitting Windows::
  519. * Automatic Refreshing of Magit Buffers::
  520. * Automatic Saving of File-Visiting Buffers::
  521. * Automatic Reverting of File-Visiting Buffers::
  522. 
  523. File: magit.info, Node: Switching Buffers, Next: Naming Buffers, Up: Modes and Buffers
  524. 4.1.1 Switching Buffers
  525. -----------------------
  526. -- Function: magit-display-buffer buffer &optional display-function
  527. This function is a wrapper around ‘display-buffer’ and is used to
  528. display any Magit buffer. It displays BUFFER in some window and,
  529. unlike ‘display-buffer’, also selects that window, provided
  530. ‘magit-display-buffer-noselect’ is ‘nil’. It also runs the hooks
  531. mentioned below.
  532. If optional DISPLAY-FUNCTION is non-nil, then that is used to
  533. display the buffer. Usually that is ‘nil’ and the function
  534. specified by ‘magit-display-buffer-function’ is used.
  535. -- Variable: magit-display-buffer-noselect
  536. When this is non-nil, then ‘magit-display-buffer’ only displays the
  537. buffer but forgoes also selecting the window. This variable should
  538. not be set globally, it is only intended to be let-bound, by code
  539. that automatically updates "the other window". This is used for
  540. example when the revision buffer is updated when you move inside
  541. the log buffer.
  542. -- User Option: magit-display-buffer-function
  543. The function specified here is called by ‘magit-display-buffer’
  544. with one argument, a buffer, to actually display that buffer. This
  545. function should call ‘display-buffer’ with that buffer as first and
  546. a list of display actions as second argument.
  547. Magit provides several functions, listed below, that are suitable
  548. values for this option. If you want to use different rules, then a
  549. good way of doing that is to start with a copy of one of these
  550. functions and then adjust it to your needs.
  551. Instead of using a wrapper around ‘display-buffer’, that function
  552. itself can be used here, in which case the display actions have to
  553. be specified by adding them to ‘display-buffer-alist’ instead.
  554. To learn about display actions, see *note (elisp)Choosing a Window
  555. for Display::.
  556. -- Function: magit-display-buffer-traditional buffer
  557. This function is the current default value of the option
  558. ‘magit-display-buffer-function’. Before that option and this
  559. function were added, the behavior was hard-coded in many places all
  560. over the code base but now all the rules are contained in this one
  561. function (except for the "noselect" special case mentioned above).
  562. -- Function: magit-display-buffer-same-window-except-diff-v1
  563. This function displays most buffers in the currently selected
  564. window. If a buffer’s mode derives from ‘magit-diff-mode’ or
  565. ‘magit-process-mode’, it is displayed in another window.
  566. -- Function: magit-display-buffer-fullframe-status-v1
  567. This function fills the entire frame when displaying a status
  568. buffer. Otherwise, it behaves like
  569. ‘magit-display-buffer-traditional’.
  570. -- Function: magit-display-buffer-fullframe-status-topleft-v1
  571. This function fills the entire frame when displaying a status
  572. buffer. It behaves like ‘magit-display-buffer-fullframe-status-v1’
  573. except that it displays buffers that derive from ‘magit-diff-mode’
  574. or ‘magit-process-mode’ to the top or left of the current buffer
  575. rather than to the bottom or right. As a result, Magit buffers
  576. tend to pop up on the same side as they would if
  577. ‘magit-display-buffer-traditional’ were in use.
  578. -- Function: magit-display-buffer-fullcolumn-most-v1
  579. This function displays most buffers so that they fill the entire
  580. height of the frame. However, the buffer is displayed in another
  581. window if (1) the buffer’s mode derives from ‘magit-process-mode’,
  582. or (2) the buffer’s mode derives from ‘magit-diff-mode’, provided
  583. that the mode of the current buffer derives from ‘magit-log-mode’
  584. or ‘magit-cherry-mode’.
  585. -- User Option: magit-pre-display-buffer-hook
  586. This hook is run by ‘magit-display-buffer’ before displaying the
  587. buffer.
  588. -- Function: magit-save-window-configuration
  589. This function saves the current window configuration. Later when
  590. the buffer is buried, it may be restored by
  591. ‘magit-restore-window-configuration’.
  592. -- User Option: magit-post-display-buffer-hook
  593. This hook is run by ‘magit-display-buffer’ after displaying the
  594. buffer.
  595. -- Function: magit-maybe-set-dedicated
  596. This function remembers if a new window had to be created to
  597. display the buffer, or whether an existing window was reused. This
  598. information is later used by ‘magit-mode-quit-window’, to determine
  599. whether the window should be deleted when its last Magit buffer is
  600. buried.
  601. 
  602. File: magit.info, Node: Naming Buffers, Next: Quitting Windows, Prev: Switching Buffers, Up: Modes and Buffers
  603. 4.1.2 Naming Buffers
  604. --------------------
  605. -- User Option: magit-generate-buffer-name-function
  606. The function used to generate the names of Magit buffers.
  607. Such a function should take the options
  608. ‘magit-uniquify-buffer-names’ as well as ‘magit-buffer-name-format’
  609. into account. If it doesn’t, then should be clearly stated in the
  610. doc-string. And if it supports %-sequences beyond those mentioned
  611. in the doc-string of the option ‘magit-buffer-name-format’, then
  612. its own doc-string should describe the additions.
  613. -- Function: magit-generate-buffer-name-default-function mode
  614. This function returns a buffer name suitable for a buffer whose
  615. major-mode is MODE and which shows information about the repository
  616. in which ‘default-directory’ is located.
  617. This function uses ‘magit-buffer-name-format’ and supporting all of
  618. the %-sequences mentioned the documentation of that option. It
  619. also respects the option ‘magit-uniquify-buffer-names’.
  620. -- User Option: magit-buffer-name-format
  621. The format string used to name Magit buffers.
  622. At least the following %-sequences are supported:
  623. • ‘%m’
  624. The name of the major-mode, but with the ‘-mode’ suffix
  625. removed.
  626. • ‘%M’
  627. Like ‘%m’ but abbreviate ‘magit-status-mode’ as ‘magit’.
  628. • ‘%v’
  629. The value the buffer is locked to, in parentheses, or an empty
  630. string if the buffer is not locked to a value.
  631. • ‘%V’
  632. Like ‘%v’, but the string is prefixed with a space, unless it
  633. is an empty string.
  634. • ‘%t’
  635. The top-level directory of the working tree of the repository,
  636. or if ‘magit-uniquify-buffer-names’ is non-nil an abbreviation
  637. of that.
  638. • ‘%x’
  639. If ‘magit-uniquify-buffer-names’ is nil "*", otherwise the
  640. empty string. Due to limitations of the ‘uniquify’ package,
  641. buffer names must end with the path.
  642. • ‘%T’
  643. Obsolete, use "%t%x" instead. Like ‘%t’, but append an
  644. asterisk if and only if ‘magit-uniquify-buffer-names’ is nil.
  645. The value should always contain ‘%m’ or ‘%M’, ‘%v’ or ‘%V’, and
  646. ‘%t’ (or the obsolete ‘%T’). If ‘magit-uniquify-buffer-names’ is
  647. non-nil, then the value must end with ‘%t’ or ‘%t%x’ (or the
  648. obsolete ‘%T’). See issue #2841.
  649. -- User Option: magit-uniquify-buffer-names
  650. This option controls whether the names of Magit buffers are
  651. uniquified. If the names are not being uniquified, then they
  652. contain the full path of the top-level of the working tree of the
  653. corresponding repository. If they are being uniquified, then they
  654. end with the basename of the top-level, or if that would conflict
  655. with the name used for other buffers, then the names of all these
  656. buffers are adjusted until they no longer conflict.
  657. This is done using the ‘uniquify’ package; customize its options to
  658. control how buffer names are uniquified.
  659. 
  660. File: magit.info, Node: Quitting Windows, Next: Automatic Refreshing of Magit Buffers, Prev: Naming Buffers, Up: Modes and Buffers
  661. 4.1.3 Quitting Windows
  662. ----------------------
  663. ‘q’ (‘magit-mode-bury-buffer’)
  664. This command buries the current Magit buffer.
  665. With a prefix argument, it instead kills the buffer. With a double
  666. prefix argument, also kills all other Magit buffers associated with
  667. the current project.
  668. -- User Option: magit-bury-buffer-function
  669. The function used to actually bury or kill the current buffer.
  670. ‘magit-mode-bury-buffer’ calls this function with one argument. If
  671. the argument is non-nil, then the function has to kill the current
  672. buffer. Otherwise it has to bury it alive. The default value
  673. currently is ‘magit-restore-window-configuration’.
  674. -- Function: magit-restore-window-configuration kill-buffer
  675. Bury or kill the current buffer using ‘quit-window’, which is
  676. called with KILL-BUFFER as first and the selected window as second
  677. argument.
  678. Then restore the window configuration that existed right before the
  679. current buffer was displayed in the selected frame. Unfortunately
  680. that also means that point gets adjusted in all the buffers, which
  681. are being displayed in the selected frame.
  682. -- Function: magit-mode-quit-window kill-buffer
  683. Bury or kill the current buffer using ‘quit-window’, which is
  684. called with KILL-BUFFER as first and the selected window as second
  685. argument.
  686. Then, if the window was originally created to display a Magit
  687. buffer and the buried buffer was the last remaining Magit buffer
  688. that was ever displayed in the window, then that is deleted.
  689. 
  690. File: magit.info, Node: Automatic Refreshing of Magit Buffers, Next: Automatic Saving of File-Visiting Buffers, Prev: Quitting Windows, Up: Modes and Buffers
  691. 4.1.4 Automatic Refreshing of Magit Buffers
  692. -------------------------------------------
  693. After running a command which may change the state of the current
  694. repository, the current Magit buffer and the corresponding status buffer
  695. are refreshed. The status buffer can be automatically refreshed
  696. whenever a buffer is saved to a file inside the respective repository by
  697. adding a hook, like so:
  698. (add-hook 'after-save-hook 'magit-after-save-refresh-status t)
  699. Automatically refreshing Magit buffers ensures that the displayed
  700. information is up-to-date most of the time but can lead to a noticeable
  701. delay in big repositories. Other Magit buffers are not refreshed to
  702. keep the delay to a minimum and also because doing so can sometimes be
  703. undesirable.
  704. Buffers can also be refreshed explicitly, which is useful in buffers
  705. that weren’t current during the last refresh and after changes were made
  706. to the repository outside of Magit.
  707. ‘g’ (‘magit-refresh’)
  708. This command refreshes the current buffer if its major mode derives
  709. from ‘magit-mode’ as well as the corresponding status buffer.
  710. If the option ‘magit-revert-buffers’ calls for it, then it also
  711. reverts all unmodified buffers that visit files being tracked in
  712. the current repository.
  713. ‘G’ (‘magit-refresh-all’)
  714. This command refreshes all Magit buffers belonging to the current
  715. repository and also reverts all unmodified buffers that visit files
  716. being tracked in the current repository.
  717. The file-visiting buffers are always reverted, even if
  718. ‘magit-revert-buffers’ is nil.
  719. -- User Option: magit-refresh-buffer-hook
  720. This hook is run in each Magit buffer that was refreshed during the
  721. current refresh - normally the current buffer and the status
  722. buffer.
  723. -- User Option: magit-refresh-status-buffer
  724. When this option is non-nil, then the status buffer is
  725. automatically refreshed after running git for side-effects, in
  726. addition to the current Magit buffer, which is always refreshed
  727. automatically.
  728. Only set this to nil after exhausting all other options to improve
  729. performance.
  730. -- Function: magit-after-save-refresh-status
  731. This function is intended to be added to ‘after-save-hook’. After
  732. doing that the corresponding status buffer is refreshed whenever a
  733. buffer is saved to a file inside a repository.
  734. Note that refreshing a Magit buffer is done by re-creating its
  735. contents from scratch, which can be slow in large repositories. If
  736. you are not satisfied with Magit’s performance, then you should
  737. obviously not add this function to that hook.
  738. 
  739. File: magit.info, Node: Automatic Saving of File-Visiting Buffers, Next: Automatic Reverting of File-Visiting Buffers, Prev: Automatic Refreshing of Magit Buffers, Up: Modes and Buffers
  740. 4.1.5 Automatic Saving of File-Visiting Buffers
  741. -----------------------------------------------
  742. File-visiting buffers are by default saved at certain points in time.
  743. This doesn’t guarantee that Magit buffers are always up-to-date, but,
  744. provided one only edits files by editing them in Emacs and uses only
  745. Magit to interact with Git, one can be fairly confident. When in doubt
  746. or after outside changes, type ‘g’ (‘magit-refresh’) to save and refresh
  747. explicitly.
  748. -- User Option: magit-save-repository-buffers
  749. This option controls whether file-visiting buffers are saved before
  750. certain events.
  751. If this is non-nil then all modified file-visiting buffers
  752. belonging to the current repository may be saved before running
  753. commands, before creating new Magit buffers, and before explicitly
  754. refreshing such buffers. If this is ‘dontask’ then this is done
  755. without user intervention. If it is ‘t’ then the user has to
  756. confirm each save.
  757. 
  758. File: magit.info, Node: Automatic Reverting of File-Visiting Buffers, Prev: Automatic Saving of File-Visiting Buffers, Up: Modes and Buffers
  759. 4.1.6 Automatic Reverting of File-Visiting Buffers
  760. --------------------------------------------------
  761. By default Magit automatically reverts buffers that are visiting files
  762. that are being tracked in a Git repository, after they have changed on
  763. disk. When using Magit one often changes files on disk by running Git,
  764. i.e. "outside Emacs", making this a rather important feature.
  765. For example, if you discard a change in the status buffer, then that
  766. is done by running ‘git apply --reverse ...’, and Emacs considers the
  767. file to have "changed on disk". If Magit did not automatically revert
  768. the buffer, then you would have to type ‘M-x revert-buffer RET RET’ in
  769. the visiting buffer before you could continue making changes.
  770. -- User Option: magit-auto-revert-mode
  771. When this mode is enabled, then buffers that visit tracked files
  772. are automatically reverted after the visited files change on disk.
  773. -- User Option: global-auto-revert-mode
  774. When this mode is enabled, then any file-visiting buffer is
  775. automatically reverted after the visited file changes on disk.
  776. If you like buffers that visit tracked files to be automatically
  777. reverted, then you might also like any buffer to be reverted, not
  778. just those visiting tracked files. If that is the case, then
  779. enable this mode _instead of_ ‘magit-auto-revert-mode’.
  780. -- User Option: magit-auto-revert-immediately
  781. This option controls whether Magit reverts buffers immediately.
  782. If this is non-nil and either ‘global-auto-revert-mode’ or
  783. ‘magit-auto-revert-mode’ is enabled, then Magit immediately reverts
  784. buffers by explicitly calling ‘auto-revert-buffers’ after running
  785. Git for side-effects.
  786. If ‘auto-revert-use-notify’ is non-nil (and file notifications are
  787. actually supported), then ‘magit-auto-revert-immediately’ does not
  788. have to be non-nil, because the reverts happen immediately anyway.
  789. If ‘magit-auto-revert-immediately’ and ‘auto-revert-use-notify’ are
  790. both ‘nil’, then reverts happen after ‘auto-revert-interval’
  791. seconds of user inactivity. That is not desirable.
  792. -- User Option: auto-revert-use-notify
  793. This option controls whether file notification functions should be
  794. used. Note that this variable unfortunately defaults to ‘t’ even
  795. on systems on which file notifications cannot be used.
  796. -- User Option: magit-auto-revert-tracked-only
  797. This option controls whether ‘magit-auto-revert-mode’ only reverts
  798. tracked files or all files that are located inside Git
  799. repositories, including untracked files and files located inside
  800. Git’s control directory.
  801. -- User Option: auto-revert-mode
  802. The global mode ‘magit-auto-revert-mode’ works by turning on this
  803. local mode in the appropriate buffers (but
  804. ‘global-auto-revert-mode’ is implemented differently). You can
  805. also turn it on or off manually, which might be necessary if Magit
  806. does not notice that a previously untracked file now is being
  807. tracked or vice-versa.
  808. -- User Option: auto-revert-stop-on-user-input
  809. This option controls whether the arrival of user input suspends the
  810. automatic reverts for ‘auto-revert-interval’ seconds.
  811. -- User Option: auto-revert-interval
  812. This option controls how many seconds Emacs waits for before
  813. resuming suspended reverts.
  814. -- User Option: auto-revert-buffer-list-filter
  815. This option specifies an additional filter used by
  816. ‘auto-revert-buffers’ to determine whether a buffer should be
  817. reverted or not.
  818. This option is provided by Magit, which also advises
  819. ‘auto-revert-buffers’ to respect it. Magit users who do not turn
  820. on the local mode ‘auto-revert-mode’ themselves, are best served by
  821. setting the value to ‘magit-auto-revert-repository-buffer-p’.
  822. However the default is nil, so as not to disturb users who do use
  823. the local mode directly. If you experience delays when running
  824. Magit commands, then you should consider using one of the
  825. predicates provided by Magit - especially if you also use Tramp.
  826. Users who do turn on ‘auto-revert-mode’ in buffers in which Magit
  827. doesn’t do that for them, should likely not use any filter. Users
  828. who turn on ‘global-auto-revert-mode’, do not have to worry about
  829. this option, because it is disregarded if the global mode is
  830. enabled.
  831. -- User Option: auto-revert-verbose
  832. This option controls whether Emacs reports when a buffer has been
  833. reverted.
  834. The options with the ‘auto-revert-’ prefix are located in the Custom
  835. group named ‘auto-revert’. The other, Magit-specific, options are
  836. located in the ‘magit’ group.
  837. * Menu:
  838. * Risk of Reverting Automatically::
  839. 
  840. File: magit.info, Node: Risk of Reverting Automatically, Up: Automatic Reverting of File-Visiting Buffers
  841. Risk of Reverting Automatically
  842. ...............................
  843. For the vast majority of users, automatically reverting file-visiting
  844. buffers after they have changed on disk is harmless.
  845. If a buffer is modified (i.e. it contains changes that haven’t been
  846. saved yet), then Emacs will refuse to automatically revert it. If you
  847. save a previously modified buffer, then that results in what is seen by
  848. Git as an uncommitted change. Git will then refuse to carry out any
  849. commands that would cause these changes to be lost. In other words, if
  850. there is anything that could be lost, then either Git or Emacs will
  851. refuse to discard the changes.
  852. However, if you use file-visiting buffers as a sort of ad hoc
  853. "staging area", then the automatic reverts could potentially cause data
  854. loss. So far I have heard from only one user who uses such a workflow.
  855. An example: You visit some file in a buffer, edit it, and save the
  856. changes. Then, outside of Emacs (or at least not using Magit or by
  857. saving the buffer) you change the file on disk again. At this point the
  858. buffer is the only place where the intermediate version still exists.
  859. You have saved the changes to disk, but that has since been overwritten.
  860. Meanwhile Emacs considers the buffer to be unmodified (because you have
  861. not made any changes to it since you last saved it to the visited file)
  862. and therefore would not object to it being automatically reverted. At
  863. this point an Auto-Revert mode would kick in. It would check whether
  864. the buffer is modified and since that is not the case it would revert
  865. it. The intermediate version would be lost. (Actually you could still
  866. get it back using the ‘undo’ command.)
  867. If your workflow depends on Emacs preserving the intermediate version
  868. in the buffer, then you have to disable all Auto-Revert modes. But
  869. please consider that such a workflow would be dangerous even without
  870. using an Auto-Revert mode, and should therefore be avoided. If Emacs
  871. crashes or if you quit Emacs by mistake, then you would also lose the
  872. buffer content. There would be no autosave file still containing the
  873. intermediate version (because that was deleted when you saved the
  874. buffer) and you would not be asked whether you want to save the buffer
  875. (because it isn’t modified).
  876. 
  877. File: magit.info, Node: Sections, Next: Transient Commands, Prev: Modes and Buffers, Up: Interface Concepts
  878. 4.2 Sections
  879. ============
  880. Magit buffers are organized into nested sections, which can be collapsed
  881. and expanded, similar to how sections are handled in Org mode. Each
  882. section also has a type, and some sections also have a value. For each
  883. section type there can also be a local keymap, shared by all sections of
  884. that type.
  885. Taking advantage of the section value and type, many commands operate
  886. on the current section, or when the region is active and selects
  887. sections of the same type, all of the selected sections. Commands that
  888. only make sense for a particular section type (as opposed to just
  889. behaving differently depending on the type) are usually bound in section
  890. type keymaps.
  891. * Menu:
  892. * Section Movement::
  893. * Section Visibility::
  894. * Section Hooks::
  895. * Section Types and Values::
  896. * Section Options::
  897. 
  898. File: magit.info, Node: Section Movement, Next: Section Visibility, Up: Sections
  899. 4.2.1 Section Movement
  900. ----------------------
  901. To move within a section use the usual keys (‘C-p’, ‘C-n’, ‘C-b’, ‘C-f’
  902. etc), whose global bindings are not shadowed. To move to another
  903. section use the following commands.
  904. ‘p’ (‘magit-section-backward’)
  905. When not at the beginning of a section, then move to the beginning
  906. of the current section. At the beginning of a section, instead
  907. move to the beginning of the previous visible section.
  908. ‘n’ (‘magit-section-forward’)
  909. Move to the beginning of the next visible section.
  910. ‘M-p’ (‘magit-section-backward-siblings’)
  911. Move to the beginning of the previous sibling section. If there is
  912. no previous sibling section, then move to the parent section
  913. instead.
  914. ‘M-n’ (‘magit-section-forward-siblings’)
  915. Move to the beginning of the next sibling section. If there is no
  916. next sibling section, then move to the parent section instead.
  917. ‘^’ (‘magit-section-up’)
  918. Move to the beginning of the parent of the current section.
  919. The above commands all call the hook ‘magit-section-movement-hook’.
  920. Any of the functions listed below can be used as members of this hook.
  921. -- Variable: magit-section-movement-hook
  922. This hook is run by all of the above movement commands, after
  923. arriving at the destination.
  924. -- Function: magit-hunk-set-window-start
  925. This hook function ensures that the beginning of the current
  926. section is visible, provided it is a ‘hunk’ section. Otherwise, it
  927. does nothing. This function is a member of the hook’s default
  928. value.
  929. -- Function: magit-section-set-window-start
  930. This hook function ensures that the beginning of the current
  931. section is visible, regardless of the section’s type. If you add
  932. this to ‘magit-section-movement-hook’, then you must remove the
  933. hunk-only variant in turn.
  934. -- Function: magit-log-maybe-show-more-commits
  935. This hook function only has an effect in log buffers, and ‘point’
  936. is on the "show more" section. If that is the case, then it
  937. doubles the number of commits that are being shown. This function
  938. is a member of the hook’s default value.
  939. -- Function: magit-log-maybe-update-revision-buffer
  940. When moving inside a log buffer, then this function updates the
  941. revision buffer, provided it is already being displayed in another
  942. window of the same frame. This function is a member of the hook’s
  943. default value.
  944. -- Function: magit-log-maybe-update-blob-buffer
  945. When moving inside a log buffer and another window of the same
  946. frame displays a blob buffer, then this function instead displays
  947. the blob buffer for the commit at point in that window.
  948. -- Function: magit-status-maybe-update-revision-buffer
  949. When moving inside a status buffer, then this function updates the
  950. revision buffer, provided it is already being displayed in another
  951. window of the same frame.
  952. -- Function: magit-status-maybe-update-blob-buffer
  953. When moving inside a status buffer and another window of the same
  954. frame displays a blob buffer, then this function instead displays
  955. the blob buffer for the commit at point in that window.
  956. -- User Option: magit-update-other-window-delay
  957. Delay before automatically updating the other window.
  958. When moving around in certain buffers, then certain other buffers,
  959. which are being displayed in another window, may optionally be
  960. updated to display information about the section at point.
  961. When holding down a key to move by more than just one section, then
  962. that would update that buffer for each section on the way. To
  963. prevent that, updating the revision buffer is delayed, and this
  964. option controls for how long. For optimal experience you might
  965. have to adjust this delay and/or the keyboard repeat rate and delay
  966. of your graphical environment or operating system.
  967. 
  968. File: magit.info, Node: Section Visibility, Next: Section Hooks, Prev: Section Movement, Up: Sections
  969. 4.2.2 Section Visibility
  970. ------------------------
  971. Magit provides many commands for changing the visibility of sections,
  972. but all you need to get started are the next two.
  973. ‘TAB’ (‘magit-section-toggle’)
  974. Toggle the visibility of the body of the current section.
  975. ‘C-<tab>’ (‘magit-section-cycle’)
  976. Cycle the visibility of current section and its children.
  977. ‘M-<tab>’ (‘magit-section-cycle-diffs’)
  978. Cycle the visibility of diff-related sections in the current
  979. buffer.
  980. ‘S-<tab>’ (‘magit-section-cycle-global’)
  981. Cycle the visibility of all sections in the current buffer.
  982. ‘1’ (‘magit-section-show-level-1’)
  983. ‘2’ (‘magit-section-show-level-2’)
  984. ‘3’ (‘magit-section-show-level-3’)
  985. ‘4’ (‘magit-section-show-level-4’)
  986. Show sections surrounding the current section up to level N.
  987. ‘M-1’ (‘magit-section-show-level-1-all’)
  988. ‘M-2’ (‘magit-section-show-level-2-all’)
  989. ‘M-3’ (‘magit-section-show-level-3-all’)
  990. ‘M-4’ (‘magit-section-show-level-4-all’)
  991. Show all sections up to level N.
  992. Some functions, which are used to implement the above commands, are
  993. also exposed as commands themselves. By default no keys are bound to
  994. these commands, as they are generally perceived to be much less useful.
  995. But your mileage may vary.
  996. -- Command: magit-section-show
  997. Show the body of the current section.
  998. -- Command: magit-section-hide
  999. Hide the body of the current section.
  1000. -- Command: magit-section-show-headings
  1001. Recursively show headings of children of the current section. Only
  1002. show the headings. Previously shown text-only bodies are hidden.
  1003. -- Command: magit-section-show-children
  1004. Recursively show the bodies of children of the current section.
  1005. With a prefix argument show children down to the level of the
  1006. current section, and hide deeper children.
  1007. -- Command: magit-section-hide-children
  1008. Recursively hide the bodies of children of the current section.
  1009. -- Command: magit-section-toggle-children
  1010. Toggle visibility of bodies of children of the current section.
  1011. When a buffer is first created then some sections are shown expanded
  1012. while others are not. This is hard coded. When a buffer is refreshed
  1013. then the previous visibility is preserved. The initial visibility of
  1014. certain sections can also be overwritten using the hook
  1015. ‘magit-section-set-visibility-hook’.
  1016. -- User Option: magit-section-initial-visibility-alist
  1017. This options can be used to override the initial visibility of
  1018. sections. In the future it will also be used to define the
  1019. defaults, but currently a section’s default is still hardcoded.
  1020. The value is an alist. Each element maps a section type or lineage
  1021. to the initial visibility state for such sections. The state has
  1022. to be one of ‘show’ or ‘hide’, or a function that returns one of
  1023. these symbols. A function is called with the section as the only
  1024. argument.
  1025. Use the command ‘magit-describe-section-briefly’ to determine a
  1026. section’s lineage or type. The vector in the output is the section
  1027. lineage and the type is the first element of that vector.
  1028. Wildcards can be used, see ‘magit-section-match’.
  1029. -- User Option: magit-section-cache-visibility
  1030. This option controls for which sections the previous visibility
  1031. state should be restored if a section disappears and later appears
  1032. again. The value is a boolean or a list of section types. If t,
  1033. then the visibility of all sections is cached. Otherwise this is
  1034. only done for sections whose type matches one of the listed types.
  1035. This requires that the function ‘magit-section-cached-visibility’
  1036. is a member of ‘magit-section-set-visibility-hook’.
  1037. -- Variable: magit-section-set-visibility-hook
  1038. This hook is run when first creating a buffer and also when
  1039. refreshing an existing buffer, and is used to determine the
  1040. visibility of the section currently being inserted.
  1041. Each function is called with one argument, the section being
  1042. inserted. It should return ‘hide’ or ‘show’, or to leave the
  1043. visibility undefined ‘nil’. If no function decides on the
  1044. visibility and the buffer is being refreshed, then the visibility
  1045. is preserved; or if the buffer is being created, then the hard
  1046. coded default is used.
  1047. Usually this should only be used to set the initial visibility but
  1048. not during refreshes. If ‘magit-insert-section--oldroot’ is
  1049. non-nil, then the buffer is being refreshed and these functions
  1050. should immediately return ‘nil’.
  1051. -- User Option: magit-section-visibility-indicator
  1052. This option controls whether and how to indicate that a section can
  1053. be expanded/collapsed.
  1054. If nil, then no visibility indicators are shown. Otherwise the
  1055. value has to have one of these two forms:
  1056. • ‘(EXPANDABLE-BITMAP . COLLAPSIBLE-BITMAP)’
  1057. Both values have to be variables whose values are fringe
  1058. bitmaps. In this case every section that can be expanded or
  1059. collapsed gets an indicator in the left fringe.
  1060. To provide extra padding around the indicator, set
  1061. ‘left-fringe-width’ in ‘magit-mode-hook’, e.g.:
  1062. (add-hook 'magit-mode-hook (lambda ()
  1063. (setq left-fringe-width 20)))
  1064. • ‘(STRING . BOOLEAN)’
  1065. In this case STRING (usually an ellipsis) is shown at the end
  1066. of the heading of every collapsed section. Expanded sections
  1067. get no indicator. The cdr controls whether the appearance of
  1068. these ellipsis take section highlighting into account. Doing
  1069. so might potentially have an impact on performance, while not
  1070. doing so is kinda ugly.
  1071. 
  1072. File: magit.info, Node: Section Hooks, Next: Section Types and Values, Prev: Section Visibility, Up: Sections
  1073. 4.2.3 Section Hooks
  1074. -------------------
  1075. Which sections are inserted into certain buffers is controlled with
  1076. hooks. This includes the status and the refs buffers. For other
  1077. buffers, e.g. log and diff buffers, this is not possible. The command
  1078. ‘magit-describe-section’ can be used to see which hook (if any) was
  1079. responsible for inserting the section at point.
  1080. For buffers whose sections can be customized by the user, a hook
  1081. variable called ‘magit-TYPE-sections-hook’ exists. This hook should be
  1082. changed using ‘magit-add-section-hook’. Avoid using ‘add-hooks’ or the
  1083. Custom interface.
  1084. The various available section hook variables are described later in
  1085. this manual along with the appropriate "section inserter functions".
  1086. -- Function: magit-add-section-hook hook function &optional at append
  1087. local
  1088. Add the function FUNCTION to the value of section hook HOOK.
  1089. Add FUNCTION at the beginning of the hook list unless optional
  1090. APPEND is non-nil, in which case FUNCTION is added at the end. If
  1091. FUNCTION already is a member then move it to the new location.
  1092. If optional AT is non-nil and a member of the hook list, then add
  1093. FUNCTION next to that instead. Add before or after AT, or replace
  1094. AT with FUNCTION depending on APPEND. If APPEND is the symbol
  1095. ‘replace’, then replace AT with FUNCTION. For any other non-nil
  1096. value place FUNCTION right after AT. If nil, then place FUNCTION
  1097. right before AT. If FUNCTION already is a member of the list but
  1098. AT is not, then leave FUNCTION where ever it already is.
  1099. If optional LOCAL is non-nil, then modify the hook’s buffer-local
  1100. value rather than its global value. This makes the hook local by
  1101. copying the default value. That copy is then modified.
  1102. HOOK should be a symbol. If HOOK is void, it is first set to nil.
  1103. HOOK’s value must not be a single hook function. FUNCTION should
  1104. be a function that takes no arguments and inserts one or multiple
  1105. sections at point, moving point forward. FUNCTION may choose not
  1106. to insert its section(s), when doing so would not make sense. It
  1107. should not be abused for other side-effects.
  1108. To remove a function from a section hook, use ‘remove-hook’.
  1109. 
  1110. File: magit.info, Node: Section Types and Values, Next: Section Options, Prev: Section Hooks, Up: Sections
  1111. 4.2.4 Section Types and Values
  1112. ------------------------------
  1113. Each section has a type, for example ‘hunk’, ‘file’, and ‘commit’.
  1114. Instances of certain section types also have a value. The value of a
  1115. section of type ‘file’, for example, is a file name.
  1116. Users usually do not have to worry about a section’s type and value,
  1117. but knowing them can be handy at times.
  1118. ‘M-x magit-describe-section-briefly’ (‘magit-describe-section-briefly’)
  1119. Show information about the section at point in the echo area, as
  1120. "#<magit-section VALUE [TYPE PARENT-TYPE...] BEGINNING-END>".
  1121. Many commands behave differently depending on the type of the section
  1122. at point and/or somehow consume the value of that section. But that is
  1123. only one of the reasons why the same key may do something different,
  1124. depending on what section is current.
  1125. Additionally for each section type a keymap *might* be defined, named
  1126. ‘magit-TYPE-section-map’. That keymap is used as text property keymap
  1127. of all text belonging to any section of the respective type. If such a
  1128. map does not exist for a certain type, then you can define it yourself,
  1129. and it will automatically be used.
  1130. 
  1131. File: magit.info, Node: Section Options, Prev: Section Types and Values, Up: Sections
  1132. 4.2.5 Section Options
  1133. ---------------------
  1134. This section describes options that have an effect on more than just a
  1135. certain type of sections. As you can see there are not many of those.
  1136. -- User Option: magit-section-show-child-count
  1137. Whether to append the number of children to section headings. This
  1138. only affects sections that could benefit from this information.
  1139. 
  1140. File: magit.info, Node: Transient Commands, Next: Transient Arguments and Buffer Variables, Prev: Sections, Up: Interface Concepts
  1141. 4.3 Transient Commands
  1142. ======================
  1143. Many Magit commands are implemented as *transient* commands. First the
  1144. user invokes a *prefix* command, which causes its *infix* arguments and
  1145. *suffix* commands to be displayed in the echo area. The user then
  1146. optionally sets some infix arguments and finally invokes one of the
  1147. suffix commands.
  1148. This is implemented in the library ‘transient’. Earlier Magit
  1149. releases used the package ‘magit-popup’ and even earlier versions
  1150. library ‘magit-key-mode’.
  1151. Transient is documented in *note (transient)Top::.
  1152. ‘C-c C-c’ (‘magit-dispatch’)
  1153. This transient prefix command binds most of Magit’s other prefix
  1154. commands as suffix commands and displays them in a temporary buffer
  1155. until one of them is invoked. Invoking such a sub-prefix causes
  1156. the suffixes of that command to be bound and displayed instead of
  1157. those of ‘magit-dispatch’.
  1158. This command is also, or especially, useful outside Magit buffers, so
  1159. you should setup a global binding:
  1160. (global-set-key (kbd "C-x M-g") 'magit-dispatch)
  1161. 
  1162. File: magit.info, Node: Transient Arguments and Buffer Variables, Next: Completion Confirmation and the Selection, Prev: Transient Commands, Up: Interface Concepts
  1163. 4.4 Transient Arguments and Buffer Variables
  1164. ============================================
  1165. The infix arguments of many of Magit’s transient prefix commands cease
  1166. to have an effect once the ‘git’ command that is called with those
  1167. arguments has returned. Commands that create a commit are a good
  1168. example for this. If the user changes the arguments, then that only
  1169. affects the next invocation of a suffix command. If the same transient
  1170. prefix command is later invoked again, then the arguments are initially
  1171. reset to the default value. This default value can be set for the
  1172. current Emacs session or saved permanently, see *note (transient)Saving
  1173. Values::. It is also possible to cycle through previously used sets of
  1174. arguments using ‘M-p’ and ‘M-n’, see *note (transient)Using History::.
  1175. However the infix arguments of many other transient commands continue
  1176. to have an effect even after the ‘git’ command that was called with
  1177. those arguments has returned. The most important commands like this are
  1178. those that display a diff or log in a dedicated buffer. Their arguments
  1179. obviously continue to have an effect for as long as the respective diff
  1180. or log is being displayed. Furthermore the used arguments are stored in
  1181. buffer-local variables for future reference.
  1182. For commands in the second group it isn’t always desirable to reset
  1183. their arguments to the global value when the transient prefix command is
  1184. invoked again.
  1185. As mentioned above, it is possible to cycle through previously used
  1186. sets of arguments while a transient popup is visible. That means that
  1187. we could always reset the infix arguments to the default because the set
  1188. of arguments that is active in the existing buffer is only a few ‘M-p’
  1189. away. Magit can be configured to behave like that, but because I expect
  1190. that most users would not find that very convenient, it is not the
  1191. default.
  1192. Also note that it is possible to change the diff and log arguments
  1193. used in the current buffer (including the status buffer, which contains
  1194. both diff and log sections) using the respective "refresh" transient
  1195. prefix commands on ‘D’ and ‘L’. (‘d’ and ‘l’ on the other hand are
  1196. intended to change *what* diff or log is being displayed. It is
  1197. possible to also change *how* the diff or log is being displayed at the
  1198. same time, but if you only want to do the latter, then you should use
  1199. the refresh variants.) Because these secondary diff and log transient
  1200. prefixes are about *changing* the arguments used in the current buffer,
  1201. they *always* start out with the set of arguments that are currently in
  1202. effect in that buffer.
  1203. Some commands are usually invoked directly even though they can also
  1204. be invoked as the suffix of a transient prefix command. Most
  1205. prominently ‘magit-show-commit’ is usually invoked by typing ‘RET’ while
  1206. point is on a commit in a log, but it can also be invoked from the
  1207. ‘magit-diff’ transient prefix.
  1208. When such a command is invoked directly, then it is important to
  1209. reuse the arguments as specified by the respective buffer-local values,
  1210. instead of using the default arguments. Imagine you press ‘RET’ in a
  1211. log to display the commit at point in a different buffer and then use
  1212. ‘D’ to change how the diff is displayed in that buffer. And then you
  1213. press ‘RET’ on another commit to show that instead and the diff
  1214. arguments are reset to the default. Not cool; so Magit does not do that
  1215. by default.
  1216. -- User Option: magit-prefix-use-buffer-arguments
  1217. This option controls whether the infix arguments initially shown in
  1218. certain transient prefix commands are based on the arguments that
  1219. are currently in effect in the buffer that their suffixes update.
  1220. The ‘magit-diff’ and ‘magit-log’ transient prefix commands are
  1221. affected by this option.
  1222. -- User Option: magit-direct-use-buffer-arguments
  1223. This option controls whether certain commands, when invoked
  1224. directly (i.e. not as the suffix of a transient prefix command),
  1225. use the arguments that are currently active in the buffer that they
  1226. are about to update. The alternative is to use the default value
  1227. for these arguments, which might change the arguments that are used
  1228. in the buffer.
  1229. Valid values for both of the above options are:
  1230. • ‘always’: Always use the set of arguments that is currently active
  1231. in the respective buffer, provided that buffer exists of course.
  1232. • ‘selected’ or ‘t’: Use the set of arguments from the respective
  1233. buffer, but only if it is displayed in a window of the current
  1234. frame. This is the default for both variables.
  1235. • ‘current’: Use the set of arguments from the respective buffer, but
  1236. only if it is the current buffer.
  1237. • ‘never’: Never use the set of arguments from the respective buffer.
  1238. I am afraid it gets more complicated still:
  1239. • The global diff and log arguments are set for each support mode
  1240. individually. The diff arguments for example have different values
  1241. in ‘magit-diff-mode’, ‘magit-revision-mode’,
  1242. ‘magit-merge-preview-mode’ and ‘magit-status-mode’ buffers.
  1243. Setting or saving the value for one mode does not change the value
  1244. for other modes. The history however is shared.
  1245. • When ‘magit-show-commit’ is invoked directly from a log buffer,
  1246. then the file filter is picked up from that buffer, not from the
  1247. revision buffer and or the mode’s global diff arguments.
  1248. • Even though they are suffixes of the diff prefix
  1249. ‘magit-show-commit’ and ‘magit-stash-show’ do not use the diff
  1250. buffer used by the diff commands, instead they use the dedicated
  1251. revision and stash buffers.
  1252. At the time you invoke the diff prefix it is unknown to Magit which
  1253. of the suffix commands you are going to invoke. While not certain,
  1254. more often than not users invoke one of the commands that use the
  1255. diff buffer, so the initial infix arguments are those used in that
  1256. buffer. However if you invoke one of these commands directly, then
  1257. Magit knows that it should use the arguments from the revision
  1258. resp. stash buffer.
  1259. • The log prefix also features reflog commands, but these commands do
  1260. not use the log arguments.
  1261. • If ‘magit-show-refs’ is invoked from a ‘magit-refs-mode’ buffer,
  1262. then it acts as a refresh prefix and therefore unconditionally uses
  1263. the buffer’s arguments as initial arguments. If it is invoked
  1264. elsewhere with a prefix argument, then it acts as regular prefix
  1265. and therefore respects ‘magit-prefix-use-buffer-arguments’. If it
  1266. is invoked elsewhere without a prefix argument, then it acts as a
  1267. direct command and therefore respects
  1268. ‘magit-direct-use-buffer-arguments’.
  1269. 
  1270. File: magit.info, Node: Completion Confirmation and the Selection, Next: Running Git, Prev: Transient Arguments and Buffer Variables, Up: Interface Concepts
  1271. 4.5 Completion, Confirmation and the Selection
  1272. ==============================================
  1273. * Menu:
  1274. * Action Confirmation::
  1275. * Completion and Confirmation::
  1276. * The Selection::
  1277. * The hunk-internal region::
  1278. * Support for Completion Frameworks::
  1279. * Additional Completion Options::
  1280. 
  1281. File: magit.info, Node: Action Confirmation, Next: Completion and Confirmation, Up: Completion Confirmation and the Selection
  1282. 4.5.1 Action Confirmation
  1283. -------------------------
  1284. By default many actions that could potentially lead to data loss have to
  1285. be confirmed. This includes many very common actions, so this can
  1286. quickly become annoying. Many of these actions can be undone and if you
  1287. have thought about how to undo certain mistakes, then it should be safe
  1288. to disable confirmation for the respective actions.
  1289. The option ‘magit-no-confirm’ can be used to tell Magit to perform
  1290. certain actions without the user having to confirm them. Note that
  1291. while this option can only be used to disable confirmation for a
  1292. specific set of actions, the next section explains another way of
  1293. telling Magit to ask fewer questions.
  1294. -- User Option: magit-no-confirm
  1295. The value of this option is a list of symbols, representing actions
  1296. that do not have to be confirmed by the user before being carried
  1297. out.
  1298. By default many potentially dangerous commands ask the user for
  1299. confirmation. Each of the below symbols stands for an action
  1300. which, when invoked unintentionally or without being fully aware of
  1301. the consequences, could lead to tears. In many cases there are
  1302. several commands that perform variations of a certain action, so we
  1303. don’t use the command names but more generic symbols.
  1304. • Applying changes:
  1305. • ‘discard’ Discarding one or more changes (i.e. hunks or
  1306. the complete diff for a file) loses that change,
  1307. obviously.
  1308. • ‘reverse’ Reverting one or more changes can usually be
  1309. undone by reverting the reversion.
  1310. • ‘stage-all-changes’, ‘unstage-all-changes’ When there are
  1311. both staged and unstaged changes, then un-/staging
  1312. everything would destroy that distinction. Of course
  1313. that also applies when un-/staging a single change, but
  1314. then less is lost and one does that so often that having
  1315. to confirm every time would be unacceptable.
  1316. • Files:
  1317. • ‘delete’ When a file that isn’t yet tracked by Git is
  1318. deleted, then it is completely lost, not just the last
  1319. changes. Very dangerous.
  1320. • ‘trash’ Instead of deleting a file it can also be move to
  1321. the system trash. Obviously much less dangerous than
  1322. deleting it.
  1323. Also see option ‘magit-delete-by-moving-to-trash’.
  1324. • ‘resurrect’ A deleted file can easily be resurrected by
  1325. "deleting" the deletion, which is done using the same
  1326. command that was used to delete the same file in the
  1327. first place.
  1328. • ‘untrack’ Untracking a file can be undone by tracking it
  1329. again.
  1330. • ‘rename’ Renaming a file can easily be undone.
  1331. • Sequences:
  1332. • ‘reset-bisect’ Aborting (known to Git as "resetting") a
  1333. bisect operation loses all information collected so far.
  1334. • ‘abort-rebase’ Aborting a rebase throws away all already
  1335. modified commits, but it’s possible to restore those from
  1336. the reflog.
  1337. • ‘abort-merge’ Aborting a merge throws away all conflict
  1338. resolutions which have already been carried out by the
  1339. user.
  1340. • ‘merge-dirty’ Merging with a dirty worktree can make it
  1341. hard to go back to the state before the merge was
  1342. initiated.
  1343. • References:
  1344. • ‘delete-unmerged-branch’ Once a branch has been deleted,
  1345. it can only be restored using low-level recovery tools
  1346. provided by Git. And even then the reflog is gone. The
  1347. user always has to confirm the deletion of a branch by
  1348. accepting the default choice (or selecting another
  1349. branch), but when a branch has not been merged yet, also
  1350. make sure the user is aware of that.
  1351. • ‘delete-pr-remote’ When deleting a branch that was
  1352. created from a pull-request and if no other branches
  1353. still exist on that remote, then ‘magit-branch-delete’
  1354. offers to delete the remote as well. This should be safe
  1355. because it only happens if no other refs exist in the
  1356. remotes namespace, and you can recreate the remote if
  1357. necessary.
  1358. • ‘drop-stashes’ Dropping a stash is dangerous because Git
  1359. stores stashes in the reflog. Once a stash is removed,
  1360. there is no going back without using low-level recovery
  1361. tools provided by Git. When a single stash is dropped,
  1362. then the user always has to confirm by accepting the
  1363. default (or selecting another). This action only
  1364. concerns the deletion of multiple stashes at once.
  1365. • Edit published history:
  1366. Without adding these symbols here, you will be warned before
  1367. editing commits that have already been pushed to one of the
  1368. branches listed in ‘magit-published-branches’.
  1369. • ‘amend-published’ Affects most commands that amend to
  1370. "HEAD".
  1371. • ‘rebase-published’ Affects commands that perform
  1372. interactive rebases. This includes commands from the
  1373. commit transient that modify a commit other than "HEAD",
  1374. namely the various fixup and squash variants.
  1375. • ‘edit-published’ Affects the commands
  1376. ‘magit-edit-line-commit’ and
  1377. ‘magit-diff-edit-hunk-commit’. These two commands make
  1378. it quite easy to accidentally edit a published commit, so
  1379. you should think twice before configuring them not to ask
  1380. for confirmation.
  1381. To disable confirmation completely, add all three symbols here
  1382. or set ‘magit-published-branches’ to ‘nil’.
  1383. • Various:
  1384. • ‘kill-process’ There seldom is a reason to kill a
  1385. process.
  1386. • Global settings:
  1387. Instead of adding all of the above symbols to the value of
  1388. this option, you can also set it to the atom ‘t’, which has
  1389. the same effect as adding all of the above symbols. Doing
  1390. that most certainly is a bad idea, especially because other
  1391. symbols might be added in the future. So even if you don’t
  1392. want to be asked for confirmation for any of these actions,
  1393. you are still better of adding all of the respective symbols
  1394. individually.
  1395. When ‘magit-wip-before-change-mode’ is enabled, then the
  1396. following actions can be undone fairly easily: ‘discard’,
  1397. ‘reverse’, ‘stage-all-changes’, and ‘unstage-all-changes’. If
  1398. and only if this mode is enabled, then ‘safe-with-wip’ has the
  1399. same effect as adding all of these symbols individually.
  1400. 
  1401. File: magit.info, Node: Completion and Confirmation, Next: The Selection, Prev: Action Confirmation, Up: Completion Confirmation and the Selection
  1402. 4.5.2 Completion and Confirmation
  1403. ---------------------------------
  1404. Many Magit commands ask the user to select from a list of possible
  1405. things to act on, while offering the most likely choice as the default.
  1406. For many of these commands the default is the thing at point, provided
  1407. that it actually is a valid thing to act on. For many commands that act
  1408. on a branch, the current branch serves as the default if there is no
  1409. branch at point.
  1410. These commands combine asking for confirmation and asking for a
  1411. target to act on into a single action. The user can confirm the default
  1412. target using ‘RET’ or abort using ‘C-g’. This is similar to a
  1413. ‘y-or-n-p’ prompt, but the keys to confirm or abort differ.
  1414. At the same time the user is also given the opportunity to select
  1415. another target, which is useful because for some commands and/or in some
  1416. situations you might want to select the action before selecting the
  1417. target by moving to it.
  1418. However you might find that for some commands you always want to use
  1419. the default target, if any, or even that you want the command to act on
  1420. the default without requiring any confirmation at all. The option
  1421. ‘magit-dwim-selection’ can be used to configure certain commands to that
  1422. effect.
  1423. Note that when the region is active then many commands act on the
  1424. things that are selected using a mechanism based on the region, in many
  1425. cases after asking for confirmation. This region-based mechanism is
  1426. called the "selection" and is described in detail in the next section.
  1427. When a selection exists that is valid for the invoked command, then that
  1428. command never offers to act on something else, and whether it asks for
  1429. confirmation is not controlled by this option.
  1430. Also note that Magit asks for confirmation of certain actions that
  1431. are not coupled with completion (or the selection). Such dialogs are
  1432. also not affected by this option and are described in the previous
  1433. section.
  1434. -- User Option: magit-dwim-selection
  1435. This option can be used to tell certain commands to use the thing at
  1436. point instead of asking the user to select a candidate to act on, with
  1437. or without confirmation.
  1438. The value has the form ‘((COMMAND nil|PROMPT DEFAULT)...)’.
  1439. • COMMAND is the command that should not prompt for a choice. To
  1440. have an effect, the command has to use the function
  1441. ‘magit-completing-read’ or a utility function which in turn uses
  1442. that function.
  1443. • If the command uses ‘magit-completing-read’ multiple times, then
  1444. PROMPT can be used to only affect one of these uses. PROMPT, if
  1445. non-nil, is a regular expression that is used to match against the
  1446. PROMPT argument passed to ‘magit-completing-read’.
  1447. • DEFAULT specifies how to use the default. If it is ‘t’, then the
  1448. DEFAULT argument passed to ‘magit-completing-read’ is used without
  1449. confirmation. If it is ‘ask’, then the user is given a chance to
  1450. abort. DEFAULT can also be ‘nil’, in which case the entry has no
  1451. effect.
  1452. 
  1453. File: magit.info, Node: The Selection, Next: The hunk-internal region, Prev: Completion and Confirmation, Up: Completion Confirmation and the Selection
  1454. 4.5.3 The Selection
  1455. -------------------
  1456. If the region is active, then many Magit commands act on the things that
  1457. are selected using a mechanism based on the region instead of one single
  1458. thing. When the region is not active, then these commands act on the
  1459. thing at point or read a single thing to act on. This is described in
  1460. the previous section — this section only covers how multiple things are
  1461. selected, how that is visualized, and how certain commands behave when
  1462. that is the case.
  1463. Magit’s mechanism for selecting multiple things, or rather sections
  1464. that represent these things, is based on the Emacs region, but the area
  1465. that Magit considers to be selected is typically larger than the region
  1466. and additional restrictions apply.
  1467. Magit makes a distinction between a region that qualifies as forming
  1468. a valid Magit selection and a region that does not. If the region does
  1469. not qualify, then it is displayed as it is in other Emacs buffers. If
  1470. the region does qualify as a Magit selection, then the selection is
  1471. always visualized, while the region itself is only visualized if it
  1472. begins and ends on the same line.
  1473. For a region to qualify as a Magit selection, it must begin in the
  1474. heading of one section and end in the heading of a sibling section.
  1475. Note that if the end of the region is at the very beginning of section
  1476. heading (i.e. at the very beginning of a line) then that section is
  1477. considered to be *inside* the selection.
  1478. This is not consistent with how the region is normally treated in
  1479. Emacs — if the region ends at the beginning of a line, then that line is
  1480. outside the region. Due to how Magit visualizes the selection, it
  1481. should be obvious that this difference exists.
  1482. Not every command acts on every valid selection. Some commands do
  1483. not even consider the location of point, others may act on the section
  1484. at point but not support acting on the selection, and even commands that
  1485. do support the selection of course only do so if it selects things that
  1486. they can act on.
  1487. This is the main reason why the selection must include the section at
  1488. point. Even if a selection exists, the invoked command may disregard
  1489. it, in which case it may act on the current section only. It is much
  1490. safer to only act on the current section but not the other selected
  1491. sections than it is to act on the current section *instead* of the
  1492. selected sections. The latter would be much more surprising and if the
  1493. current section always is part of the selection, then that cannot
  1494. happen.
  1495. -- Variable: magit-keep-region-overlay
  1496. This variable controls whether the region is visualized as usual
  1497. even when a valid Magit selection or a hunk-internal region exists.
  1498. See the doc-string for more information.
  1499. 
  1500. File: magit.info, Node: The hunk-internal region, Next: Support for Completion Frameworks, Prev: The Selection, Up: Completion Confirmation and the Selection
  1501. 4.5.4 The hunk-internal region
  1502. ------------------------------
  1503. Somewhat related to the Magit selection described in the previous
  1504. section is the hunk-internal region.
  1505. Like the selection, the hunk-internal region is based on the Emacs
  1506. region but causes that region to not be visualized as it would in other
  1507. Emacs buffers, and includes the line on which the region ends even if it
  1508. ends at the very beginning of that line.
  1509. Unlike the selection, which is based on a region that must begin in
  1510. the heading of one section and ends in the section of a sibling section,
  1511. the hunk-internal region must begin inside the *body* of a hunk section
  1512. and end in the body of the *same* section.
  1513. The hunk-internal region is honored by "apply" commands, which can,
  1514. among other targets, act on a hunk. If the hunk-internal region is
  1515. active, then such commands act only on the marked part of the hunk
  1516. instead of on the complete hunk.
  1517. 
  1518. File: magit.info, Node: Support for Completion Frameworks, Next: Additional Completion Options, Prev: The hunk-internal region, Up: Completion Confirmation and the Selection
  1519. 4.5.5 Support for Completion Frameworks
  1520. ---------------------------------------
  1521. The built-in option ‘completing-read-function’ specifies the low-level
  1522. function used by ‘completing-read’ to ask a user to select from a list
  1523. of choices. Its default value is ‘completing-read-default’.
  1524. Alternative completion frameworks typically activate themselves by
  1525. substituting their own implementation.
  1526. Mostly for historic reasons Magit provides a similar option named
  1527. ‘magit-completing-read-function’, which only controls the low-level
  1528. function used by ‘magit-completing-read’. This option also makes it
  1529. possible to use a different completing mechanism for Magit than for the
  1530. rest of Emacs, but doing that is not recommend.
  1531. You most likely don’t have to customize the magit-specific option to
  1532. use an alternative completion framework. For example, if you enable
  1533. ‘ivy-mode’, then Magit will respect that, and if you enable ‘helm-mode’,
  1534. then you are done too.
  1535. However if you want to use Ido, then ‘ido-mode’ won’t do the trick.
  1536. You will also have to install the ‘ido-completing-read+’ package and use
  1537. ‘magit-ido-completing-read’ as ‘magit-completing-read-function’.
  1538. -- User Option: magit-completing-read-function
  1539. The value of this variable is the low-level function used to
  1540. perform completion by code that uses ‘magit-completing-read’ (as
  1541. opposed to the built-in ‘completing-read’).
  1542. The default value, ‘magit-builtin-completing-read’, is suitable for
  1543. the standard completion mechanism, ‘ivy-mode’, and ‘helm-mode’ at
  1544. least.
  1545. The built-in ‘completing-read’ and ‘completing-read-default’ are
  1546. *not* suitable to be used here. ‘magit-builtin-completing-read’
  1547. performs some additional work, and any function used in its place
  1548. has to do the same.
  1549. -- Function: magit-builtin-completing-read prompt choices &optional
  1550. predicate require-match initial-input hist def
  1551. This function performs completion using the built-in
  1552. ‘completing-read’ and does some additional magit-specific work.
  1553. -- Function: magit-ido-completing-read prompt choices &optional
  1554. predicate require-match initial-input hist def
  1555. This function performs completion using ‘ido-completing-read+’ from
  1556. the package by the same name (which you have to explicitly install)
  1557. and does some additional magit-specific work.
  1558. We have to use ‘ido-completing-read+’ instead of the
  1559. ‘ido-completing-read’ that comes with Ido itself, because the
  1560. latter, while intended as a drop-in replacement, cannot serve that
  1561. purpose because it violates too many of the implicit conventions.
  1562. -- Function: magit-completing-read prompt choices &optional predicate
  1563. require-match initial-input hist def fallback
  1564. This is the function that Magit commands use when they need the
  1565. user to select a single thing to act on. The arguments have the
  1566. same meaning as for ‘completing-read’, except for FALLBACK, which
  1567. is unique to this function and is described below.
  1568. Instead of asking the user to choose from a list of possible
  1569. candidates, this function may just return the default specified by
  1570. DEF, with or without requiring user confirmation. Whether that is
  1571. the case depends on PROMPT, ‘this-command’ and
  1572. ‘magit-dwim-selection’. See the documentation of the latter for
  1573. more information.
  1574. If it does read a value in the minibuffer, then this function acts
  1575. similar to ‘completing-read’, except for the following:
  1576. • COLLECTION must be a list of choices. A function is not
  1577. supported.
  1578. • If REQUIRE-MATCH is ‘nil’ and the user exits without a choice,
  1579. then ‘nil’ is returned instead of an empty string.
  1580. • If REQUIRE-MATCH is non-nil and the users exits without a
  1581. choice, an user-error is raised.
  1582. • FALLBACK specifies a secondary default that is only used if
  1583. the primary default DEF is ‘nil’. The secondary default is
  1584. not subject to ‘magit-dwim-selection’ — if DEF is ‘nil’ but
  1585. FALLBACK is not, then this function always asks the user to
  1586. choose a candidate, just as if both defaults were ‘nil’.
  1587. • ": " is appended to PROMPT.
  1588. • PROMPT is modified to end with \" (default DEF|FALLBACK): \"
  1589. provided that DEF or FALLBACK is non-nil, that neither
  1590. ‘ivy-mode’ nor ‘helm-mode’ is enabled, and that
  1591. ‘magit-completing-read-function’ is set to its default value
  1592. of ‘magit-builtin-completing-read’.
  1593. 
  1594. File: magit.info, Node: Additional Completion Options, Prev: Support for Completion Frameworks, Up: Completion Confirmation and the Selection
  1595. 4.5.6 Additional Completion Options
  1596. -----------------------------------
  1597. -- User Option: magit-list-refs-sortby
  1598. For many commands that read a ref or refs from the user, the value
  1599. of this option can be used to control the order of the refs. Valid
  1600. values include any key accepted by the ‘--sort’ flag of ‘git
  1601. for-each-ref’. By default, refs are sorted alphabetically by their
  1602. full name (e.g., "refs/heads/master").
  1603. 
  1604. File: magit.info, Node: Running Git, Prev: Completion Confirmation and the Selection, Up: Interface Concepts
  1605. 4.6 Running Git
  1606. ===============
  1607. * Menu:
  1608. * Viewing Git Output::
  1609. * Git Process Status::
  1610. * Running Git Manually::
  1611. * Git Executable::
  1612. * Global Git Arguments::
  1613. 
  1614. File: magit.info, Node: Viewing Git Output, Next: Git Process Status, Up: Running Git
  1615. 4.6.1 Viewing Git Output
  1616. ------------------------
  1617. Magit runs Git either for side-effects (e.g. when pushing) or to get
  1618. some value (e.g. the name of the current branch).
  1619. When Git is run for side-effects, the process output is logged in a
  1620. per-repository log buffer, which can be consulted using the
  1621. ‘magit-process’ command when things don’t go as expected.
  1622. The output/errors for up to ‘magit-process-log-max’ Git commands are
  1623. retained.
  1624. ‘$’ (‘magit-process’)
  1625. This commands displays the process buffer for the current
  1626. repository.
  1627. Inside that buffer, the usual key bindings for navigating and showing
  1628. sections are available. There is one additional command.
  1629. ‘k’ (‘magit-process-kill’)
  1630. This command kills the process represented by the section at point.
  1631. -- User Option: magit-git-debug
  1632. When this is non-nil then the output of all calls to git are logged
  1633. in the process buffer. This is useful when debugging, otherwise it
  1634. just negatively affects performance.
  1635. 
  1636. File: magit.info, Node: Git Process Status, Next: Running Git Manually, Prev: Viewing Git Output, Up: Running Git
  1637. 4.6.2 Git Process Status
  1638. ------------------------
  1639. When a Git process is running for side-effects, Magit displays an
  1640. indicator in the mode line, using the ‘magit-mode-line-process’ face.
  1641. If the Git process exits successfully, the process indicator is
  1642. removed from the mode line immediately.
  1643. In the case of a Git error, the process indicator is not removed, but
  1644. is instead highlighted with the ‘magit-mode-line-process-error’ face,
  1645. and the error details from the process buffer are provided as a tooltip
  1646. for mouse users. This error indicator persists in the mode line until
  1647. the next magit buffer refresh.
  1648. If you do not wish process errors to be indicated in the mode line,
  1649. customize the ‘magit-process-display-mode-line-error’ user option.
  1650. Process errors are additionally indicated at the top of the status
  1651. buffer.
  1652. 
  1653. File: magit.info, Node: Running Git Manually, Next: Git Executable, Prev: Git Process Status, Up: Running Git
  1654. 4.6.3 Running Git Manually
  1655. --------------------------
  1656. While Magit provides many Emacs commands to interact with Git, it does
  1657. not cover everything. In those cases your existing Git knowledge will
  1658. come in handy. Magit provides some commands for running arbitrary Git
  1659. commands by typing them into the minibuffer, instead of having to switch
  1660. to a shell.
  1661. ‘!’ (‘magit-run’)
  1662. This transient prefix command binds the following suffix commands
  1663. and displays them in a temporary buffer until a suffix is invoked.
  1664. ‘! !’ (‘magit-git-command-topdir’)
  1665. This command reads a command from the user and executes it in the
  1666. top-level directory of the current working tree.
  1667. The string "git " is used as initial input when prompting the user
  1668. for the command. It can be removed to run another command.
  1669. ‘! p’ (‘magit-git-command’)
  1670. This command reads a command from the user and executes it in
  1671. ‘default-directory’. With a prefix argument the command is
  1672. executed in the top-level directory of the current working tree
  1673. instead.
  1674. The string "git " is used as initial input when prompting the user
  1675. for the command. It can be removed to run another command.
  1676. ‘! s’ (‘magit-shell-command-topdir’)
  1677. This command reads a command from the user and executes it in the
  1678. top-level directory of the current working tree.
  1679. ‘! S’ (‘magit-shell-command’)
  1680. This command reads a command from the user and executes it in
  1681. ‘default-directory’. With a prefix argument the command is
  1682. executed in the top-level directory of the current working tree
  1683. instead.
  1684. -- User Option: magit-shell-command-verbose-prompt
  1685. Whether the prompt, used by the the above commands when reading a
  1686. shell command, shows the directory in which it will be run.
  1687. These suffix commands start external gui tools.
  1688. ‘! k’ (‘magit-run-gitk’)
  1689. This command runs ‘gitk’ in the current repository.
  1690. ‘! a’ (‘magit-run-gitk-all’)
  1691. This command runs ‘gitk --all’ in the current repository.
  1692. ‘! b’ (‘magit-run-gitk-branches’)
  1693. This command runs ‘gitk --branches’ in the current repository.
  1694. ‘! g’ (‘magit-run-git-gui’)
  1695. This command runs ‘git gui’ in the current repository.
  1696. 
  1697. File: magit.info, Node: Git Executable, Next: Global Git Arguments, Prev: Running Git Manually, Up: Running Git
  1698. 4.6.4 Git Executable
  1699. --------------------
  1700. Except on MS Windows, Magit defaults to running Git without specifying
  1701. the path to the git executable. Instead the first executable found by
  1702. Emacs on ‘exec-path’ is used (whose value in turn is set based on the
  1703. value of the environment variable ‘$PATH’ when Emacs was started).
  1704. This has the advantage that it continues to work even when using
  1705. Tramp to connect to a remote machine on which the executable is found in
  1706. a different place. The downside is that if you have multiple versions
  1707. of Git installed, then you might end up using another version than the
  1708. one you think you are using.
  1709. ‘M-x magit-version’ (‘magit-version’)
  1710. This command shows the currently used versions of Magit, Git, and
  1711. Emacs in the echo area. Non-interactively this just returns the
  1712. Magit version.
  1713. When the ‘system-type’ is ‘windows-nt’, then ‘magit-git-executable’
  1714. is set to an absolute path when Magit is first loaded. This is
  1715. necessary because Git on that platform comes with several wrapper
  1716. scripts for the actual git binary, which are also placed on ‘$PATH’, and
  1717. using one of these wrappers instead of the binary would degrade
  1718. performance horribly.
  1719. If Magit doesn’t find the correct executable then you *can* work
  1720. around that by setting ‘magit-git-executable’ to an absolute path. But
  1721. note that doing so is a kludge. It is better to make sure the order in
  1722. the environment variable ‘$PATH’ is correct, and that Emacs is started
  1723. with that environment in effect. The command
  1724. ‘magit-debug-git-executable’ can be useful to find out where Emacs is
  1725. searching for git. If you have to connect from Windows to a non-Windows
  1726. machine, then you must change the value to "git".
  1727. -- User Option: magit-git-executable
  1728. The git executable used by Magit, either the full path to the
  1729. executable or the string "git" to let Emacs find the executable
  1730. itself, using the standard mechanism for doing such things.
  1731. ‘M-x magit-debug-git-executable’ (‘magit-debug-git-executable’)
  1732. Display a buffer with information about ‘magit-git-executable’.
  1733. 
  1734. File: magit.info, Node: Global Git Arguments, Prev: Git Executable, Up: Running Git
  1735. 4.6.5 Global Git Arguments
  1736. --------------------------
  1737. -- User Option: magit-git-global-arguments
  1738. The arguments set here are used every time the git executable is
  1739. run as a subprocess. They are placed right after the executable
  1740. itself and before the git command - as in ‘git HERE... COMMAND
  1741. REST’. For valid arguments see *note (gitman)git::.
  1742. Be careful what you add here, especially if you are using Tramp to
  1743. connect to servers with ancient Git versions. Never remove
  1744. anything that is part of the default value, unless you really know
  1745. what you are doing. And think very hard before adding something;
  1746. it will be used every time Magit runs Git for any purpose.
  1747. 
  1748. File: magit.info, Node: Inspecting, Next: Manipulating, Prev: Interface Concepts, Up: Top
  1749. 5 Inspecting
  1750. ************
  1751. The functionality provided by Magit can be roughly divided into three
  1752. groups: inspecting existing data, manipulating existing data or adding
  1753. new data, and transferring data. Of course that is a rather crude
  1754. distinction that often falls short, but it’s more useful than no
  1755. distinction at all. This section is concerned with inspecting data, the
  1756. next two with manipulating and transferring it. Then follows a section
  1757. about miscellaneous functionality, which cannot easily be fit into this
  1758. distinction.
  1759. Of course other distinctions make sense too, e.g. Git’s distinction
  1760. between porcelain and plumbing commands, which for the most part is
  1761. equivalent to Emacs’ distinction between interactive commands and
  1762. non-interactive functions. All of the sections mentioned before are
  1763. mainly concerned with the porcelain – Magit’s plumbing layer is
  1764. described later.
  1765. * Menu:
  1766. * Status Buffer::
  1767. * Repository List::
  1768. * Logging::
  1769. * Diffing::
  1770. * Ediffing::
  1771. * References Buffer::
  1772. * Bisecting::
  1773. * Visiting Files and Blobs::
  1774. * Blaming::
  1775. 
  1776. File: magit.info, Node: Status Buffer, Next: Repository List, Up: Inspecting
  1777. 5.1 Status Buffer
  1778. =================
  1779. While other Magit buffers contain e.g. one particular diff or one
  1780. particular log, the status buffer contains the diffs for staged and
  1781. unstaged changes, logs for unpushed and unpulled commits, lists of
  1782. stashes and untracked files, and information related to the current
  1783. branch.
  1784. During certain incomplete operations – for example when a merge
  1785. resulted in a conflict – additional information is displayed that helps
  1786. proceeding with or aborting the operation.
  1787. The command ‘magit-status’ displays the status buffer belonging to
  1788. the current repository in another window. This command is used so often
  1789. that it should be bound globally. We recommend using ‘C-x g’:
  1790. (global-set-key (kbd "C-x g") 'magit-status)
  1791. ‘C-x g’ (‘magit-status’)
  1792. When invoked from within an existing Git repository, then this
  1793. command shows the status of that repository in a buffer.
  1794. If the current directory isn’t located within a Git repository,
  1795. then this command prompts for an existing repository or an
  1796. arbitrary directory, depending on the option
  1797. ‘magit-repository-directories’, and the status for the selected
  1798. repository is shown instead.
  1799. • If that option specifies any existing repositories, then the
  1800. user is asked to select one of them.
  1801. • Otherwise the user is asked to select an arbitrary directory
  1802. using regular file-name completion. If the selected directory
  1803. is the top-level directory of an existing working tree, then
  1804. the status buffer for that is shown.
  1805. • Otherwise the user is offered to initialize the selected
  1806. directory as a new repository. After creating the repository
  1807. its status buffer is shown.
  1808. These fallback behaviors can also be forced using one or more
  1809. prefix arguments:
  1810. • With two prefix arguments (or more precisely a numeric prefix
  1811. value of 16 or greater) an arbitrary directory is read, which
  1812. is then acted on as described above. The same could be
  1813. accomplished using the command ‘magit-init’.
  1814. • With a single prefix argument an existing repository is read
  1815. from the user, or if no repository can be found based on the
  1816. value of ‘magit-repository-directories’, then the behavior is
  1817. the same as with two prefix arguments.
  1818. -- User Option: magit-repository-directories
  1819. List of directories that are Git repositories or contain Git
  1820. repositories.
  1821. Each element has the form ‘(DIRECTORY . DEPTH)’. DIRECTORY has to
  1822. be a directory or a directory file-name, a string. DEPTH, an
  1823. integer, specifies the maximum depth to look for Git repositories.
  1824. If it is 0, then only add DIRECTORY itself.
  1825. This option controls which repositories are being listed by
  1826. ‘magit-list-repositories’. It also affects ‘magit-status’ (which
  1827. see) in potentially surprising ways (see above).
  1828. -- Command: ido-enter-magit-status
  1829. From an Ido prompt used to open a file, instead drop into
  1830. ‘magit-status’. This is similar to ‘ido-magic-delete-char’, which,
  1831. despite its name, usually causes a Dired buffer to be created.
  1832. To make this command available, use something like:
  1833. (add-hook 'ido-setup-hook
  1834. (lambda ()
  1835. (define-key ido-completion-map
  1836. (kbd \"C-x g\") 'ido-enter-magit-status)))
  1837. Starting with Emacs 25.1 the Ido keymaps are defined just once
  1838. instead of every time Ido is invoked, so now you can modify it like
  1839. pretty much every other keymap:
  1840. (define-key ido-common-completion-map
  1841. (kbd \"C-x g\") 'ido-enter-magit-status)
  1842. * Menu:
  1843. * Status Sections::
  1844. * Status Header Sections::
  1845. * Status Module Sections::
  1846. * Status Options::
  1847. 
  1848. File: magit.info, Node: Status Sections, Next: Status Header Sections, Up: Status Buffer
  1849. 5.1.1 Status Sections
  1850. ---------------------
  1851. The contents of status buffers is controlled using the hook
  1852. ‘magit-status-sections-hook’. See *note Section Hooks:: to learn about
  1853. such hooks and how to customize them.
  1854. -- User Option: magit-status-sections-hook
  1855. Hook run to insert sections into a status buffer.
  1856. The first function on that hook by default is
  1857. ‘magit-insert-status-headers’; it is described in the next section. By
  1858. default the following functions are also members of that hook:
  1859. -- Function: magit-insert-merge-log
  1860. Insert section for the on-going merge. Display the heads that are
  1861. being merged. If no merge is in progress, do nothing.
  1862. -- Function: magit-insert-rebase-sequence
  1863. Insert section for the on-going rebase sequence. If no such
  1864. sequence is in progress, do nothing.
  1865. -- Function: magit-insert-am-sequence
  1866. Insert section for the on-going patch applying sequence. If no
  1867. such sequence is in progress, do nothing.
  1868. -- Function: magit-insert-sequencer-sequence
  1869. Insert section for the on-going cherry-pick or revert sequence. If
  1870. no such sequence is in progress, do nothing.
  1871. -- Function: magit-insert-bisect-output
  1872. While bisecting, insert section with output from ‘git bisect’.
  1873. -- Function: magit-insert-bisect-rest
  1874. While bisecting, insert section visualizing the bisect state.
  1875. -- Function: magit-insert-bisect-log
  1876. While bisecting, insert section logging bisect progress.
  1877. -- Function: magit-insert-untracked-files
  1878. Maybe insert a list or tree of untracked files.
  1879. Do so depending on the value of ‘status.showUntrackedFiles’. Note
  1880. that even if the value is ‘all’, Magit still initially only shows
  1881. directories. But the directory sections can then be expanded using
  1882. ‘TAB’.
  1883. -- Function: magit-insert-unstaged-changes
  1884. Insert section showing unstaged changes.
  1885. -- Function: magit-insert-staged-changes
  1886. Insert section showing staged changes.
  1887. -- Function: magit-insert-stashes &optional ref heading
  1888. Insert the ‘stashes’ section showing reflog for "refs/stash". If
  1889. optional REF is non-nil show reflog for that instead. If optional
  1890. HEADING is non-nil use that as section heading instead of
  1891. "Stashes:".
  1892. -- Function: magit-insert-unpulled-from-upstream
  1893. Insert section showing commits that haven’t been pulled from the
  1894. upstream branch yet.
  1895. -- Function: magit-insert-unpulled-from-pushremote
  1896. Insert section showing commits that haven’t been pulled from the
  1897. push-remote branch yet.
  1898. -- Function: magit-insert-unpushed-to-upstream
  1899. Insert section showing commits that haven’t been pushed to the
  1900. upstream yet.
  1901. -- Function: magit-insert-unpushed-to-pushremote
  1902. Insert section showing commits that haven’t been pushed to the
  1903. push-remote yet.
  1904. The following functions can also be added to the above hook:
  1905. -- Function: magit-insert-tracked-files
  1906. Insert a tree of tracked files.
  1907. -- Function: magit-insert-ignored-files
  1908. Insert a tree of ignored files. Its possible to limit the logs in
  1909. the current buffer to a certain directory using ‘D = f <DIRECTORY>
  1910. RET g’. If you do that, then that that also affects this command.
  1911. The log filter can be used to limit to multiple files. In that
  1912. case this function only respects the first of the files and only if
  1913. it is a directory.
  1914. -- Function: magit-insert-skip-worktree-files
  1915. Insert a tree of skip-worktree files. If the first element of
  1916. ‘magit-buffer-diff-files’ is a directory, then limit the list to
  1917. files below that. The value of that variable can be set using ‘D
  1918. -- DIRECTORY RET g’.
  1919. -- Function: magit-insert-assumed-unchanged-files
  1920. Insert a tree of files that are assumed to be unchanged. If the
  1921. first element of ‘magit-buffer-diff-files’ is a directory, then
  1922. limit the list to files below that. The value of that variable can
  1923. be set using ‘D -- DIRECTORY RET g’.
  1924. -- Function: magit-insert-unpulled-or-recent-commits
  1925. Insert section showing unpulled or recent commits. If an upstream
  1926. is configured for the current branch and it is ahead of the current
  1927. branch, then show the missing commits. Otherwise, show the last
  1928. ‘magit-log-section-commit-count’ commits.
  1929. -- Function: magit-insert-recent-commits
  1930. Insert section showing the last ‘magit-log-section-commit-count’
  1931. commits.
  1932. -- User Option: magit-log-section-commit-count
  1933. How many recent commits ‘magit-insert-recent-commits’ and
  1934. ‘magit-insert-unpulled-or-recent-commits’ (provided there are no
  1935. unpulled commits) show.
  1936. -- Function: magit-insert-unpulled-cherries
  1937. Insert section showing unpulled commits. Like
  1938. ‘magit-insert-unpulled-commits’ but prefix each commit that has not
  1939. been applied yet (i.e. a commit with a patch-id not shared with
  1940. any local commit) with "+", and all others with "-".
  1941. -- Function: magit-insert-unpushed-cherries
  1942. Insert section showing unpushed commits. Like
  1943. ‘magit-insert-unpushed-commits’ but prefix each commit which has
  1944. not been applied to upstream yet (i.e. a commit with a patch-id
  1945. not shared with any upstream commit) with "+" and all others with
  1946. "-".
  1947. See *note References Buffer:: for some more section inserters, which
  1948. could be used here.
  1949. 
  1950. File: magit.info, Node: Status Header Sections, Next: Status Module Sections, Prev: Status Sections, Up: Status Buffer
  1951. 5.1.2 Status Header Sections
  1952. ----------------------------
  1953. The contents of status buffers is controlled using the hook
  1954. ‘magit-status-sections-hook’ (see *note Status Sections::).
  1955. By default ‘magit-insert-status-headers’ is the first member of that
  1956. hook variable.
  1957. -- Function: magit-insert-status-headers
  1958. Insert headers sections appropriate for ‘magit-status-mode’
  1959. buffers. The sections are inserted by running the functions on the
  1960. hook ‘magit-status-headers-hook’.
  1961. -- User Option: magit-status-headers-hook
  1962. Hook run to insert headers sections into the status buffer.
  1963. This hook is run by ‘magit-insert-status-headers’, which in turn
  1964. has to be a member of ‘magit-status-sections-hook’ to be used at
  1965. all.
  1966. By default the following functions are members of the above hook:
  1967. -- Function: magit-insert-error-header
  1968. Insert a header line showing the message about the Git error that
  1969. just occurred.
  1970. This function is only aware of the last error that occur when Git
  1971. was run for side-effects. If, for example, an error occurs while
  1972. generating a diff, then that error won’t be inserted. Refreshing
  1973. the status buffer causes this section to disappear again.
  1974. -- Function: magit-insert-diff-filter-header
  1975. Insert a header line showing the effective diff filters.
  1976. -- Function: magit-insert-head-branch-header
  1977. Insert a header line about the current branch or detached ‘HEAD’.
  1978. -- Function: magit-insert-upstream-branch-header
  1979. Insert a header line about the branch that is usually pulled into
  1980. the current branch.
  1981. -- Function: magit-insert-push-branch-header
  1982. Insert a header line about the branch that the current branch is
  1983. usually pushed to.
  1984. -- Function: magit-insert-tags-header
  1985. Insert a header line about the current and/or next tag, along with
  1986. the number of commits between the tag and ‘HEAD’.
  1987. The following functions can also be added to the above hook:
  1988. -- Function: magit-insert-repo-header
  1989. Insert a header line showing the path to the repository top-level.
  1990. -- Function: magit-insert-remote-header
  1991. Insert a header line about the remote of the current branch.
  1992. If no remote is configured for the current branch, then fall back
  1993. showing the "origin" remote, or if that does not exist the first
  1994. remote in alphabetic order.
  1995. -- Function: magit-insert-user-header
  1996. Insert a header line about the current user.
  1997. 
  1998. File: magit.info, Node: Status Module Sections, Next: Status Options, Prev: Status Header Sections, Up: Status Buffer
  1999. 5.1.3 Status Module Sections
  2000. ----------------------------
  2001. The contents of status buffers is controlled using the hook
  2002. ‘magit-status-sections-hook’ (see *note Status Sections::).
  2003. By default ‘magit-insert-modules’ is _not_ a member of that hook
  2004. variable.
  2005. -- Function: magit-insert-modules
  2006. Insert submodule sections.
  2007. Hook ‘magit-module-sections-hook’ controls which module sections
  2008. are inserted, and option ‘magit-module-sections-nested’ controls
  2009. whether they are wrapped in an additional section.
  2010. -- User Option: magit-module-sections-hook
  2011. Hook run by ‘magit-insert-modules’.
  2012. -- User Option: magit-module-sections-nested
  2013. This option controls whether ‘magit-insert-modules’ wraps inserted
  2014. sections in an additional section.
  2015. If this is non-nil, then only a single top-level section is
  2016. inserted. If it is nil, then all sections listed in
  2017. ‘magit-module-sections-hook’ become top-level sections.
  2018. -- Function: magit-insert-modules-overview
  2019. Insert sections for all submodules. For each section insert the
  2020. path, the branch, and the output of ‘git describe --tags’, or,
  2021. failing that, the abbreviated HEAD commit hash.
  2022. Press ‘RET’ on such a submodule section to show its own status
  2023. buffer. Press ‘RET’ on the "Modules" section to display a list of
  2024. submodules in a separate buffer. This shows additional information
  2025. not displayed in the super-repository’s status buffer.
  2026. -- Function: magit-insert-modules-unpulled-from-upstream
  2027. Insert sections for modules that haven’t been pulled from the
  2028. upstream yet. These sections can be expanded to show the
  2029. respective commits.
  2030. -- Function: magit-insert-modules-unpulled-from-pushremote
  2031. Insert sections for modules that haven’t been pulled from the
  2032. push-remote yet. These sections can be expanded to show the
  2033. respective commits.
  2034. -- Function: magit-insert-modules-unpushed-to-upstream
  2035. Insert sections for modules that haven’t been pushed to the
  2036. upstream yet. These sections can be expanded to show the
  2037. respective commits.
  2038. -- Function: magit-insert-modules-unpushed-to-pushremote
  2039. Insert sections for modules that haven’t been pushed to the
  2040. push-remote yet. These sections can be expanded to show the
  2041. respective commits.
  2042. 
  2043. File: magit.info, Node: Status Options, Prev: Status Module Sections, Up: Status Buffer
  2044. 5.1.4 Status Options
  2045. --------------------
  2046. -- User Option: magit-status-refresh-hook
  2047. Hook run after a status buffer has been refreshed.
  2048. -- User Option: magit-status-margin
  2049. This option specifies whether the margin is initially shown in
  2050. Magit-Status mode buffers and how it is formatted.
  2051. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  2052. • If INIT is non-nil, then the margin is shown initially.
  2053. • STYLE controls how to format the committer date. It can be
  2054. one of ‘age’ (to show the age of the commit),
  2055. ‘age-abbreviated’ (to abbreviate the time unit to a
  2056. character), or a string (suitable for ‘format-time-string’) to
  2057. show the actual date.
  2058. • WIDTH controls the width of the margin. This exists for
  2059. forward compatibility and currently the value should not be
  2060. changed.
  2061. • AUTHOR controls whether the name of the author is also shown
  2062. by default.
  2063. • AUTHOR-WIDTH has to be an integer. When the name of the
  2064. author is shown, then this specifies how much space is used to
  2065. do so.
  2066. -- User Option: magit-log-section-args
  2067. Additional Git arguments used when creating log sections. Only
  2068. ‘--graph’, ‘--decorate’, and ‘--show-signature’ are supported.
  2069. This option is only a temporary kludge and will be removed.
  2070. Note that due to an issue in Git the use of ‘--graph’ is very slow
  2071. with long histories, so you probably don’t want to add this here.
  2072. Also see the proceeding section for more options concerning status
  2073. buffers.
  2074. 
  2075. File: magit.info, Node: Repository List, Next: Logging, Prev: Status Buffer, Up: Inspecting
  2076. 5.2 Repository List
  2077. ===================
  2078. -- Command: magit-list-repositories
  2079. This command displays a list of repositories in a separate buffer.
  2080. The options ‘magit-repository-directories’ and
  2081. ‘magit-repository-directories-depth’ control which repositories are
  2082. displayed.
  2083. -- User Option: magit-repolist-columns
  2084. This option controls what columns are displayed by the command
  2085. ‘magit-list-repositories’ and how they are displayed.
  2086. Each element has the form ‘(HEADER WIDTH FORMAT PROPS)’.
  2087. HEADER is the string displayed in the header. WIDTH is the width
  2088. of the column. FORMAT is a function that is called with one
  2089. argument, the repository identification (usually its basename), and
  2090. with ‘default-directory’ bound to the toplevel of its working tree.
  2091. It has to return a string to be inserted or nil. PROPS is an alist
  2092. that supports the keys ‘:right-align’ and ‘:pad-right’.
  2093. The following functions can be added to the above option:
  2094. -- Function: magit-repolist-column-ident
  2095. This function inserts the identification of the repository.
  2096. Usually this is just its basename.
  2097. -- Function: magit-repolist-column-path
  2098. This function inserts the absolute path of the repository.
  2099. -- Function: magit-repolist-column-version
  2100. This function inserts a description of the repository’s ‘HEAD’
  2101. revision.
  2102. -- Function: magit-repolist-column-unpulled-from-upstream
  2103. This function inserts the number of upstream commits not in the
  2104. current branch.
  2105. -- Function: magit-repolist-column-unpulled-from-pushremote
  2106. This function inserts the number of commits in the push branch but
  2107. not the current branch.
  2108. -- Function: magit-repolist-column-unpushed-to-upstream
  2109. This function inserts the number of commits in the current branch
  2110. but not its upstream.
  2111. -- Function: magit-repolist-column-unpushed-to-pushremote
  2112. This function inserts the number of commits in the current branch
  2113. but not its push branch.
  2114. 
  2115. File: magit.info, Node: Logging, Next: Diffing, Prev: Repository List, Up: Inspecting
  2116. 5.3 Logging
  2117. ===========
  2118. The status buffer contains logs for the unpushed and unpulled commits,
  2119. but that obviously isn’t enough. The transient prefix command
  2120. ‘magit-log’, on ‘l’, features several suffix commands, which show a
  2121. specific log in a separate log buffer.
  2122. Like other transient prefix commands, ‘magit-log’ also features
  2123. several infix arguments that can be changed before invoking one of the
  2124. suffix commands. However, in the case of the log transient, these
  2125. arguments may be taken from those currently in use in the current
  2126. repository’s log buffer, depending on the value of
  2127. ‘magit-prefix-use-buffer-arguments’ (see *note Transient Arguments and
  2128. Buffer Variables::).
  2129. For information about the various arguments, see *note
  2130. (gitman)git-log::.
  2131. The switch ‘++order=VALUE’ is converted to one of
  2132. ‘--author-date-order’, ‘--date-order’, or ‘--topo-order’ before being
  2133. passed to ‘git log’.
  2134. The log transient also features several reflog commands. See *note
  2135. Reflog::.
  2136. ‘l’ (‘magit-log’)
  2137. This transient prefix command binds the following suffix commands
  2138. along with the appropriate infix arguments and displays them in a
  2139. temporary buffer until a suffix is invoked.
  2140. ‘l l’ (‘magit-log-current’)
  2141. Show log for the current branch. When ‘HEAD’ is detached or with a
  2142. prefix argument, show log for one or more revs read from the
  2143. minibuffer.
  2144. ‘l o’ (‘magit-log-other’)
  2145. Show log for one or more revs read from the minibuffer. The user
  2146. can input any revision or revisions separated by a space, or even
  2147. ranges, but only branches, tags, and a representation of the commit
  2148. at point are available as completion candidates.
  2149. ‘l h’ (‘magit-log-head’)
  2150. Show log for ‘HEAD’.
  2151. ‘l L’ (‘magit-log-branches’)
  2152. Show log for all local branches and ‘HEAD’.
  2153. ‘l b’ (‘magit-log-all-branches’)
  2154. Show log for all local and remote branches and ‘HEAD’.
  2155. ‘l a’ (‘magit-log-all’)
  2156. Show log for all references and ‘HEAD’.
  2157. Two additional commands that show the log for the file or blob that
  2158. is being visited in the current buffer exists, see *note Minor Mode for
  2159. Buffers Visiting Files::. The command ‘magit-cherry’ also shows a log,
  2160. see *note Cherries::.
  2161. * Menu:
  2162. * Refreshing Logs::
  2163. * Log Buffer::
  2164. * Log Margin::
  2165. * Select from Log::
  2166. * Reflog::
  2167. * Cherries::
  2168. 
  2169. File: magit.info, Node: Refreshing Logs, Next: Log Buffer, Up: Logging
  2170. 5.3.1 Refreshing Logs
  2171. ---------------------
  2172. The transient prefix command ‘magit-log-refresh’, on ‘L’, can be used to
  2173. change the log arguments used in the current buffer, without changing
  2174. which log is shown. This works in dedicated log buffers, but also in
  2175. the status buffer.
  2176. ‘L’ (‘magit-log-refresh’)
  2177. This transient prefix command binds the following suffix commands
  2178. along with the appropriate infix arguments and displays them in a
  2179. temporary buffer until a suffix is invoked.
  2180. ‘L g’ (‘magit-log-refresh’)
  2181. This suffix command sets the local log arguments for the current
  2182. buffer.
  2183. ‘L s’ (‘magit-log-set-default-arguments’)
  2184. This suffix command sets the default log arguments for buffers of
  2185. the same type as that of the current buffer. Other existing
  2186. buffers of the same type are not affected because their local
  2187. values have already been initialized.
  2188. ‘L w’ (‘magit-log-save-default-arguments’)
  2189. This suffix command sets the default log arguments for buffers of
  2190. the same type as that of the current buffer, and saves the value
  2191. for future sessions. Other existing buffers of the same type are
  2192. not affected because their local values have already been
  2193. initialized.
  2194. ‘L t’ (‘magit-toggle-margin’)
  2195. Show or hide the margin.
  2196. 
  2197. File: magit.info, Node: Log Buffer, Next: Log Margin, Prev: Refreshing Logs, Up: Logging
  2198. 5.3.2 Log Buffer
  2199. ----------------
  2200. ‘L’ (‘magit-log-refresh’)
  2201. This transient prefix command binds the following suffix commands
  2202. along with the appropriate infix arguments and displays them in a
  2203. temporary buffer until a suffix is invoked.
  2204. See *note Refreshing Logs::.
  2205. ‘q’ (‘magit-log-bury-buffer’)
  2206. Bury the current buffer or the revision buffer in the same frame.
  2207. Like ‘magit-mode-bury-buffer’ (which see) but with a negative
  2208. prefix argument instead bury the revision buffer, provided it is
  2209. displayed in the current frame.
  2210. ‘C-c C-b’ (‘magit-go-backward’)
  2211. Move backward in current buffer’s history.
  2212. ‘C-c C-f’ (‘magit-go-forward’)
  2213. Move forward in current buffer’s history.
  2214. ‘C-c C-n’ (‘magit-log-move-to-parent’)
  2215. Move to a parent of the current commit. By default, this is the
  2216. first parent, but a numeric prefix can be used to specify another
  2217. parent.
  2218. ‘SPC’ (‘magit-diff-show-or-scroll-up’)
  2219. Update the commit or diff buffer for the thing at point.
  2220. Either show the commit or stash at point in the appropriate buffer,
  2221. or if that buffer is already being displayed in the current frame
  2222. and contains information about that commit or stash, then instead
  2223. scroll the buffer up. If there is no commit or stash at point,
  2224. then prompt for a commit.
  2225. ‘DEL’ (‘magit-diff-show-or-scroll-down’)
  2226. Update the commit or diff buffer for the thing at point.
  2227. Either show the commit or stash at point in the appropriate buffer,
  2228. or if that buffer is already being displayed in the current frame
  2229. and contains information about that commit or stash, then instead
  2230. scroll the buffer down. If there is no commit or stash at point,
  2231. then prompt for a commit.
  2232. ‘=’ (‘magit-log-toggle-commit-limit’)
  2233. Toggle the number of commits the current log buffer is limited to.
  2234. If the number of commits is currently limited, then remove that
  2235. limit. Otherwise set it to 256.
  2236. ‘+’ (‘magit-log-double-commit-limit’)
  2237. Double the number of commits the current log buffer is limited to.
  2238. ‘-’ (‘magit-log-half-commit-limit’)
  2239. Half the number of commits the current log buffer is limited to.
  2240. -- User Option: magit-log-auto-more
  2241. Insert more log entries automatically when moving past the last
  2242. entry. Only considered when moving past the last entry with
  2243. ‘magit-goto-*-section’ commands.
  2244. -- User Option: magit-log-show-refname-after-summary
  2245. Whether to show the refnames after the commit summaries. This is
  2246. useful if you use really long branch names.
  2247. Magit displays references in logs a bit differently from how Git does
  2248. it.
  2249. Local branches are blue and remote branches are green. Of course
  2250. that depends on the used theme, as do the colors used for other types of
  2251. references. The current branch has a box around it, as do remote
  2252. branches that are their respective remote’s ‘HEAD’ branch.
  2253. If a local branch and its push-target point at the same commit, then
  2254. their names are combined to preserve space and to make that relationship
  2255. visible. For example:
  2256. origin/feature
  2257. [green][blue-]
  2258. instead of
  2259. feature origin/feature
  2260. [blue-] [green-------]
  2261. Also note that while the transient features the ‘--show-signature’
  2262. argument, that won’t actually be used when enabled, because Magit
  2263. defaults to use just one line per commit. Instead the commit colorized
  2264. to indicate the validity of the signed commit object, using the faces
  2265. named ‘magit-signature-*’ (which see).
  2266. For a description of ‘magit-log-margin’ see *note Log Margin::.
  2267. 
  2268. File: magit.info, Node: Log Margin, Next: Select from Log, Prev: Log Buffer, Up: Logging
  2269. 5.3.3 Log Margin
  2270. ----------------
  2271. In buffers which show one or more logs, it is possible to show
  2272. additional information about each commit in the margin. The options
  2273. used to configure the margin are named ‘magit-INFIX-margin’, where INFIX
  2274. is the same as in the respective major-mode ‘magit-INFIX-mode’. In
  2275. regular log buffers that would be ‘magit-log-margin’.
  2276. -- User Option: magit-log-margin
  2277. This option specifies whether the margin is initially shown in
  2278. Magit-Log mode buffers and how it is formatted.
  2279. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  2280. • If INIT is non-nil, then the margin is shown initially.
  2281. • STYLE controls how to format the committer date. It can be
  2282. one of ‘age’ (to show the age of the commit),
  2283. ‘age-abbreviated’ (to abbreviate the time unit to a
  2284. character), or a string (suitable for ‘format-time-string’) to
  2285. show the actual date.
  2286. • WIDTH controls the width of the margin. This exists for
  2287. forward compatibility and currently the value should not be
  2288. changed.
  2289. • AUTHOR controls whether the name of the author is also shown
  2290. by default.
  2291. • AUTHOR-WIDTH has to be an integer. When the name of the
  2292. author is shown, then this specifies how much space is used to
  2293. do so.
  2294. You can change the STYLE and AUTHOR-WIDTH of all ‘magit-INFIX-margin’
  2295. options to the same values by customizing ‘magit-log-margin’ *before*
  2296. ‘magit’ is loaded. If you do that, then the respective values for the
  2297. other options will default to what you have set for that variable.
  2298. Likewise if you set INIT in ‘magit-log-margin’ to ‘nil’, then that is
  2299. used in the default of all other options. But setting it to ‘t’, i.e.
  2300. re-enforcing the default for that option, does not carry to other
  2301. options.
  2302. ‘L’ (‘magit-margin-settings’)
  2303. This transient prefix command binds the following suffix commands,
  2304. each of which changes the appearance of the margin in some way.
  2305. In some buffers that support the margin, ‘L’ is instead bound to
  2306. ‘magit-log-refresh’, but that transient features the same commands, and
  2307. then some other unrelated commands.
  2308. ‘L L’ (‘magit-toggle-margin’)
  2309. This command shows or hides the margin.
  2310. ‘L l’ (‘magit-cycle-margin-style’)
  2311. This command cycles the style used for the margin.
  2312. ‘L d’ (‘magit-toggle-margin-details’)
  2313. This command shows or hides details in the margin.
  2314. 
  2315. File: magit.info, Node: Select from Log, Next: Reflog, Prev: Log Margin, Up: Logging
  2316. 5.3.4 Select from Log
  2317. ---------------------
  2318. When the user has to select a recent commit that is reachable from
  2319. ‘HEAD’, using regular completion would be inconvenient (because most
  2320. humans cannot remember hashes or "HEAD~5", at least not without double
  2321. checking). Instead a log buffer is used to select the commit, which has
  2322. the advantage that commits are presented in order and with the commit
  2323. message.
  2324. Such selection logs are used when selecting the beginning of a rebase
  2325. and when selecting the commit to be squashed into.
  2326. In addition to the key bindings available in all log buffers, the
  2327. following additional key bindings are available in selection log
  2328. buffers:
  2329. ‘C-c C-c’ (‘magit-log-select-pick’)
  2330. Select the commit at point and act on it. Call
  2331. ‘magit-log-select-pick-function’ with the selected commit as
  2332. argument.
  2333. ‘C-c C-k’ (‘magit-log-select-quit’)
  2334. Abort selecting a commit, don’t act on any commit.
  2335. -- User Option: magit-log-select-margin
  2336. This option specifies whether the margin is initially shown in
  2337. Magit-Log-Select mode buffers and how it is formatted.
  2338. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  2339. • If INIT is non-nil, then the margin is shown initially.
  2340. • STYLE controls how to format the committer date. It can be
  2341. one of ‘age’ (to show the age of the commit),
  2342. ‘age-abbreviated’ (to abbreviate the time unit to a
  2343. character), or a string (suitable for ‘format-time-string’) to
  2344. show the actual date.
  2345. • WIDTH controls the width of the margin. This exists for
  2346. forward compatibility and currently the value should not be
  2347. changed.
  2348. • AUTHOR controls whether the name of the author is also shown
  2349. by default.
  2350. • AUTHOR-WIDTH has to be an integer. When the name of the
  2351. author is shown, then this specifies how much space is used to
  2352. do so.
  2353. 
  2354. File: magit.info, Node: Reflog, Next: Cherries, Prev: Select from Log, Up: Logging
  2355. 5.3.5 Reflog
  2356. ------------
  2357. Also see *note (gitman)git-reflog::.
  2358. These reflog commands are available from the log transient. See
  2359. *note Logging::.
  2360. ‘l r’ (‘magit-reflog-current’)
  2361. Display the reflog of the current branch.
  2362. ‘l O’ (‘magit-reflog-other’)
  2363. Display the reflog of a branch or another ref.
  2364. ‘l H’ (‘magit-reflog-head’)
  2365. Display the ‘HEAD’ reflog.
  2366. -- User Option: magit-reflog-margin
  2367. This option specifies whether the margin is initially shown in
  2368. Magit-Reflog mode buffers and how it is formatted.
  2369. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  2370. • If INIT is non-nil, then the margin is shown initially.
  2371. • STYLE controls how to format the committer date. It can be
  2372. one of ‘age’ (to show the age of the commit),
  2373. ‘age-abbreviated’ (to abbreviate the time unit to a
  2374. character), or a string (suitable for ‘format-time-string’) to
  2375. show the actual date.
  2376. • WIDTH controls the width of the margin. This exists for
  2377. forward compatibility and currently the value should not be
  2378. changed.
  2379. • AUTHOR controls whether the name of the author is also shown
  2380. by default.
  2381. • AUTHOR-WIDTH has to be an integer. When the name of the
  2382. author is shown, then this specifies how much space is used to
  2383. do so.
  2384. 
  2385. File: magit.info, Node: Cherries, Prev: Reflog, Up: Logging
  2386. 5.3.6 Cherries
  2387. --------------
  2388. Cherries are commits that haven’t been applied upstream (yet), and are
  2389. usually visualized using a log. Each commit is prefixed with ‘-’ if it
  2390. has an equivalent in the upstream and ‘+’ if it does not, i.e. if it is
  2391. a cherry.
  2392. The command ‘magit-cherry’ shows cherries for a single branch, but
  2393. the references buffer (see *note References Buffer::) can show cherries
  2394. for multiple "upstreams" at once.
  2395. Also see *note (gitman)git-reflog::.
  2396. ‘Y’ (‘magit-cherry’)
  2397. Show commits that are in a certain branch but that have not been
  2398. merged in the upstream branch.
  2399. -- User Option: magit-cherry-margin
  2400. This option specifies whether the margin is initially shown in
  2401. Magit-Cherry mode buffers and how it is formatted.
  2402. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  2403. • If INIT is non-nil, then the margin is shown initially.
  2404. • STYLE controls how to format the committer date. It can be
  2405. one of ‘age’ (to show the age of the commit),
  2406. ‘age-abbreviated’ (to abbreviate the time unit to a
  2407. character), or a string (suitable for ‘format-time-string’) to
  2408. show the actual date.
  2409. • WIDTH controls the width of the margin. This exists for
  2410. forward compatibility and currently the value should not be
  2411. changed.
  2412. • AUTHOR controls whether the name of the author is also shown
  2413. by default.
  2414. • AUTHOR-WIDTH has to be an integer. When the name of the
  2415. author is shown, then this specifies how much space is used to
  2416. do so.
  2417. 
  2418. File: magit.info, Node: Diffing, Next: Ediffing, Prev: Logging, Up: Inspecting
  2419. 5.4 Diffing
  2420. ===========
  2421. The status buffer contains diffs for the staged and unstaged commits,
  2422. but that obviously isn’t enough. The transient prefix command
  2423. ‘magit-diff’, on ‘d’, features several suffix commands, which show a
  2424. specific diff in a separate diff buffer.
  2425. Like other transient prefix commands, ‘magit-diff’ also features
  2426. several infix arguments that can be changed before invoking one of the
  2427. suffix commands. However, in the case of the diff transient, these
  2428. arguments may be taken from those currently in use in the current
  2429. repository’s diff buffer, depending on the value of
  2430. ‘magit-prefix-use-buffer-arguments’ (see *note Transient Arguments and
  2431. Buffer Variables::).
  2432. Also see *note (gitman)git-diff::.
  2433. ‘d’ (‘magit-diff’)
  2434. This transient prefix command binds the following suffix commands
  2435. along with the appropriate infix arguments and displays them in a
  2436. temporary buffer until a suffix is invoked.
  2437. ‘d d’ (‘magit-diff-dwim’)
  2438. Show changes for the thing at point.
  2439. ‘d r’ (‘magit-diff-range’)
  2440. Show differences between two commits.
  2441. RANGE should be a range (A..B or A...B) but can also be a single
  2442. commit. If one side of the range is omitted, then it defaults to
  2443. ‘HEAD’. If just a commit is given, then changes in the working
  2444. tree relative to that commit are shown.
  2445. If the region is active, use the revisions on the first and last
  2446. line of the region. With a prefix argument, instead of diffing the
  2447. revisions, choose a revision to view changes along, starting at the
  2448. common ancestor of both revisions (i.e., use a "..." range).
  2449. ‘d w’ (‘magit-diff-working-tree’)
  2450. Show changes between the current working tree and the ‘HEAD’
  2451. commit. With a prefix argument show changes between the working
  2452. tree and a commit read from the minibuffer.
  2453. ‘d s’ (‘magit-diff-staged’)
  2454. Show changes between the index and the ‘HEAD’ commit. With a
  2455. prefix argument show changes between the index and a commit read
  2456. from the minibuffer.
  2457. ‘d u’ (‘magit-diff-unstaged’)
  2458. Show changes between the working tree and the index.
  2459. ‘d p’ (‘magit-diff-paths’)
  2460. Show changes between any two files on disk.
  2461. All of the above suffix commands update the repository’s diff buffer.
  2462. The diff transient also features two commands which show differences in
  2463. another buffer:
  2464. ‘d c’ (‘magit-show-commit’)
  2465. Show the commit at point. If there is no commit at point or with a
  2466. prefix argument, prompt for a commit.
  2467. ‘d t’ (‘magit-stash-show’)
  2468. Show all diffs of a stash in a buffer.
  2469. Two additional commands that show the diff for the file or blob that
  2470. is being visited in the current buffer exists, see *note Minor Mode for
  2471. Buffers Visiting Files::.
  2472. * Menu:
  2473. * Refreshing Diffs::
  2474. * Commands Available in Diffs::
  2475. * Diff Options::
  2476. * Revision Buffer::
  2477. 
  2478. File: magit.info, Node: Refreshing Diffs, Next: Commands Available in Diffs, Up: Diffing
  2479. 5.4.1 Refreshing Diffs
  2480. ----------------------
  2481. The transient prefix command ‘magit-diff-refresh’, on ‘D’, can be used
  2482. to change the diff arguments used in the current buffer, without
  2483. changing which diff is shown. This works in dedicated diff buffers, but
  2484. also in the status buffer.
  2485. ‘D’ (‘magit-diff-refresh’)
  2486. This transient prefix command binds the following suffix commands
  2487. along with the appropriate infix arguments and displays them in a
  2488. temporary buffer until a suffix is invoked.
  2489. ‘D g’ (‘magit-diff-refresh’)
  2490. This suffix command sets the local diff arguments for the current
  2491. buffer.
  2492. ‘D s’ (‘magit-diff-set-default-arguments’)
  2493. This suffix command sets the default diff arguments for buffers of
  2494. the same type as that of the current buffer. Other existing
  2495. buffers of the same type are not affected because their local
  2496. values have already been initialized.
  2497. ‘D w’ (‘magit-diff-save-default-arguments’)
  2498. This suffix command sets the default diff arguments for buffers of
  2499. the same type as that of the current buffer, and saves the value
  2500. for future sessions. Other existing buffers of the same type are
  2501. not affected because their local values have already been
  2502. initialized.
  2503. ‘D t’ (‘magit-diff-toggle-refine-hunk’)
  2504. This command toggles hunk refinement on or off.
  2505. ‘D r’ (‘magit-diff-switch-range-type’)
  2506. This command converts the diff range type from "revA..revB" to
  2507. "revB...revA", or vice versa.
  2508. ‘D f’ (‘magit-diff-flip-revs’)
  2509. This command swaps revisions in the diff range from "revA..revB" to
  2510. "revB..revA", or vice versa.
  2511. ‘D F’ (‘magit-diff-toggle-file-filter’)
  2512. This command toggles the file restriction of the diffs in the
  2513. current buffer, allowing you to quickly switch between viewing all
  2514. the changes in the commit and the restricted subset. As a special
  2515. case, when this command is called from a log buffer, it toggles the
  2516. file restriction in the repository’s revision buffer, which is
  2517. useful when you display a revision from a log buffer that is
  2518. restricted to a file or files.
  2519. In addition to the above transient, which allows changing any of the
  2520. supported arguments, there also exist some commands that change only a
  2521. particular argument.
  2522. ‘-’ (‘magit-diff-less-context’)
  2523. This command decreases the context for diff hunks by COUNT lines.
  2524. ‘+’ (‘magit-diff-more-context’)
  2525. This command increases the context for diff hunks by COUNT lines.
  2526. ‘0’ (‘magit-diff-default-context’)
  2527. This command resets the context for diff hunks to the default
  2528. height.
  2529. The following commands quickly change what diff is being displayed
  2530. without having to using one of the diff transient.
  2531. ‘C-c C-d’ (‘magit-diff-while-committing’)
  2532. While committing, this command shows the changes that are about to
  2533. be committed. While amending, invoking the command again toggles
  2534. between showing just the new changes or all the changes that will
  2535. be committed.
  2536. This binding is available in the diff buffer as well as the commit
  2537. message buffer.
  2538. ‘C-c C-b’ (‘magit-go-backward’)
  2539. This command moves backward in current buffer’s history.
  2540. ‘C-c C-f’ (‘magit-go-forward’)
  2541. This command moves forward in current buffer’s history.
  2542. 
  2543. File: magit.info, Node: Commands Available in Diffs, Next: Diff Options, Prev: Refreshing Diffs, Up: Diffing
  2544. 5.4.2 Commands Available in Diffs
  2545. ---------------------------------
  2546. Some commands are only available if point is inside a diff.
  2547. ‘magit-diff-visit-file’ and related commands visit the appropriate
  2548. version of the file that the diff at point is about. Likewise
  2549. ‘magit-diff-visit-worktree-file’ and related commands visit the worktree
  2550. version of the file that the diff at point is about. See *note Visiting
  2551. Files and Blobs from a Diff:: for more information and the key bindings.
  2552. ‘C-c C-t’ (‘magit-diff-trace-definition’)
  2553. This command shows a log for the definition at point.
  2554. -- User Option: magit-log-trace-definition-function
  2555. The function specfied by this option is used by
  2556. ‘magit-log-trace-definition’ to determine the function at point.
  2557. For major-modes that have special needs, you could set the local
  2558. value using the mode’s hook.
  2559. ‘C-c C-e’ (‘magit-diff-edit-hunk-commit’)
  2560. From a hunk, this command edits the respective commit and visits
  2561. the file.
  2562. First it visits the file being modified by the hunk at the correct
  2563. location using ‘magit-diff-visit-file’. This actually visits a
  2564. blob. When point is on a diff header, not within an individual
  2565. hunk, then this visits the blob the first hunk is about.
  2566. Then it invokes ‘magit-edit-line-commit’, which uses an interactive
  2567. rebase to make the commit editable, or if that is not possible
  2568. because the commit is not reachable from ‘HEAD’ by checking out
  2569. that commit directly. This also causes the actual worktree file to
  2570. be visited.
  2571. Neither the blob nor the file buffer are killed when finishing the
  2572. rebase. If that is undesirable, then it might be better to use
  2573. ‘magit-rebase-edit-command’ instead of this command.
  2574. ‘j’ (‘magit-jump-to-diffstat-or-diff’)
  2575. This command jumps to the diffstat or diff. When point is on a
  2576. file inside the diffstat section, then jump to the respective diff
  2577. section. Otherwise, jump to the diffstat section or a child
  2578. thereof.
  2579. The next two commands are not specific to Magit-Diff mode (or and
  2580. Magit buffer for that matter), but it might be worth pointing out that
  2581. they are available here too.
  2582. ‘SPC’ (‘scroll-up’)
  2583. This command scrolls text upward.
  2584. ‘DEL’ (‘scroll-down’)
  2585. This command scrolls text downward.
  2586. 
  2587. File: magit.info, Node: Diff Options, Next: Revision Buffer, Prev: Commands Available in Diffs, Up: Diffing
  2588. 5.4.3 Diff Options
  2589. ------------------
  2590. -- User Option: magit-diff-refine-hunk
  2591. Whether to show word-granularity differences within diff hunks.
  2592. • ‘nil’ Never show fine differences.
  2593. • ‘t’ Show fine differences for the current diff hunk only.
  2594. • ‘all’ Show fine differences for all displayed diff hunks.
  2595. -- User Option: magit-diff-refine-ignore-whitespace
  2596. Whether to ignore whitespace changes in word-granularity
  2597. differences.
  2598. -- User Option: magit-diff-adjust-tab-width
  2599. Whether to adjust the width of tabs in diffs.
  2600. Determining the correct width can be expensive if it requires
  2601. opening large and/or many files, so the widths are cached in the
  2602. variable ‘magit-diff--tab-width-cache’. Set that to nil to
  2603. invalidate the cache.
  2604. • ‘nil’ Never adjust tab width. Use ‘tab-width’s value from the
  2605. Magit buffer itself instead.
  2606. • ‘t’ If the corresponding file-visiting buffer exits, then use
  2607. ‘tab-width’’s value from that buffer. Doing this is cheap, so
  2608. this value is used even if a corresponding cache entry exists.
  2609. • ‘always’ If there is no such buffer, then temporarily visit
  2610. the file to determine the value.
  2611. • NUMBER Like ‘always’, but don’t visit files larger than NUMBER
  2612. bytes.
  2613. -- User Option: magit-diff-paint-whitespace
  2614. Specify where to highlight whitespace errors.
  2615. See ‘magit-diff-highlight-trailing’,
  2616. ‘magit-diff-highlight-indentation’. The symbol ‘t’ means in all
  2617. diffs, ‘status’ means only in the status buffer, and nil means
  2618. nowhere.
  2619. • ‘nil’ Never highlight whitespace errors.
  2620. • ‘t’ Highlight whitespace errors everywhere.
  2621. • ‘uncommitted’ Only highlight whitespace errors in diffs
  2622. showing uncommitted changes. For backward compatibility
  2623. ‘status’ is treated as a synonym.
  2624. -- User Option: magit-diff-paint-whitespace-lines
  2625. Specify in what kind of lines to highlight whitespace errors.
  2626. • ‘t’ Highlight only in added lines.
  2627. • ‘both’ Highlight in added and removed lines.
  2628. • ‘all’ Highlight in added, removed and context lines.
  2629. -- User Option: magit-diff-highlight-trailing
  2630. Whether to highlight whitespace at the end of a line in diffs.
  2631. Used only when ‘magit-diff-paint-whitespace’ is non-nil.
  2632. -- User Option: magit-diff-highlight-indentation
  2633. This option controls whether to highlight the indentaion in case it
  2634. used the "wrong" indentation style. Indentation is only
  2635. highlighted if ‘magit-diff-paint-whitespace’ is also non-nil.
  2636. The value is an alist of the form ‘((REGEXP . INDENT)...)’. The
  2637. path to the current repository is matched against each element in
  2638. reverse order. Therefore if a REGEXP matches, then earlier
  2639. elements are not tried.
  2640. If the used INDENT is ‘tabs’, highlight indentation with tabs. If
  2641. INDENT is an integer, highlight indentation with at least that many
  2642. spaces. Otherwise, highlight neither.
  2643. -- User Option: magit-diff-hide-trailing-cr-characters
  2644. Whether to hide ^M characters at the end of a line in diffs.
  2645. -- User Option: magit-diff-highlight-hunk-region-functions
  2646. This option specifies the functions used to highlight the
  2647. hunk-internal region.
  2648. ‘magit-diff-highlight-hunk-region-dim-outside’ overlays the outside
  2649. of the hunk internal selection with a face that causes the added
  2650. and removed lines to have the same background color as context
  2651. lines. This function should not be removed from the value of this
  2652. option.
  2653. ‘magit-diff-highlight-hunk-region-using-overlays’ and
  2654. ‘magit-diff-highlight-hunk-region-using-underline’ emphasize the
  2655. region by placing delimiting horizontal lines before and after it.
  2656. Both of these functions have glitches which cannot be fixed due to
  2657. limitations of Emacs’ display engine. For more information see
  2658. <https://github.com/magit/magit/issues/2758> ff.
  2659. Instead of, or in addition to, using delimiting horizontal lines,
  2660. to emphasize the boundaries, you may which to emphasize the text
  2661. itself, using ‘magit-diff-highlight-hunk-region-using-face’.
  2662. In terminal frames it’s not possible to draw lines as the overlay
  2663. and underline variants normally do, so there they fall back to
  2664. calling the face function instead.
  2665. -- User Option: magit-diff-unmarked-lines-keep-foreground
  2666. This option controls whether added and removed lines outside the
  2667. hunk-internal region only lose their distinct background color or
  2668. also the foreground color. Whether the outside of the region is
  2669. dimmed at all depends on
  2670. ‘magit-diff-highlight-hunk-region-functions’.
  2671. 
  2672. File: magit.info, Node: Revision Buffer, Prev: Diff Options, Up: Diffing
  2673. 5.4.4 Revision Buffer
  2674. ---------------------
  2675. -- User Option: magit-revision-insert-related-refs
  2676. Whether to show related branches in revision buffers.
  2677. • ‘nil’ Don’t show any related branches.
  2678. • ‘t’ Show related local branches.
  2679. • ‘all’ Show related local and remote branches.
  2680. • ‘mixed’ Show all containing branches and local merged
  2681. branches.
  2682. -- User Option: magit-revision-show-gravatars
  2683. Whether to show gravatar images in revision buffers.
  2684. If ‘nil’, then don’t insert any gravatar images. If ‘t’, then
  2685. insert both images. If ‘author’ or ‘committer’, then insert only
  2686. the respective image.
  2687. If you have customized the option ‘magit-revision-headers-format’
  2688. and want to insert the images then you might also have to specify
  2689. where to do so. In that case the value has to be a cons-cell of
  2690. two regular expressions. The car specifies where to insert the
  2691. author’s image. The top half of the image is inserted right after
  2692. the matched text, the bottom half on the next line in the same
  2693. column. The cdr specifies where to insert the committer’s image,
  2694. accordingly. Either the car or the cdr may be nil."
  2695. -- User Option: magit-revision-use-hash-sections
  2696. Whether to turn hashes inside the commit message into sections.
  2697. If non-nil, then hashes inside the commit message are turned into
  2698. ‘commit’ sections. There is a trade off to be made between
  2699. performance and reliability:
  2700. • ‘slow’ calls git for every word to be absolutely sure.
  2701. • ‘quick’ skips words less than seven characters long.
  2702. • ‘quicker’ additionally skips words that don’t contain a
  2703. number.
  2704. • ‘quickest’ uses all words that are at least seven characters
  2705. long and which contain at least one number as well as at least
  2706. one letter.
  2707. If nil, then no hashes are turned into sections, but you can still
  2708. visit the commit at point using "RET".
  2709. The diffs shown in the revision buffer may be automatically
  2710. restricted to a subset of the changed files. If the revision buffer is
  2711. displayed from a log buffer, the revision buffer will share the same
  2712. file restriction as that log buffer (also see the command
  2713. ‘magit-diff-toggle-file-filter’).
  2714. -- User Option: magit-revision-filter-files-on-follow
  2715. Whether showing a commit from a log buffer honors the log’s file
  2716. filter when the log arguments include ‘--follow’.
  2717. When this option is nil, displaying a commit from a log ignores the
  2718. log’s file filter if the log arguments include ‘--follow’. Doing
  2719. so avoids showing an empty diff in revision buffers for commits
  2720. before a rename event. In such cases, the ‘--patch’ argument of
  2721. the log transient can be used to show the file-restricted diffs
  2722. inline.
  2723. Set this option to non-nil to keep the log’s file restriction even
  2724. if ‘--follow’ is present in the log arguments.
  2725. If the revision buffer is not displayed from a log buffer, the file
  2726. restriction is determined as usual (see *note Transient Arguments and
  2727. Buffer Variables::).
  2728. 
  2729. File: magit.info, Node: Ediffing, Next: References Buffer, Prev: Diffing, Up: Inspecting
  2730. 5.5 Ediffing
  2731. ============
  2732. This section describes how to enter Ediff from Magit buffers. For
  2733. information on how to use Ediff itself, see *note (ediff)Top::.
  2734. ‘e’ (‘magit-ediff-dwim’)
  2735. Compare, stage, or resolve using Ediff.
  2736. This command tries to guess what file, and what commit or range the
  2737. user wants to compare, stage, or resolve using Ediff. It might
  2738. only be able to guess either the file, or range/commit, in which
  2739. case the user is asked about the other. It might not always guess
  2740. right, in which case the appropriate ‘magit-ediff-*’ command has to
  2741. be used explicitly. If it cannot read the user’s mind at all, then
  2742. it asks the user for a command to run.
  2743. ‘E’ (‘magit-ediff’)
  2744. This transient prefix command binds the following suffix commands
  2745. and displays them in a temporary buffer until a suffix is invoked.
  2746. ‘E r’ (‘magit-ediff-compare’)
  2747. Compare two revisions of a file using Ediff.
  2748. If the region is active, use the revisions on the first and last
  2749. line of the region. With a prefix argument, instead of diffing the
  2750. revisions, choose a revision to view changes along, starting at the
  2751. common ancestor of both revisions (i.e., use a "..." range).
  2752. ‘E m’ (‘magit-ediff-resolve’)
  2753. Resolve outstanding conflicts in a file using Ediff, defaulting to
  2754. the file at point.
  2755. Provided that the value of ‘merge.conflictstyle’ is ‘diff3’, you
  2756. can view the file’s merge-base revision using ‘/’ in the Ediff
  2757. control buffer.
  2758. In the rare event that you want to manually resolve all conflicts,
  2759. including those already resolved by Git, use
  2760. ‘ediff-merge-revisions-with-ancestor’.
  2761. ‘E s’ (‘magit-ediff-stage’)
  2762. Stage and unstage changes to a file using Ediff, defaulting to the
  2763. file at point.
  2764. ‘E u’ (‘magit-ediff-show-unstaged’)
  2765. Show unstaged changes to a file using Ediff.
  2766. ‘E i’ (‘magit-ediff-show-staged’)
  2767. Show staged changes to a file using Ediff.
  2768. ‘E w’ (‘magit-ediff-show-working-tree’)
  2769. Show changes in a file between ‘HEAD’ and working tree using Ediff.
  2770. ‘E c’ (‘magit-ediff-show-commit’)
  2771. Show changes to a file introduced by a commit using Ediff.
  2772. ‘E z’ (‘magit-ediff-show-stash’)
  2773. Show changes to a file introduced by a stash using Ediff.
  2774. -- User Option: magit-ediff-dwim-show-on-hunks
  2775. This option controls what command ‘magit-ediff-dwim’ calls when
  2776. point is on uncommitted hunks. When nil, always run
  2777. ‘magit-ediff-stage’. Otherwise, use ‘magit-ediff-show-staged’ and
  2778. ‘magit-ediff-show-unstaged’ to show staged and unstaged changes,
  2779. respectively.
  2780. -- User Option: magit-ediff-show-stash-with-index
  2781. This option controls whether ‘magit-ediff-show-stash’ includes a
  2782. buffer containing the file’s state in the index at the time the
  2783. stash was created. This makes it possible to tell which changes in
  2784. the stash were staged.
  2785. -- User Option: magit-ediff-quit-hook
  2786. This hook is run after quitting an Ediff session that was created
  2787. using a Magit command. The hook functions are run inside the Ediff
  2788. control buffer, and should not change the current buffer.
  2789. This is similar to ‘ediff-quit-hook’ but takes the needs of Magit
  2790. into account. The regular ‘ediff-quit-hook’ is ignored by Ediff
  2791. sessions that were created using a Magit command.
  2792. 
  2793. File: magit.info, Node: References Buffer, Next: Bisecting, Prev: Ediffing, Up: Inspecting
  2794. 5.6 References Buffer
  2795. =====================
  2796. ‘y’ (‘magit-show-refs’)
  2797. This command lists branches and tags in a dedicated buffer.
  2798. However if this command is invoked again from this buffer or if it
  2799. is invoked with a prefix argument, then it acts as a transient
  2800. prefix command, which binds the following suffix commands and some
  2801. infix arguments.
  2802. All of the following suffix commands list exactly the same branches
  2803. and tags. The only difference the optional feature that can be enabled
  2804. by changing the value of ‘magit-refs-show-commit-count’ (see below).
  2805. These commands specify a different branch or commit against which all
  2806. the other references are compared.
  2807. ‘y y’ (‘magit-show-refs-head’)
  2808. This command lists branches and tags in a dedicated buffer. Each
  2809. reference is being compared with ‘HEAD’.
  2810. ‘y c’ (‘magit-show-refs-current’)
  2811. This command lists branches and tags in a dedicated buffer. Each
  2812. reference is being compared with the current branch or ‘HEAD’ if it
  2813. is detached.
  2814. ‘y o’ (‘magit-show-refs-other’)
  2815. This command lists branches and tags in a dedicated buffer. Each
  2816. reference is being compared with a branch read from the user.
  2817. -- User Option: magit-refs-show-commit-count
  2818. Whether to show commit counts in Magit-Refs mode buffers.
  2819. • ‘all’ Show counts for branches and tags.
  2820. • ‘branch’ Show counts for branches only.
  2821. • ‘nil’ Never show counts.
  2822. The default is ‘nil’ because anything else can be very expensive.
  2823. -- User Option: magit-refs-pad-commit-counts
  2824. Whether to pad all commit counts on all sides in Magit-Refs mode
  2825. buffers.
  2826. If this is nil, then some commit counts are displayed right next to
  2827. one of the branches that appear next to the count, without any
  2828. space in between. This might look bad if the branch name faces
  2829. look too similar to ‘magit-dimmed’.
  2830. If this is non-nil, then spaces are placed on both sides of all
  2831. commit counts.
  2832. -- User Option: magit-refs-show-remote-prefix
  2833. Whether to show the remote prefix in lists of remote branches.
  2834. Showing the prefix is redundant because the name of the remote is
  2835. already shown in the heading preceding the list of its branches.
  2836. -- User Option: magit-refs-primary-column-width
  2837. Width of the primary column in ‘magit-refs-mode’ buffers. The
  2838. primary column is the column that contains the name of the branch
  2839. that the current row is about.
  2840. If this is an integer, then the column is that many columns wide.
  2841. Otherwise it has to be a cons-cell of two integers. The first
  2842. specifies the minimal width, the second the maximal width. In that
  2843. case the actual width is determined using the length of the names
  2844. of the shown local branches. (Remote branches and tags are not
  2845. taken into account when calculating to optimal width.)
  2846. -- User Option: magit-refs-focus-column-width
  2847. Width of the focus column in ‘magit-refs-mode’ buffers.
  2848. The focus column is the first column, which marks one branch
  2849. (usually the current branch) as the focused branch using ‘*’ or
  2850. ‘@’. For each other reference, this column optionally shows how
  2851. many commits it is ahead of the focused branch and ‘<’, or if it
  2852. isn’t ahead then the commits it is behind and ‘>’, or if it isn’t
  2853. behind either, then a ‘=’.
  2854. This column may also display only ‘*’ or ‘@’ for the focused
  2855. branch, in which case this option is ignored. Use ‘L v’ to change
  2856. the verbosity of this column.
  2857. -- User Option: magit-refs-margin
  2858. This option specifies whether the margin is initially shown in
  2859. Magit-Refs mode buffers and how it is formatted.
  2860. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  2861. • If INIT is non-nil, then the margin is shown initially.
  2862. • STYLE controls how to format the committer date. It can be
  2863. one of ‘age’ (to show the age of the commit),
  2864. ‘age-abbreviated’ (to abbreviate the time unit to a
  2865. character), or a string (suitable for ‘format-time-string’) to
  2866. show the actual date.
  2867. • WIDTH controls the width of the margin. This exists for
  2868. forward compatibility and currently the value should not be
  2869. changed.
  2870. • AUTHOR controls whether the name of the author is also shown
  2871. by default.
  2872. • AUTHOR-WIDTH has to be an integer. When the name of the
  2873. author is shown, then this specifies how much space is used to
  2874. do so.
  2875. -- User Option: magit-refs-margin-for-tags
  2876. This option specifies whether to show information about tags in the
  2877. margin. This is disabled by default because it is slow if there
  2878. are many tags.
  2879. The following variables control how individual refs are displayed.
  2880. If you change one of these variables (especially the "%c" part), then
  2881. you should also change the others to keep things aligned. The following
  2882. %-sequences are supported:
  2883. • ‘%a’ Number of commits this ref has over the one we compare to.
  2884. • ‘%b’ Number of commits the ref we compare to has over this one.
  2885. • ‘%c’ Number of commits this ref has over the one we compare to.
  2886. For the ref which all other refs are compared this is instead "@",
  2887. if it is the current branch, or "#" otherwise.
  2888. • ‘%C’ For the ref which all other refs are compared this is "@", if
  2889. it is the current branch, or "#" otherwise. For all other refs "
  2890. ".
  2891. • ‘%h’ Hash of this ref’s tip.
  2892. • ‘%m’ Commit summary of the tip of this ref.
  2893. • ‘%n’ Name of this ref.
  2894. • ‘%u’ Upstream of this local branch.
  2895. • ‘%U’ Upstream of this local branch and additional local vs.
  2896. upstream information.
  2897. -- User Option: magit-refs-filter-alist
  2898. The purpose of this option is to forgo displaying certain refs
  2899. based on their name. If you want to not display any refs of a
  2900. certain type, then you should remove the appropriate function from
  2901. ‘magit-refs-sections-hook’ instead.
  2902. This alist controls which tags and branches are omitted from being
  2903. displayed in ‘magit-refs-mode’ buffers. If it is ‘nil’, then all
  2904. refs are displayed (subject to ‘magit-refs-sections-hook’).
  2905. All keys are tried in order until one matches. Then its value is
  2906. used and subsequent elements are ignored. If the value is non-nil,
  2907. then the reference is displayed, otherwise it is not. If no
  2908. element matches, then the reference is displayed.
  2909. A key can either be a regular expression that the refname has to
  2910. match, or a function that takes the refname as only argument and
  2911. returns a boolean. A remote branch such as "origin/master" is
  2912. displayed as just "master", however for this comparison the former
  2913. is used.
  2914. ‘RET’ (‘magit-visit-ref’)
  2915. This command visits the reference or revision at point in another
  2916. buffer. If there is no revision at point or with a prefix argument
  2917. then it prompts for a revision.
  2918. This command behaves just like ‘magit-show-commit’ as described
  2919. above, except if point is on a reference in a ‘magit-refs-mode’
  2920. buffer, in which case the behavior may be different, but only if
  2921. you have customized the option ‘magit-visit-ref-behavior’.
  2922. -- User Option: magit-visit-ref-behavior
  2923. This option controls how ‘magit-visit-ref’ behaves in
  2924. ‘magit-refs-mode’ buffers.
  2925. By default ‘magit-visit-ref’ behaves like ‘magit-show-commit’, in
  2926. all buffers, including ‘magit-refs-mode’ buffers. When the type of
  2927. the section at point is ‘commit’ then "RET" is bound to
  2928. ‘magit-show-commit’, and when the type is either ‘branch’ or ‘tag’
  2929. then it is bound to ‘magit-visit-ref’.
  2930. "RET" is one of Magit’s most essential keys and at least by default
  2931. it should behave consistently across all of Magit, especially
  2932. because users quickly learn that it does something very harmless;
  2933. it shows more information about the thing at point in another
  2934. buffer.
  2935. However "RET" used to behave differently in ‘magit-refs-mode’
  2936. buffers, doing surprising things, some of which cannot really be
  2937. described as "visit this thing". If you’ve grown accustomed this
  2938. behavior, you can restore it by adding one or more of the below
  2939. symbols to the value of this option. But keep in mind that by
  2940. doing so you don’t only introduce inconsistencies, you also lose
  2941. some functionality and might have to resort to ‘M-x
  2942. magit-show-commit’ to get it back.
  2943. ‘magit-visit-ref’ looks for these symbols in the order in which
  2944. they are described here. If the presence of a symbol applies to
  2945. the current situation, then the symbols that follow do not affect
  2946. the outcome.
  2947. • ‘focus-on-ref’
  2948. With a prefix argument update the buffer to show commit counts
  2949. and lists of cherry commits relative to the reference at point
  2950. instead of relative to the current buffer or ‘HEAD’.
  2951. Instead of adding this symbol, consider pressing "C-u y o
  2952. RET".
  2953. • ‘create-branch’
  2954. If point is on a remote branch, then create a new local branch
  2955. with the same name, use the remote branch as its upstream, and
  2956. then check out the local branch.
  2957. Instead of adding this symbol, consider pressing "b c RET
  2958. RET", like you would do in other buffers.
  2959. • ‘checkout-any’
  2960. Check out the reference at point. If that reference is a tag
  2961. or a remote branch, then this results in a detached ‘HEAD’.
  2962. Instead of adding this symbol, consider pressing "b b RET",
  2963. like you would do in other buffers.
  2964. • ‘checkout-branch’
  2965. Check out the local branch at point.
  2966. Instead of adding this symbol, consider pressing "b b RET",
  2967. like you would do in other buffers.
  2968. * Menu:
  2969. * References Sections::
  2970. 
  2971. File: magit.info, Node: References Sections, Up: References Buffer
  2972. 5.6.1 References Sections
  2973. -------------------------
  2974. The contents of references buffers is controlled using the hook
  2975. ‘magit-refs-sections-hook’. See *note Section Hooks:: to learn about
  2976. such hooks and how to customize them. All of the below functions are
  2977. members of the default value. Note that it makes much less sense to
  2978. customize this hook than it does for the respective hook used for the
  2979. status buffer.
  2980. -- User Option: magit-refs-sections-hook
  2981. Hook run to insert sections into a references buffer.
  2982. -- Function: magit-insert-local-branches
  2983. Insert sections showing all local branches.
  2984. -- Function: magit-insert-remote-branches
  2985. Insert sections showing all remote-tracking branches.
  2986. -- Function: magit-insert-tags
  2987. Insert sections showing all tags.
  2988. 
  2989. File: magit.info, Node: Bisecting, Next: Visiting Files and Blobs, Prev: References Buffer, Up: Inspecting
  2990. 5.7 Bisecting
  2991. =============
  2992. Also see *note (gitman)git-bisect::.
  2993. ‘B’ (‘magit-bisect’)
  2994. This transient prefix command binds the following suffix commands
  2995. and displays them in a temporary buffer until a suffix is invoked.
  2996. When bisecting is not in progress, then the transient features the
  2997. following suffix commands.
  2998. ‘B B’ (‘magit-bisect-start’)
  2999. Start a bisect session.
  3000. Bisecting a bug means to find the commit that introduced it. This
  3001. command starts such a bisect session by asking for a known good and
  3002. a bad commit.
  3003. ‘B s’ (‘magit-bisect-run’)
  3004. Bisect automatically by running commands after each step.
  3005. When bisecting in progress, then the transient instead features the
  3006. following suffix commands.
  3007. ‘B b’ (‘magit-bisect-bad’)
  3008. Mark the current commit as bad. Use this after you have asserted
  3009. that the commit does contain the bug in question.
  3010. ‘B g’ (‘magit-bisect-good’)
  3011. Mark the current commit as good. Use this after you have asserted
  3012. that the commit does not contain the bug in question.
  3013. ‘B k’ (‘magit-bisect-skip’)
  3014. Skip the current commit. Use this if for some reason the current
  3015. commit is not a good one to test. This command lets Git choose a
  3016. different one.
  3017. ‘B r’ (‘magit-bisect-reset’)
  3018. After bisecting, cleanup bisection state and return to original
  3019. ‘HEAD’.
  3020. By default the status buffer shows information about the ongoing
  3021. bisect session.
  3022. -- User Option: magit-bisect-show-graph
  3023. This option controls whether a graph is displayed for the log of
  3024. commits that still have to be bisected.
  3025. 
  3026. File: magit.info, Node: Visiting Files and Blobs, Next: Blaming, Prev: Bisecting, Up: Inspecting
  3027. 5.8 Visiting Files and Blobs
  3028. ============================
  3029. Magit provides several commands that visit a file or blob (the version
  3030. of a file that is stored in a certain commit). Actually it provides
  3031. several *groups* of such commands and the several *variants* within each
  3032. group.
  3033. * Menu:
  3034. * General-Purpose Visit Commands::
  3035. * Visiting Files and Blobs from a Diff::
  3036. 
  3037. File: magit.info, Node: General-Purpose Visit Commands, Next: Visiting Files and Blobs from a Diff, Up: Visiting Files and Blobs
  3038. 5.8.1 General-Purpose Visit Commands
  3039. ------------------------------------
  3040. These commands can be used anywhere to open any blob. Currently no keys
  3041. are bound to these commands by default, but that is likely to change.
  3042. -- Command: magit-find-file
  3043. This command reads a filename and revision from the user and visits
  3044. the respective blob in a buffer. The buffer is displayed in the
  3045. selected window.
  3046. -- Command: magit-find-file-other-window
  3047. This command reads a filename and revision from the user and visits
  3048. the respective blob in a buffer. The buffer is displayed in
  3049. another window.
  3050. -- Command: magit-find-file-other-frame
  3051. This command reads a filename and revision from the user and visits
  3052. the respective blob in a buffer. The buffer is displayed in
  3053. another frame.
  3054. 
  3055. File: magit.info, Node: Visiting Files and Blobs from a Diff, Prev: General-Purpose Visit Commands, Up: Visiting Files and Blobs
  3056. 5.8.2 Visiting Files and Blobs from a Diff
  3057. ------------------------------------------
  3058. These commands can only be used when point is inside a diff.
  3059. ‘RET’ (‘magit-diff-visit-file’)
  3060. This command visits the appropriate version of the file that the
  3061. diff at point is about.
  3062. This commands visits the worktree version of the appropriate file.
  3063. The location of point inside the diff determines which file is
  3064. being visited. The visited version depends on what changes the
  3065. diff is about.
  3066. • If the diff shows uncommitted changes (i.e. staged or
  3067. unstaged changes), then visit the file in the working tree
  3068. (i.e. the same "real" file that ‘find-file’ would visit. In
  3069. all other cases visit a "blob" (i.e. the version of a file as
  3070. stored in some commit).
  3071. • If point is on a removed line, then visit the blob for the
  3072. first parent of the commit that removed that line, i.e. the
  3073. last commit where that line still exists.
  3074. • If point is on an added or context line, then visit the blob
  3075. that adds that line, or if the diff shows from more than a
  3076. single commit, then visit the blob from the last of these
  3077. commits.
  3078. In the file-visiting buffer this command goes to the line that
  3079. corresponds to the line that point is on in the diff.
  3080. The buffer is displayed in the selected window. With a prefix
  3081. argument the buffer is displayed in another window instead.
  3082. -- User Option: magit-diff-visit-previous-blob
  3083. This option controls whether ‘magit-diff-visit-file’ may visit the
  3084. previous blob. When this is ‘t’ (the default) and point is on a
  3085. removed line in a diff for a committed change, then
  3086. ‘magit-diff-visit-file’ visits the blob from the last revision
  3087. which still had that line.
  3088. Currently this is only supported for committed changes, for staged
  3089. and unstaged changes ‘magit-diff-visit-file’ always visits the file
  3090. in the working tree.
  3091. ‘C-<return>’ (‘magit-diff-visit-file-worktree’)
  3092. This command visits the worktree version of the appropriate file.
  3093. The location of point inside the diff determines which file is
  3094. being visited. Unlike ‘magit-diff-visit-file’ it always visits the
  3095. "real" file in the working tree, i.e the "current version" of the
  3096. file.
  3097. In the file-visiting buffer this command goes to the line that
  3098. corresponds to the line that point is on in the diff. Lines that
  3099. were added or removed in the working tree, the index and other
  3100. commits in between are automatically accounted for.
  3101. The buffer is displayed in the selected window. With a prefix
  3102. argument the buffer is displayed in another window instead.
  3103. Variants of the above two commands exist that instead visit the file
  3104. in another window or in another frame. If you prefer such behavior,
  3105. then you may want to change the above key bindings, but note that the
  3106. above commands also use another window when invoked with a prefix
  3107. argument.
  3108. -- Command: magit-diff-visit-file-other-window
  3109. -- Command: magit-diff-visit-file-other-frame
  3110. -- Command: magit-diff-visit-worktree-file-other-window
  3111. -- Command: magit-diff-visit-worktree-file-other-frame
  3112. 
  3113. File: magit.info, Node: Blaming, Prev: Visiting Files and Blobs, Up: Inspecting
  3114. 5.9 Blaming
  3115. ===========
  3116. Also see *note (gitman)git-blame::.
  3117. To start blaming invoke the ‘magit-file-dispatch’ transient prefix
  3118. command by pressing ‘C-c M-g’. (This is only the default binding and
  3119. the recommended binding is ‘C-c g’. Also neither binding may be
  3120. available if you disabled ‘global-magit-file-mode’. Also see *note
  3121. Minor Mode for Buffers Visiting Files::.)
  3122. The blaming suffix commands can be invoked from the dispatch
  3123. transient. However if you want to set an infix argument, then you have
  3124. to enter the blaming sub-transient first.
  3125. The key bindings shown below assume that you enter the dispatch
  3126. transient using the default binding.
  3127. ‘C-c M-g B’ (‘magit-blame’)
  3128. This transient prefix command binds the following suffix commands
  3129. along with the appropriate infix arguments and displays them in a
  3130. temporary buffer until a suffix is invoked.
  3131. Note that not all of the following suffixes are available at all
  3132. times. For example if ‘magit-blame-mode’ is not enabled, then the
  3133. command whose purpose is to turn off that mode would not be of any use
  3134. and therefore isn’t available.
  3135. ‘C-c M-g b’ (‘magit-blame-addition’)
  3136. ‘C-c M-g B b’ (‘magit-blame-addition’)
  3137. This command augments each line or chunk of lines in the current
  3138. file-visiting or blob-visiting buffer with information about what
  3139. commits last touched these lines.
  3140. If the buffer visits a revision of that file, then history up to
  3141. that revision is considered. Otherwise, the file’s full history is
  3142. considered, including uncommitted changes.
  3143. If Magit-Blame mode is already turned on in the current buffer then
  3144. blaming is done recursively, by visiting REVISION:FILE (using
  3145. ‘magit-find-file’), where REVISION is a parent of the revision that
  3146. added the current line or chunk of lines.
  3147. ‘C-c M-g r’ (‘magit-blame-removal’)
  3148. ‘C-c M-g B r’ (‘magit-blame-removal’)
  3149. This command augments each line or chunk of lines in the current
  3150. blob-visiting buffer with information about the revision that
  3151. removes it. It cannot be used in file-visiting buffers.
  3152. Like ‘magit-blame-addition’, this command can be used recursively.
  3153. ‘C-c M-g f’ (‘magit-blame-reverse’)
  3154. ‘C-c M-g B f’ (‘magit-blame-reverse’)
  3155. This command augments each line or chunk of lines in the current
  3156. file-visiting or blob-visiting buffer with information about the
  3157. last revision in which a line still existed.
  3158. Like ‘magit-blame-addition’, this command can be used recursively.
  3159. ‘C-c M-g e’ (‘magit-blame-echo’)
  3160. ‘C-c M-g B e’ (‘magit-blame-echo’)
  3161. This command is like ‘magit-blame-addition’ except that it doesn’t
  3162. turn on ‘read-only-mode’ and that it initially uses the
  3163. visualization style specified by option ‘magit-blame-echo-style’.
  3164. The following key bindings are available when Magit-Blame mode is
  3165. enabled and Read-Only mode is not enabled. These commands are also
  3166. available in other buffers; here only the behavior is described that is
  3167. relevant in file-visiting buffers that are being blamed.
  3168. ‘RET’ (‘magit-show-commit’)
  3169. This command shows the commit that last touched the line at point.
  3170. ‘SPC’ (‘magit-diff-show-or-scroll-up’)
  3171. This command updates the commit buffer.
  3172. This either shows the commit that last touched the line at point in
  3173. the appropriate buffer, or if that buffer is already being
  3174. displayed in the current frame and if that buffer contains
  3175. information about that commit, then the buffer is scrolled up
  3176. instead.
  3177. ‘DEL’ (‘magit-diff-show-or-scroll-down’)
  3178. This command updates the commit buffer.
  3179. This either shows the commit that last touched the line at point in
  3180. the appropriate buffer, or if that buffer is already being
  3181. displayed in the current frame and if that buffer contains
  3182. information about that commit, then the buffer is scrolled down
  3183. instead.
  3184. The following key bindings are available when both Magit-Blame mode
  3185. and Read-Only mode are enabled.
  3186. ‘b’ (‘magit-blame’)
  3187. See above.
  3188. ‘n’ (‘magit-blame-next-chunk’)
  3189. This command moves to the next chunk.
  3190. ‘N’ (‘magit-blame-next-chunk-same-commit’)
  3191. This command moves to the next chunk from the same commit.
  3192. ‘p’ (‘magit-blame-previous-chunk’)
  3193. This command moves to the previous chunk.
  3194. ‘P’ (‘magit-blame-previous-chunk-same-commit’)
  3195. This command moves to the previous chunk from the same commit.
  3196. ‘q’ (‘magit-blame-quit’)
  3197. This command turns off Magit-Blame mode. If the buffer was created
  3198. during a recursive blame, then it also kills the buffer.
  3199. ‘M-w’ (‘magit-blame-copy-hash’)
  3200. This command saves the hash of the current chunk’s commit to the
  3201. kill ring.
  3202. When the region is active, the command saves the region’s content
  3203. instead of the hash, like ‘kill-ring-save’ would.
  3204. ‘c’ (‘magit-blame-cycle-style’)
  3205. This command changes how blame information is visualized in the
  3206. current buffer by cycling through the styles specified using the
  3207. option ‘magit-blame-styles’.
  3208. Blaming is also controlled using the following options.
  3209. -- User Option: magit-blame-styles
  3210. This option defines a list of styles used to visualize blame
  3211. information. For now see its doc-string to learn more.
  3212. -- User Option: magit-blame-echo-style
  3213. This option specifies the blame visualization style used by the
  3214. command ‘magit-blame-echo’. This must be a symbol that is used as
  3215. the identifier for one of the styles defined in
  3216. ‘magit-blame-styles’.
  3217. -- User Option: magit-blame-time-format
  3218. This option specifies the format string used to display times when
  3219. showing blame information.
  3220. -- User Option: magit-blame-read-only
  3221. This option controls whether blaming a buffer also makes
  3222. temporarily read-only.
  3223. -- User Option: magit-blame-disable-modes
  3224. This option lists incompatible minor-modes that should be disabled
  3225. temporarily when a buffer contains blame information. They are
  3226. enabled again when the buffer no longer shows blame information.
  3227. -- User Option: magit-blame-goto-chunk-hook
  3228. This hook is run when moving between chunks.
  3229. 
  3230. File: magit.info, Node: Manipulating, Next: Transferring, Prev: Inspecting, Up: Top
  3231. 6 Manipulating
  3232. **************
  3233. * Menu:
  3234. * Creating Repository::
  3235. * Cloning Repository::
  3236. * Staging and Unstaging::
  3237. * Applying::
  3238. * Committing::
  3239. * Branching::
  3240. * Merging::
  3241. * Resolving Conflicts::
  3242. * Rebasing::
  3243. * Cherry Picking::
  3244. * Resetting::
  3245. * Stashing::
  3246. 
  3247. File: magit.info, Node: Creating Repository, Next: Cloning Repository, Up: Manipulating
  3248. 6.1 Creating Repository
  3249. =======================
  3250. ‘M-x magit-init’ (‘magit-init’)
  3251. This command initializes a repository and then shows the status
  3252. buffer for the new repository.
  3253. If the directory is below an existing repository, then the user has
  3254. to confirm that a new one should be created inside. If the
  3255. directory is the root of the existing repository, then the user has
  3256. to confirm that it should be reinitialized.
  3257. 
  3258. File: magit.info, Node: Cloning Repository, Next: Staging and Unstaging, Prev: Creating Repository, Up: Manipulating
  3259. 6.2 Cloning Repository
  3260. ======================
  3261. To clone a remote or local repository use ‘C’, which is bound to the
  3262. command ‘magit-clone’. This command either act as a transient prefix
  3263. command, which binds several infix arguments and suffix commands, or it
  3264. can invoke ‘git clone’ directly, depending on whether a prefix argument
  3265. is used and on the value of ‘magit-clone-always-transient’.
  3266. -- User Option: magit-clone-always-transient
  3267. This option controls whether the command ‘magit-clone’ always acts
  3268. as a transient prefix command, regardless of whether a prefix
  3269. argument is used or not. If ‘t’, then that command always acts as
  3270. a transient prefix. If ‘nil’, then a prefix argument has to be
  3271. used for it to act as a transient.
  3272. ‘C’ (‘magit-clone’)
  3273. This command either acts as a transient prefix command as described
  3274. above or does the same thing as ‘transient-clone-regular’ as
  3275. described below.
  3276. If it acts as a transient prefix, then it binds the following
  3277. suffix commands and several infix arguments.
  3278. ‘C C’ (‘magit-clone-regular’)
  3279. This command creates a regular clone of an existing repository.
  3280. The repository and the target directory are read from the user.
  3281. ‘C s’ (‘magit-clone-shallow’)
  3282. This command creates a shallow clone of an existing repository.
  3283. The repository and the target directory are read from the user. By
  3284. default the depth of the cloned history is a single commit, but
  3285. with a prefix argument the depth is read from the user.
  3286. ‘C b’ (‘magit-clone-bare’)
  3287. This command creates a bare clone of an existing repository. The
  3288. repository and the target directory are read from the user.
  3289. ‘C m’ (‘magit-clone-mirror’)
  3290. This command creates a mirror of an existing repository. The
  3291. repository and the target directory are read from the user.
  3292. The following suffixes are disabled by default. See *note
  3293. (transient)Enabling and Disabling Suffixes:: for how to enable them.
  3294. ‘C d’ (‘magit-clone-shallow-since’)
  3295. This command creates a shallow clone of an existing repository.
  3296. Only commits that were committed after a date are cloned, which is
  3297. read from the user. The repository and the target directory are
  3298. also read from the user.
  3299. ‘C e’ (‘magit-clone-shallow-exclude’)
  3300. This command creates a shallow clone of an existing repository.
  3301. This reads a branch or tag from the user. Commits that are
  3302. reachable from that are not cloned. The repository and the target
  3303. directory are also read from the user.
  3304. -- User Option: magit-clone-set-remote-head
  3305. This option controls whether cloning causes the reference
  3306. ‘refs/remotes/<remote>/HEAD’ to be created in the clone. The
  3307. default is to do so.
  3308. Actually ‘git clone’ itself does that and cannot be told to not do
  3309. it. Therefore setting this to ‘nil’ causes Magit to remove that
  3310. reference after cloning.
  3311. -- User Option: magit-clone-set-remote.pushDefault
  3312. This option controls whether the value of the Git variable
  3313. ‘remote.pushDefault’ is set after cloning.
  3314. • If ‘t’, then it is always set without asking.
  3315. • If ‘ask’, then the users are asked every time they clone a
  3316. repository.
  3317. • If ‘nil’, then it is never set.
  3318. -- User Option: magit-clone-default-directory
  3319. This option control the default directory name used when reading
  3320. the destination for a cloning operation.
  3321. • If ‘nil’ (the default), then the value of ‘default-directory’
  3322. is used.
  3323. • If a directory, then that is used.
  3324. • If a function, then that is called with the remote url as the
  3325. only argument and the returned value is used.
  3326. -- User Option: magit-clone-name-alist
  3327. This option maps regular expressions, which match repository names,
  3328. to repository urls, making it possible for users to enter short
  3329. names instead of urls when cloning repositories.
  3330. Each element has the form ‘(REGEXP HOSTNAME USER)’. When the user
  3331. enters a name when a cloning command asks for a name or url, then
  3332. that is looked up in this list. The first element whose REGEXP
  3333. matches is used.
  3334. The format specified by option ‘magit-clone-url-format’ is used to
  3335. turn the name into an url, using HOSTNAME and the repository name.
  3336. If the provided name contains a slash, then that is used.
  3337. Otherwise if the name omits the owner of the repository, then the
  3338. default user specified in the matched entry is used.
  3339. If USER contains a dot, then it is treated as a Git variable and
  3340. the value of that is used as the username. Otherwise it is used as
  3341. the username itself.
  3342. -- User Option: magit-clone-url-format
  3343. The format specified by this option is used when turning repository
  3344. names into urls. ‘%h’ is the hostname and ‘%n’ is the repository
  3345. name, including the name of the owner.
  3346. 
  3347. File: magit.info, Node: Staging and Unstaging, Next: Applying, Prev: Cloning Repository, Up: Manipulating
  3348. 6.3 Staging and Unstaging
  3349. =========================
  3350. Like Git, Magit can of course stage and unstage complete files. Unlike
  3351. Git, it also allows users to gracefully un-/stage individual hunks and
  3352. even just part of a hunk. To stage individual hunks and parts of hunks
  3353. using Git directly, one has to use the very modal and rather clumsy
  3354. interface of a ‘git add --interactive’ session.
  3355. With Magit, on the other hand, one can un-/stage individual hunks by
  3356. just moving point into the respective section inside a diff displayed in
  3357. the status buffer or a separate diff buffer and typing ‘s’ or ‘u’. To
  3358. operate on just parts of a hunk, mark the changes that should be
  3359. un-/staged using the region and then press the same key that would be
  3360. used to un-/stage. To stage multiple files or hunks at once use a
  3361. region that starts inside the heading of such a section and ends inside
  3362. the heading of a sibling section of the same type.
  3363. Besides staging and unstaging, Magit also provides several other
  3364. "apply variants" that can also operate on a file, multiple files at
  3365. once, a hunk, multiple hunks at once, and on parts of a hunk. These
  3366. apply variants are described in the next section.
  3367. You can also use Ediff to stage and unstage. See *note Ediffing::.
  3368. ‘s’ (‘magit-stage’)
  3369. Add the change at point to the staging area.
  3370. With a prefix argument and an untracked file (or files) at point,
  3371. stage the file but not its content. This makes it possible to
  3372. stage only a subset of the new file’s changes.
  3373. ‘S’ (‘magit-stage-modified’)
  3374. Stage all changes to files modified in the worktree. Stage all new
  3375. content of tracked files and remove tracked files that no longer
  3376. exist in the working tree from the index also. With a prefix
  3377. argument also stage previously untracked (but not ignored) files.
  3378. ‘u’ (‘magit-unstage’)
  3379. Remove the change at point from the staging area.
  3380. Only staged changes can be unstaged. But by default this command
  3381. performs an action that is somewhat similar to unstaging, when it
  3382. is called on a committed change: it reverses the change in the
  3383. index but not in the working tree.
  3384. ‘U’ (‘magit-unstage-all’)
  3385. Remove all changes from the staging area.
  3386. -- User Option: magit-unstage-committed
  3387. This option controls whether ‘magit-unstage’ "unstages" committed
  3388. changes by reversing them in the index but not the working tree.
  3389. The alternative is to raise an error.
  3390. ‘M-x magit-reverse-in-index’ (‘magit-reverse-in-index’)
  3391. This command reverses the committed change at point in the index
  3392. but not the working tree. By default no key is bound directly to
  3393. this command, but it is indirectly called when ‘u’
  3394. (‘magit-unstage’) is pressed on a committed change.
  3395. This allows extracting a change from ‘HEAD’, while leaving it in
  3396. the working tree, so that it can later be committed using a
  3397. separate commit. A typical workflow would be:
  3398. • Optionally make sure that there are no uncommitted changes.
  3399. • Visit the ‘HEAD’ commit and navigate to the change that should
  3400. not have been included in that commit.
  3401. • Type ‘u’ (‘magit-unstage’) to reverse it in the index. This
  3402. assumes that ‘magit-unstage-committed-changes’ is non-nil.
  3403. • Type ‘c e’ to extend ‘HEAD’ with the staged changes, including
  3404. those that were already staged before.
  3405. • Optionally stage the remaining changes using ‘s’ or ‘S’ and
  3406. then type ‘c c’ to create a new commit.
  3407. ‘M-x magit-reset-index’ (‘magit-reset-index’)
  3408. Reset the index to some commit. The commit is read from the user
  3409. and defaults to the commit at point. If there is no commit at
  3410. point, then it defaults to ‘HEAD’.
  3411. * Menu:
  3412. * Staging from File-Visiting Buffers::
  3413. 
  3414. File: magit.info, Node: Staging from File-Visiting Buffers, Up: Staging and Unstaging
  3415. 6.3.1 Staging from File-Visiting Buffers
  3416. ----------------------------------------
  3417. Fine-grained un-/staging has to be done from the status or a diff
  3418. buffer, but it’s also possible to un-/stage all changes made to the file
  3419. visited in the current buffer right from inside that buffer.
  3420. ‘M-x magit-stage-file’ (‘magit-stage-file’)
  3421. When invoked inside a file-visiting buffer, then stage all changes
  3422. to that file. In a Magit buffer, stage the file at point if any.
  3423. Otherwise prompt for a file to be staged. With a prefix argument
  3424. always prompt the user for a file, even in a file-visiting buffer
  3425. or when there is a file section at point.
  3426. ‘M-x magit-unstage-file’ (‘magit-unstage-file’)
  3427. When invoked inside a file-visiting buffer, then unstage all
  3428. changes to that file. In a Magit buffer, unstage the file at point
  3429. if any. Otherwise prompt for a file to be unstaged. With a prefix
  3430. argument always prompt the user for a file, even in a file-visiting
  3431. buffer or when there is a file section at point.
  3432. 
  3433. File: magit.info, Node: Applying, Next: Committing, Prev: Staging and Unstaging, Up: Manipulating
  3434. 6.4 Applying
  3435. ============
  3436. Magit provides several "apply variants": stage, unstage, discard,
  3437. reverse, and "regular apply". At least when operating on a hunk they
  3438. are all implemented using ‘git apply’, which is why they are called
  3439. "apply variants".
  3440. • Stage. Apply a change from the working tree to the index. The
  3441. change also remains in the working tree.
  3442. • Unstage. Remove a change from the index. The change remains in
  3443. the working tree.
  3444. • Discard. On a staged change, remove it from the working tree and
  3445. the index. On an unstaged change, remove it from the working tree
  3446. only.
  3447. • Reverse. Reverse a change in the working tree. Both committed and
  3448. staged changes can be reversed. Unstaged changes cannot be
  3449. reversed. Discard them instead.
  3450. • Apply. Apply a change to the working tree. Both committed and
  3451. staged changes can be applied. Unstaged changes cannot be applied
  3452. - as they already have been applied.
  3453. The previous section described the staging and unstaging commands.
  3454. What follows are the commands which implement the remaining apply
  3455. variants.
  3456. ‘a’ (‘magit-apply’)
  3457. Apply the change at point to the working tree.
  3458. With a prefix argument fallback to a 3-way merge. Doing so causes
  3459. the change to be applied to the index as well.
  3460. ‘k’ (‘magit-discard’)
  3461. Remove the change at point from the working tree.
  3462. ‘v’ (‘magit-reverse’)
  3463. Reverse the change at point in the working tree.
  3464. With a prefix argument fallback to a 3-way merge. Doing so causes
  3465. the change to be applied to the index as well.
  3466. With a prefix argument all apply variants attempt a 3-way merge when
  3467. appropriate (i.e. when ‘git apply’ is used internally).
  3468. 
  3469. File: magit.info, Node: Committing, Next: Branching, Prev: Applying, Up: Manipulating
  3470. 6.5 Committing
  3471. ==============
  3472. When the user initiates a commit, Magit calls ‘git commit’ without any
  3473. arguments, so Git has to get it from the user. It creates the file
  3474. ‘.git/COMMIT_EDITMSG’ and then opens that file in an editor. Magit
  3475. arranges for that editor to be the Emacsclient. Once the user finishes
  3476. the editing session, the Emacsclient exits and Git creates the commit
  3477. using the file’s content as message.
  3478. * Menu:
  3479. * Initiating a Commit::
  3480. * Editing Commit Messages::
  3481. 
  3482. File: magit.info, Node: Initiating a Commit, Next: Editing Commit Messages, Up: Committing
  3483. 6.5.1 Initiating a Commit
  3484. -------------------------
  3485. Also see *note (gitman)git-commit::.
  3486. ‘c’ (‘magit-commit’)
  3487. This transient prefix command binds the following suffix commands
  3488. along with the appropriate infix arguments and displays them in a
  3489. temporary buffer until a suffix is invoked.
  3490. ‘c c’ (‘magit-commit-create’)
  3491. Create a new commit on ‘HEAD’. With a prefix argument amend to the
  3492. commit at ‘HEAD’ instead.
  3493. ‘c a’ (‘magit-commit-amend’)
  3494. Amend the last commit.
  3495. ‘c e’ (‘magit-commit-extend’)
  3496. Amend the last commit, without editing the message. With a prefix
  3497. argument keep the committer date, otherwise change it. The option
  3498. ‘magit-commit-extend-override-date’ can be used to inverse the
  3499. meaning of the prefix argument.
  3500. Non-interactively respect the optional OVERRIDE-DATE argument and
  3501. ignore the option.
  3502. ‘c w’ (‘magit-commit-reword’)
  3503. Reword the last commit, ignoring staged changes. With a prefix
  3504. argument keep the committer date, otherwise change it. The option
  3505. ‘magit-commit-reword-override-date’ can be used to inverse the
  3506. meaning of the prefix argument.
  3507. Non-interactively respect the optional OVERRIDE-DATE argument and
  3508. ignore the option.
  3509. ‘c f’ (‘magit-commit-fixup’)
  3510. Create a fixup commit.
  3511. With a prefix argument the target commit has to be confirmed.
  3512. Otherwise the commit at point may be used without confirmation
  3513. depending on the value of option ‘magit-commit-squash-confirm’.
  3514. ‘c F’ (‘magit-commit-instant-fixup’)
  3515. Create a fixup commit and instantly rebase.
  3516. ‘c s’ (‘magit-commit-squash’)
  3517. Create a squash commit, without editing the squash message.
  3518. With a prefix argument the target commit has to be confirmed.
  3519. Otherwise the commit at point may be used without confirmation
  3520. depending on the value of option ‘magit-commit-squash-confirm’.
  3521. ‘c S’ (‘magit-commit-instant-squash’)
  3522. Create a squash commit and instantly rebase.
  3523. ‘c A’ (‘magit-commit-augment’)
  3524. Create a squash commit, editing the squash message.
  3525. With a prefix argument the target commit has to be confirmed.
  3526. Otherwise the commit at point may be used without confirmation
  3527. depending on the value of option ‘magit-commit-squash-confirm’.
  3528. -- User Option: magit-commit-ask-to-stage
  3529. Whether to ask to stage all unstaged changes when committing and
  3530. nothing is staged.
  3531. -- User Option: magit-commit-extend-override-date
  3532. Whether using ‘magit-commit-extend’ changes the committer date.
  3533. -- User Option: magit-commit-reword-override-date
  3534. Whether using ‘magit-commit-reword’ changes the committer date.
  3535. -- User Option: magit-commit-squash-confirm
  3536. Whether the commit targeted by squash and fixup has to be
  3537. confirmed. When non-nil then the commit at point (if any) is used
  3538. as default choice. Otherwise it has to be confirmed. This option
  3539. only affects ‘magit-commit-squash’ and ‘magit-commit-fixup’. The
  3540. "instant" variants always require confirmation because making an
  3541. error while using those is harder to recover from.
  3542. 
  3543. File: magit.info, Node: Editing Commit Messages, Prev: Initiating a Commit, Up: Committing
  3544. 6.5.2 Editing Commit Messages
  3545. -----------------------------
  3546. After initiating a commit as described in the previous section, two new
  3547. buffers appear. One shows the changes that are about to committed,
  3548. while the other is used to write the message. All regular editing
  3549. commands are available in the commit message buffer. This section only
  3550. describes the additional commands.
  3551. Commit messages are edited in an edit session - in the background Git
  3552. is waiting for the editor, in our case the Emacsclient, to save the
  3553. commit message in a file (in most cases ‘.git/COMMIT_EDITMSG’) and then
  3554. return. If the Emacsclient returns with a non-zero exit status then Git
  3555. does not create the commit. So the most important commands are those
  3556. for finishing and aborting the commit.
  3557. ‘C-c C-c’ (‘with-editor-finish’)
  3558. Finish the current editing session by returning with exit code 0.
  3559. Git then creates the commit using the message it finds in the file.
  3560. ‘C-c C-k’ (‘with-editor-cancel’)
  3561. Cancel the current editing session by returning with exit code 1.
  3562. Git then cancels the commit, but leaves the file untouched.
  3563. In addition to being used by Git, these messages may also be stored
  3564. in a ring that persists until Emacs is closed. By default the message
  3565. is stored at the beginning and the end of an edit session (regardless of
  3566. whether the session is finished successfully or was canceled). It is
  3567. sometimes useful to bring back messages from that ring.
  3568. ‘C-c M-s’ (‘git-commit-save-message’)
  3569. Save the current buffer content to the commit message ring.
  3570. ‘M-p’ (‘git-commit-prev-message’)
  3571. Cycle backward through the commit message ring, after saving the
  3572. current message to the ring. With a numeric prefix ARG, go back
  3573. ARG comments.
  3574. ‘M-n’ (‘git-commit-next-message’)
  3575. Cycle forward through the commit message ring, after saving the
  3576. current message to the ring. With a numeric prefix ARG, go back
  3577. ARG comments.
  3578. By default the diff for the changes that are about to be committed
  3579. are automatically shown when invoking the commit. When amending to an
  3580. existing commit it may be useful to show either the changes that are
  3581. about to be added to that commit or to show those changes together with
  3582. those that are already committed.
  3583. ‘C-c C-d’ (‘magit-diff-while-committing’)
  3584. While committing, show the changes that are about to be committed.
  3585. While amending, invoking the command again toggles between showing
  3586. just the new changes or all the changes that will be committed.
  3587. ‘C-c C-w’ (‘magit-pop-revision-stack’)
  3588. This command inserts a representation of a revision into the
  3589. current buffer. It can be used inside buffers used to write commit
  3590. messages but also in other buffers such as buffers used to edit
  3591. emails or ChangeLog files.
  3592. By default this command pops the revision which was last added to
  3593. the ‘magit-revision-stack’ and inserts it into the current buffer
  3594. according to ‘magit-pop-revision-stack-format’. Revisions can be
  3595. put on the stack using ‘magit-copy-section-value’ and
  3596. ‘magit-copy-buffer-revision’.
  3597. If the stack is empty or with a prefix argument it instead reads a
  3598. revision in the minibuffer. By using the minibuffer history this
  3599. allows selecting an item which was popped earlier or to insert an
  3600. arbitrary reference or revision without first pushing it onto the
  3601. stack.
  3602. When reading the revision from the minibuffer, then it might not be
  3603. possible to guess the correct repository. When this command is
  3604. called inside a repository (e.g. while composing a commit
  3605. message), then that repository is used. Otherwise (e.g. while
  3606. composing an email) then the repository recorded for the top
  3607. element of the stack is used (even though we insert another
  3608. revision). If not called inside a repository and with an empty
  3609. stack, or with two prefix arguments, then read the repository in
  3610. the minibuffer too.
  3611. -- User Option: magit-pop-revision-stack-format
  3612. This option controls how the command ‘magit-pop-revision-stack’
  3613. inserts a revision into the current buffer.
  3614. The entries on the stack have the format ‘(HASH TOPLEVEL)’ and this
  3615. option has the format ‘(POINT-FORMAT EOB-FORMAT INDEX-REGEXP)’, all
  3616. of which may be nil or a string (though either one of EOB-FORMAT or
  3617. POINT-FORMAT should be a string, and if INDEX-REGEXP is non-nil,
  3618. then the two formats should be too).
  3619. First INDEX-REGEXP is used to find the previously inserted entry,
  3620. by searching backward from point. The first submatch must match
  3621. the index number. That number is incremented by one, and becomes
  3622. the index number of the entry to be inserted. If you don’t want to
  3623. number the inserted revisions, then use nil for INDEX-REGEXP.
  3624. If INDEX-REGEXP is non-nil then both POINT-FORMAT and EOB-FORMAT
  3625. should contain \"%N\", which is replaced with the number that was
  3626. determined in the previous step.
  3627. Both formats, if non-nil and after removing %N, are then expanded
  3628. using ‘git show –format=FORMAT ...’ inside TOPLEVEL.
  3629. The expansion of POINT-FORMAT is inserted at point, and the
  3630. expansion of EOB-FORMAT is inserted at the end of the buffer (if
  3631. the buffer ends with a comment, then it is inserted right before
  3632. that).
  3633. Some projects use pseudo headers in commit messages. Magit colorizes
  3634. such headers and provides some commands to insert such headers.
  3635. -- User Option: git-commit-known-pseudo-headers
  3636. A list of Git pseudo headers to be highlighted.
  3637. ‘C-c C-a’ (‘git-commit-ack’)
  3638. Insert a header acknowledging that you have looked at the commit.
  3639. ‘C-c C-r’ (‘git-commit-review’)
  3640. Insert a header acknowledging that you have reviewed the commit.
  3641. ‘C-c C-s’ (‘git-commit-signoff’)
  3642. Insert a header to sign off the commit.
  3643. ‘C-c C-t’ (‘git-commit-test’)
  3644. Insert a header acknowledging that you have tested the commit.
  3645. ‘C-c C-o’ (‘git-commit-cc’)
  3646. Insert a header mentioning someone who might be interested.
  3647. ‘C-c C-p’ (‘git-commit-reported’)
  3648. Insert a header mentioning the person who reported the issue being
  3649. fixed by the commit.
  3650. ‘C-c C-i’ (‘git-commit-suggested’)
  3651. Insert a header mentioning the person who suggested the change.
  3652. ‘git-commit-mode’ is a minor mode that is only used to establish the
  3653. above key bindings. This allows using an arbitrary major mode when
  3654. editing the commit message. It’s even possible to use a different major
  3655. mode in different repositories, which is useful when different projects
  3656. impose different commit message conventions.
  3657. -- User Option: git-commit-major-mode
  3658. The value of this option is the major mode used to edit Git commit
  3659. messages.
  3660. Because ‘git-commit-mode’ is a minor mode, we don’t use its mode hook
  3661. to setup the buffer, except for the key bindings. All other setup
  3662. happens in the function ‘git-commit-setup’, which among other things
  3663. runs the hook ‘git-commit-setup-hook’. The following functions are
  3664. suitable for that hook.
  3665. -- User Option: git-commit-setup-hook
  3666. Hook run at the end of ‘git-commit-setup’.
  3667. -- Function: magit-revert-buffers &optional force
  3668. Revert unmodified file-visiting buffers of the current repository.
  3669. If either ‘magit-revert-buffers’ is non-nil and
  3670. ‘inhibit-magit-revert’ is nil, or if optional FORCE is non-nil,
  3671. then revert all unmodified buffers that visit files being tracked
  3672. in the current repository.
  3673. -- Function: git-commit-save-message
  3674. Save the current buffer content to the commit message ring.
  3675. -- Function: git-commit-setup-changelog-support
  3676. After this function is called, ChangeLog entries are treated as
  3677. paragraphs.
  3678. -- Function: git-commit-turn-on-auto-fill
  3679. Turn on ‘auto-fill-mode’ and set ‘fill-column’ to the value of
  3680. ‘git-commit-fill-column’.
  3681. -- Function: git-commit-turn-on-flyspell
  3682. Turn on Flyspell mode. Also prevent comments from being checked
  3683. and finally check current non-comment text.
  3684. -- Function: git-commit-propertize-diff
  3685. Propertize the diff shown inside the commit message buffer. Git
  3686. inserts such diffs into the commit message template when the
  3687. ‘--verbose’ argument is used. ‘magit-commit’ by default does not
  3688. offer that argument because the diff that is shown in a separate
  3689. buffer is more useful. But some users disagree, which is why this
  3690. function exists.
  3691. -- Function: with-editor-usage-message
  3692. Show usage information in the echo area.
  3693. Magit also helps with writing *good* commit messages by complaining
  3694. when certain rules are violated.
  3695. -- User Option: git-commit-summary-max-length
  3696. The intended maximal length of the summary line of commit messages.
  3697. Characters beyond this column are colorized to indicate that this
  3698. preference has been violated.
  3699. -- User Option: git-commit-fill-column
  3700. Column beyond which automatic line-wrapping should happen in commit
  3701. message buffers.
  3702. -- User Option: git-commit-finish-query-functions
  3703. List of functions called to query before performing commit.
  3704. The commit message buffer is current while the functions are
  3705. called. If any of them returns nil, then the commit is not
  3706. performed and the buffer is not killed. The user should then fix
  3707. the issue and try again.
  3708. The functions are called with one argument. If it is non-nil then
  3709. that indicates that the user used a prefix argument to force
  3710. finishing the session despite issues. Functions should usually
  3711. honor this wish and return non-nil.
  3712. -- Function: git-commit-check-style-conventions
  3713. Check for violations of certain basic style conventions. For each
  3714. violation ask the user if she wants to proceed anyway. This makes
  3715. sure the summary line isn’t too long and that the second line is
  3716. empty.
  3717. To show no diff while committing remove ‘magit-commit-diff’ from
  3718. ‘server-switch-hook’.
  3719. 
  3720. File: magit.info, Node: Branching, Next: Merging, Prev: Committing, Up: Manipulating
  3721. 6.6 Branching
  3722. =============
  3723. * Menu:
  3724. * The Two Remotes::
  3725. * Branch Commands::
  3726. * Branch Git Variables::
  3727. * Auxiliary Branch Commands::
  3728. 
  3729. File: magit.info, Node: The Two Remotes, Next: Branch Commands, Up: Branching
  3730. 6.6.1 The Two Remotes
  3731. ---------------------
  3732. The upstream branch of some local branch is the branch into which the
  3733. commits on that local branch should eventually be merged, usually
  3734. something like ‘origin/master’. For the ‘master’ branch itself the
  3735. upstream branch and the branch it is being pushed to, are usually the
  3736. same remote branch. But for a feature branch the upstream branch and
  3737. the branch it is being pushed to should differ.
  3738. The commits on feature branches too should _eventually_ end up in a
  3739. remote branch such as ‘origin/master’ or ‘origin/maint’. Such a branch
  3740. should therefore be used as the upstream. But feature branches
  3741. shouldn’t be pushed directly to such branches. Instead a feature branch
  3742. ‘my-feature’ is usually pushed to ‘my-fork/my-feature’ or if you are a
  3743. contributor ‘origin/my-feature’. After the new feature has been
  3744. reviewed, the maintainer merges the feature into ‘master’. And finally
  3745. ‘master’ (not ‘my-feature’ itself) is pushed to ‘origin/master’.
  3746. But new features seldom are perfect on the first try, and so feature
  3747. branches usually have to be reviewed, improved, and re-pushed several
  3748. times. Pushing should therefore be easy to do, and for that reason many
  3749. Git users have concluded that it is best to use the remote branch to
  3750. which the local feature branch is being pushed as its upstream.
  3751. But luckily Git has long ago gained support for a push-remote which
  3752. can be configured separately from the upstream branch, using the
  3753. variables ‘branch.<name>.pushRemote’ and ‘remote.pushDefault’. So we no
  3754. longer have to choose which of the two remotes should be used as "the
  3755. remote".
  3756. Each of the fetching, pulling, and pushing transient commands
  3757. features three suffix commands that act on the current branch and some
  3758. other branch. Of these, ‘p’ is bound to a command which acts on the
  3759. push-remote, ‘u’ is bound to a command which acts on the upstream, and
  3760. ‘e’ is bound to a command which acts on any other branch. The status
  3761. buffer shows unpushed and unpulled commits for both the push-remote and
  3762. the upstream.
  3763. It’s fairly simple to configure these two remotes. The values of all
  3764. the variables that are related to fetching, pulling, and pushing (as
  3765. well as some other branch-related variables) can be inspected and
  3766. changed using the command ‘magit-branch-configure’, which is available
  3767. from many transient prefix commands that deal with branches. It is also
  3768. possible to set the push-remote or upstream while pushing (see *note
  3769. Pushing::).
  3770. 
  3771. File: magit.info, Node: Branch Commands, Next: Branch Git Variables, Prev: The Two Remotes, Up: Branching
  3772. 6.6.2 Branch Commands
  3773. ---------------------
  3774. The transient prefix command ‘magit-branch’ is used to create and
  3775. checkout branches, and to make changes to existing branches. It is not
  3776. used to fetch, pull, merge, rebase, or push branches, i.e. this command
  3777. deals with branches themselves, not with the commits reachable from
  3778. them. Those features are available from separate transient command.
  3779. ‘b’ (‘magit-branch’)
  3780. This transient prefix command binds the following suffix commands
  3781. and displays them in a temporary buffer until a suffix is invoked.
  3782. By default it also binds and displays the values of some
  3783. branch-related Git variables and allows changing their values.
  3784. -- User Option: magit-branch-direct-configure
  3785. This option controls whether the transient command ‘magit-branch’
  3786. can be used directly change the values Git variables. This
  3787. defaults to ‘t’ (to avoid changing key bindings). When set to
  3788. ‘nil’, then no variables are displayed by that transient command,
  3789. and its suffix command ‘magit-branch-configure’ has to be used
  3790. instead to view and change branch related variables.
  3791. ‘b C’ (‘magit-branch-configure’)
  3792. ‘f C’ (‘magit-branch-configure’)
  3793. ‘F C’ (‘magit-branch-configure’)
  3794. ‘P C’ (‘magit-branch-configure’)
  3795. This transient prefix command binds commands that set the value of
  3796. branch-related variables and displays them in a temporary buffer
  3797. until the transient is exited.
  3798. With a prefix argument, this command always prompts for a branch.
  3799. Without a prefix argument this depends on whether it was invoked as
  3800. a suffix of ‘magit-branch’ and on the
  3801. ‘magit-branch-direct-configure’ option. If ‘magit-branch’ already
  3802. displays the variables for the current branch, then it isn’t useful
  3803. to invoke another transient that displays them for the same branch.
  3804. In that case this command prompts for a branch.
  3805. The variables are described in *note Branch Git Variables::.
  3806. ‘b b’ (‘magit-checkout’)
  3807. Checkout a revision read in the minibuffer and defaulting to the
  3808. branch or arbitrary revision at point. If the revision is a local
  3809. branch then that becomes the current branch. If it is something
  3810. else then ‘HEAD’ becomes detached. Checkout fails if the working
  3811. tree or the staging area contain changes.
  3812. ‘b n’ (‘magit-branch-create’)
  3813. Create a new branch. The user is asked for a branch or arbitrary
  3814. revision to use as the starting point of the new branch. When a
  3815. branch name is provided, then that becomes the upstream branch of
  3816. the new branch. The name of the new branch is also read in the
  3817. minibuffer.
  3818. Also see option ‘magit-branch-prefer-remote-upstream’.
  3819. ‘b c’ (‘magit-branch-and-checkout’)
  3820. This command creates a new branch like ‘magit-branch’, but then
  3821. also checks it out.
  3822. Also see option ‘magit-branch-prefer-remote-upstream’.
  3823. ‘b l’ (‘magit-branch-checkout’)
  3824. This command checks out an existing or new local branch. It reads
  3825. a branch name from the user offering all local branches and a
  3826. subset of remote branches as candidates. Remote branches for which
  3827. a local branch by the same name exists are omitted from the list of
  3828. candidates. The user can also enter a completely new branch name.
  3829. • If the user selects an existing local branch, then that is
  3830. checked out.
  3831. • If the user selects a remote branch, then it creates and
  3832. checks out a new local branch with the same name, and
  3833. configures the selected remote branch as the push target.
  3834. • If the user enters a new branch name, then it creates and
  3835. checks that out, after also reading the starting-point from
  3836. the user.
  3837. In the latter two cases the upstream is also set. Whether it is
  3838. set to the chosen starting point or something else depends on the
  3839. value of ‘magit-branch-adjust-remote-upstream-alist’.
  3840. ‘b s’ (‘magit-branch-spinoff’)
  3841. This command creates and checks out a new branch starting at and
  3842. tracking the current branch. That branch in turn is reset to the
  3843. last commit it shares with its upstream. If the current branch has
  3844. no upstream or no unpushed commits, then the new branch is created
  3845. anyway and the previously current branch is not touched.
  3846. This is useful to create a feature branch after work has already
  3847. began on the old branch (likely but not necessarily "master").
  3848. If the current branch is a member of the value of option
  3849. ‘magit-branch-prefer-remote-upstream’ (which see), then the current
  3850. branch will be used as the starting point as usual, but the
  3851. upstream of the starting-point may be used as the upstream of the
  3852. new branch, instead of the starting-point itself.
  3853. If optional FROM is non-nil, then the source branch is reset to
  3854. ‘FROM~’, instead of to the last commit it shares with its upstream.
  3855. Interactively, FROM is only ever non-nil, if the region selects
  3856. some commits, and among those commits, FROM is the commit that is
  3857. the fewest commits ahead of the source branch.
  3858. The commit at the other end of the selection actually does not
  3859. matter, all commits between FROM and ‘HEAD’ are moved to the new
  3860. branch. If FROM is not reachable from ‘HEAD’ or is reachable from
  3861. the source branch’s upstream, then an error is raised.
  3862. ‘b S’ (‘magit-branch-spinout’)
  3863. This command behaves like ‘magit-branch-spinoff’, except that it
  3864. does not change the current branch. If there are any uncommitted
  3865. changes, then it behaves exactly like ‘magit-branch-spinoff’.
  3866. ‘b x’ (‘magit-branch-reset’)
  3867. This command resets a branch, defaulting to the branch at point, to
  3868. the tip of another branch or any other commit.
  3869. When the branch being reset is the current branch, then a hard
  3870. reset is performed. If there are any uncommitted changes, then the
  3871. user has to confirm the reset because those changes would be lost.
  3872. This is useful when you have started work on a feature branch but
  3873. realize it’s all crap and want to start over.
  3874. When resetting to another branch and a prefix argument is used,
  3875. then the target branch is set as the upstream of the branch that is
  3876. being reset.
  3877. ‘b k’ (‘magit-branch-delete’)
  3878. Delete one or multiple branches. If the region marks multiple
  3879. branches, then offer to delete those. Otherwise, prompt for a
  3880. single branch to be deleted, defaulting to the branch at point.
  3881. ‘b r’ (‘magit-branch-rename’)
  3882. Rename a branch. The branch and the new name are read in the
  3883. minibuffer. With prefix argument the branch is renamed even if
  3884. that name conflicts with an existing branch.
  3885. -- User Option: magit-branch-read-upstream-first
  3886. When creating a branch, whether to read the upstream branch before
  3887. the name of the branch that is to be created. The default is
  3888. ‘nil’, and I recommend you leave it at that.
  3889. -- User Option: magit-branch-prefer-remote-upstream
  3890. This option specifies whether remote upstreams are favored over
  3891. local upstreams when creating new branches.
  3892. When a new branch is created, then the branch, commit, or stash at
  3893. point is suggested as the starting point of the new branch, or if
  3894. there is no such revision at point the current branch. In either
  3895. case the user may choose another starting point.
  3896. If the chosen starting point is a branch, then it may also be set
  3897. as the upstream of the new branch, depending on the value of the
  3898. Git variable ‘branch.autoSetupMerge’. By default this is done for
  3899. remote branches, but not for local branches.
  3900. You might prefer to always use some remote branch as upstream. If
  3901. the chosen starting point is (1) a local branch, (2) whose name
  3902. matches a member of the value of this option, (3) the upstream of
  3903. that local branch is a remote branch with the same name, and (4)
  3904. that remote branch can be fast-forwarded to the local branch, then
  3905. the chosen branch is used as starting point, but its own upstream
  3906. is used as the upstream of the new branch.
  3907. Members of this option’s value are treated as branch names that
  3908. have to match exactly unless they contain a character that makes
  3909. them invalid as a branch name. Recommended characters to use to
  3910. trigger interpretation as a regexp are "*" and "^". Some other
  3911. characters which you might expect to be invalid, actually are not,
  3912. e.g. ".+$" are all perfectly valid. More precisely, if ‘git
  3913. check-ref-format –branch STRING’ exits with a non-zero status, then
  3914. treat STRING as a regexp.
  3915. Assuming the chosen branch matches these conditions you would end
  3916. up with with e.g.:
  3917. feature --upstream--> origin/master
  3918. instead of
  3919. feature --upstream--> master --upstream--> origin/master
  3920. Which you prefer is a matter of personal preference. If you do
  3921. prefer the former, then you should add branches such as ‘master’,
  3922. ‘next’, and ‘maint’ to the value of this options.
  3923. -- User Option: magit-branch-adjust-remote-upstream-alist
  3924. The value of this option is an alist of branches to be used as the
  3925. upstream when branching a remote branch.
  3926. When creating a local branch from an ephemeral branch located on a
  3927. remote, e.g. a feature or hotfix branch, then that remote branch
  3928. should usually not be used as the upstream branch, since the
  3929. push-remote already allows accessing it and having both the
  3930. upstream and the push-remote reference the same related branch
  3931. would be wasteful. Instead a branch like "maint" or "master"
  3932. should be used as the upstream.
  3933. This option allows specifying the branch that should be used as the
  3934. upstream when branching certain remote branches. The value is an
  3935. alist of the form ‘((UPSTREAM . RULE)...)’. The first matching
  3936. element is used, the following elements are ignored.
  3937. UPSTREAM is the branch to be used as the upstream for branches
  3938. specified by RULE. It can be a local or a remote branch.
  3939. RULE can either be a regular expression, matching branches whose
  3940. upstream should be the one specified by UPSTREAM. Or it can be a
  3941. list of the only branches that should *not* use UPSTREAM; all other
  3942. branches will. Matching is done after stripping the remote part of
  3943. the name of the branch that is being branched from.
  3944. If you use a finite set of non-ephemeral branches across all your
  3945. repositories, then you might use something like:
  3946. (("origin/master" "master" "next" "maint"))
  3947. Or if the names of all your ephemeral branches contain a slash, at
  3948. least in some repositories, then a good value could be:
  3949. (("origin/master" . "/"))
  3950. Of course you can also fine-tune:
  3951. (("origin/maint" . "\\`hotfix/")
  3952. ("origin/master" . "\\`feature/"))
  3953. -- Command: magit-branch-orphan
  3954. This command creates and checks out a new orphan branch with
  3955. contents from a given revision.
  3956. -- Command: magit-branch-or-checkout
  3957. This command is a hybrid between ‘magit-checkout’ and
  3958. ‘magit-branch-and-checkout’ and is intended as a replacement for
  3959. the former in ‘magit-branch’.
  3960. It first asks the user for an existing branch or revision. If the
  3961. user input actually can be resolved as a branch or revision, then
  3962. it checks that out, just like ‘magit-checkout’ would.
  3963. Otherwise it creates and checks out a new branch using the input as
  3964. its name. Before doing so it reads the starting-point for the new
  3965. branch. This is similar to what ‘magit-branch-and-checkout’ does.
  3966. To use this command instead of ‘magit-checkout’ add this to your
  3967. init file:
  3968. (transient-replace-suffix 'magit-branch 'magit-checkout
  3969. '("b" "dwim" magit-branch-or-checkout))
  3970. 
  3971. File: magit.info, Node: Branch Git Variables, Next: Auxiliary Branch Commands, Prev: Branch Commands, Up: Branching
  3972. 6.6.3 Branch Git Variables
  3973. --------------------------
  3974. These variables can be set from the transient prefix command
  3975. ‘magit-branch-configure’. By default they can also be set from
  3976. ‘magit-branch’. See *note Branch Commands::.
  3977. -- Variable: branch.NAME.merge
  3978. Together with ‘branch.NAME.remote’ this variable defines the
  3979. upstream branch of the local branch named NAME. The value of this
  3980. variable is the full reference of the upstream _branch_.
  3981. -- Variable: branch.NAME.remote
  3982. Together with ‘branch.NAME.merge’ this variable defines the
  3983. upstream branch of the local branch named NAME. The value of this
  3984. variable is the name of the upstream _remote_.
  3985. -- Variable: branch.NAME.rebase
  3986. This variable controls whether pulling into the branch named NAME
  3987. is done by rebasing or by merging the fetched branch.
  3988. • When ‘true’ then pulling is done by rebasing.
  3989. • When ‘false’ then pulling is done by merging.
  3990. • When undefined then the value of ‘pull.rebase’ is used. The
  3991. default of that variable is ‘false’.
  3992. -- Variable: branch.NAME.pushRemote
  3993. This variable specifies the remote that the branch named NAME is
  3994. usually pushed to. The value has to be the name of an existing
  3995. remote.
  3996. It is not possible to specify the name of _branch_ to push the
  3997. local branch to. The name of the remote branch is always the same
  3998. as the name of the local branch.
  3999. If this variable is undefined but ‘remote.pushDefault’ is defined,
  4000. then the value of the latter is used. By default
  4001. ‘remote.pushDefault’ is undefined.
  4002. -- Variable: branch.NAME.description
  4003. This variable can be used to describe the branch named NAME. That
  4004. description is used e.g. when turning the branch into a series of
  4005. patches.
  4006. The following variables specify defaults which are used if the above
  4007. branch-specific variables are not set.
  4008. -- Variable: pull.rebase
  4009. This variable specifies whether pulling is done by rebasing or by
  4010. merging. It can be overwritten using ‘branch.NAME.rebase’.
  4011. • When ‘true’ then pulling is done by rebasing.
  4012. • When ‘false’ (the default) then pulling is done by merging.
  4013. Since it is never a good idea to merge the upstream branch into a
  4014. feature or hotfix branch and most branches are such branches, you
  4015. should consider setting this to ‘true’, and ‘branch.master.rebase’
  4016. to ‘false’.
  4017. -- Variable: remote.pushDefault
  4018. This variable specifies what remote the local branches are usually
  4019. pushed to. This can be overwritten per branch using
  4020. ‘branch.NAME.pushRemote’.
  4021. The following variables are used during the creation of a branch and
  4022. control whether the various branch-specific variables are automatically
  4023. set at this time.
  4024. -- Variable: branch.autoSetupMerge
  4025. This variable specifies under what circumstances creating a branch
  4026. NAME should result in the variables ‘branch.NAME.merge’ and
  4027. ‘branch.NAME.remote’ being set according to the starting point used
  4028. to create the branch. If the starting point isn’t a branch, then
  4029. these variables are never set.
  4030. • When ‘always’ then the variables are set regardless of whether
  4031. the starting point is a local or a remote branch.
  4032. • When ‘true’ (the default) then the variables are set when the
  4033. starting point is a remote branch, but not when it is a local
  4034. branch.
  4035. • When ‘false’ then the variables are never set.
  4036. -- Variable: branch.autoSetupRebase
  4037. This variable specifies whether creating a branch NAME should
  4038. result in the variable ‘branch.NAME.rebase’ being set to ‘true’.
  4039. • When ‘always’ then the variable is set regardless of whether
  4040. the starting point is a local or a remote branch.
  4041. • When ‘local’ then the variable are set when the starting point
  4042. is a local branch, but not when it is a remote branch.
  4043. • When ‘remote’ then the variable are set when the starting
  4044. point is a remote branch, but not when it is a local branch.
  4045. • When ‘never’ (the default) then the variable is never set.
  4046. Note that the respective commands always change the repository-local
  4047. values. If you want to change the global value, which is used when the
  4048. local value is undefined, then you have to do so on the command line,
  4049. e.g.:
  4050. git config --global remote.autoSetupMerge always
  4051. For more information about these variables you should also see
  4052. *note (gitman)git-config::. Also see *note (gitman)git-branch::. ,
  4053. *note (gitman)git-checkout::. and *note Pushing::.
  4054. -- User Option: magit-prefer-remote-upstream
  4055. This option controls whether commands that read a branch from the
  4056. user and then set it as the upstream branch, offer a local or a
  4057. remote branch as default completion candidate, when they have the
  4058. choice.
  4059. This affects all commands that use ‘magit-read-upstream-branch’ or
  4060. ‘magit-read-starting-point’, which includes all commands that
  4061. change the upstream and many which create new branches.
  4062. 
  4063. File: magit.info, Node: Auxiliary Branch Commands, Prev: Branch Git Variables, Up: Branching
  4064. 6.6.4 Auxiliary Branch Commands
  4065. -------------------------------
  4066. These commands are not available from the transient ‘magit-branch’ by
  4067. default.
  4068. -- Command: magit-branch-shelve
  4069. This command shelves a branch. This is done by deleting the
  4070. branch, and creating a new reference "refs/shelved/BRANCH-NAME"
  4071. pointing at the same commit as the branch pointed at. If the
  4072. deleted branch had a reflog, then that is preserved as the reflog
  4073. of the new reference.
  4074. This is useful if you want to move a branch out of sight, but are
  4075. not ready to completely discard it yet.
  4076. -- Command: magit-branch-unshelve
  4077. This command unshelves a branch that was previously shelved using
  4078. ‘magit-branch-shelve’. This is done by deleting the reference
  4079. "refs/shelved/BRANCH-NAME" and creating a branch "BRANCH-NAME"
  4080. pointing at the same commit as the deleted reference pointed at.
  4081. If the deleted reference had a reflog, then that is restored as the
  4082. reflog of the branch.
  4083. 
  4084. File: magit.info, Node: Merging, Next: Resolving Conflicts, Prev: Branching, Up: Manipulating
  4085. 6.7 Merging
  4086. ===========
  4087. Also see *note (gitman)git-merge::. For information on how to resolve
  4088. merge conflicts see the next section.
  4089. ‘m’ (‘magit-merge’)
  4090. This transient prefix command binds the following suffix commands
  4091. along with the appropriate infix arguments and displays them in a
  4092. temporary buffer until a suffix is invoked.
  4093. When no merge is in progress, then the transient features the
  4094. following suffix commands.
  4095. ‘m m’ (‘magit-merge-plain’)
  4096. This command merges another branch or an arbitrary revision into
  4097. the current branch. The branch or revision to be merged is read in
  4098. the minibuffer and defaults to the branch at point.
  4099. Unless there are conflicts or a prefix argument is used, then the
  4100. resulting merge commit uses a generic commit message, and the user
  4101. does not get a chance to inspect or change it before the commit is
  4102. created. With a prefix argument this does not actually create the
  4103. merge commit, which makes it possible to inspect how conflicts were
  4104. resolved and to adjust the commit message.
  4105. ‘m e’ (‘magit-merge-editmsg’)
  4106. This command merges another branch or an arbitrary revision into
  4107. the current branch and opens a commit message buffer, so that the
  4108. user can make adjustments. The commit is not actually created
  4109. until the user finishes with ‘C-c C-c’.
  4110. ‘m n’ (‘magit-merge-nocommit’)
  4111. This command merges another branch or an arbitrary revision into
  4112. the current branch, but does not actually create the merge commit.
  4113. The user can then further adjust the merge, even when automatic
  4114. conflict resolution succeeded and/or adjust the commit message.
  4115. ‘m a’ (‘magit-merge-absorb’)
  4116. This command merges another local branch into the current branch
  4117. and then removes the former.
  4118. Before the source branch is merged, it is first force pushed to its
  4119. push-remote, provided the respective remote branch already exists.
  4120. This ensures that the respective pull-request (if any) won’t get
  4121. stuck on some obsolete version of the commits that are being
  4122. merged. Finally, if ‘magit-branch-pull-request’ was used to create
  4123. the merged branch, then the respective remote branch is also
  4124. removed.
  4125. ‘m i’ (‘magit-merge-into’)
  4126. This command merges the current branch into another local branch
  4127. and then removes the former. The latter becomes the new current
  4128. branch.
  4129. Before the source branch is merged, it is first force pushed to its
  4130. push-remote, provided the respective remote branch already exists.
  4131. This ensures that the respective pull-request (if any) won’t get
  4132. stuck on some obsolete version of the commits that are being
  4133. merged. Finally, if ‘magit-branch-pull-request’ was used to create
  4134. the merged branch, then the respective remote branch is also
  4135. removed.
  4136. ‘m s’ (‘magit-merge-squash’)
  4137. This command squashes the changes introduced by another branch or
  4138. an arbitrary revision into the current branch. This only applies
  4139. the changes made by the squashed commits. No information is
  4140. preserved that would allow creating an actual merge commit.
  4141. Instead of this command you should probably use a command from the
  4142. apply transient.
  4143. ‘m p’ (‘magit-merge-preview’)
  4144. This command shows a preview of merging another branch or an
  4145. arbitrary revision into the current branch.
  4146. When a merge is in progress, then the transient instead features the
  4147. following suffix commands.
  4148. ‘m m’ (‘magit-merge’)
  4149. After the user resolved conflicts, this command proceeds with the
  4150. merge. If some conflicts weren’t resolved, then this command
  4151. fails.
  4152. ‘m a’ (‘magit-merge-abort’)
  4153. This command aborts the current merge operation.
  4154. 
  4155. File: magit.info, Node: Resolving Conflicts, Next: Rebasing, Prev: Merging, Up: Manipulating
  4156. 6.8 Resolving Conflicts
  4157. =======================
  4158. When merging branches (or otherwise combining or changing history)
  4159. conflicts can occur. If you edited two completely different parts of
  4160. the same file in two branches and then merge one of these branches into
  4161. the other, then Git can resolve that on its own, but if you edit the
  4162. same area of a file, then a human is required to decide how the two
  4163. versions, or "sides of the conflict", are to be combined into one.
  4164. Here we can only provide a brief introduction to the subject and
  4165. point you toward some tools that can help. If you are new to this, then
  4166. please also consult Git’s own documentation as well as other resources.
  4167. If a file has conflicts and Git cannot resolve them by itself, then
  4168. it puts both versions into the affected file along with special markers
  4169. whose purpose is to denote the boundaries of the unresolved part of the
  4170. file and between the different versions. These boundary lines begin
  4171. with the strings consisting of six times the same character, one of ‘<’,
  4172. ‘|’, ‘=’ and ‘>’ and are followed by information about the source of the
  4173. respective versions, e.g.:
  4174. <<<<<<< HEAD
  4175. Take the blue pill.
  4176. =======
  4177. Take the red pill.
  4178. >>>>>>> feature
  4179. In this case you have chosen to take the red pill on one branch and
  4180. on another you picked the blue pill. Now that you are merging these two
  4181. diverging branches, Git cannot possibly know which pill you want to
  4182. take.
  4183. To resolve that conflict you have to create a version of the affected
  4184. area of the file by keeping only one of the sides, possibly by editing
  4185. it in order to bring in the changes from the other side, remove the
  4186. other versions as well as the markers, and then stage the result. A
  4187. possible resolution might be:
  4188. Take both pills.
  4189. Often it is useful to see not only the two sides of the conflict but
  4190. also the "original" version from before the same area of the file was
  4191. modified twice on different branches. Instruct Git to insert that
  4192. version as well by running this command once:
  4193. git config --global merge.conflictStyle diff3
  4194. The above conflict might then have looked like this:
  4195. <<<<<<< HEAD
  4196. Take the blue pill.
  4197. ||||||| merged common ancestors
  4198. Take either the blue or the red pill, but not both.
  4199. =======
  4200. Take the red pill.
  4201. >>>>>>> feature
  4202. If that were the case, then the above conflict resolution would not
  4203. have been correct, which demonstrates why seeing the original version
  4204. alongside the conflicting versions can be useful.
  4205. You can perform the conflict resolution completely by hand, but Emacs
  4206. also provides some packages that help in the process: Smerge, Ediff
  4207. (*note (ediff)Top::), and Emerge (*note (emacs)Emerge::). Magit does
  4208. not provide its own tools for conflict resolution, but it does make
  4209. using Smerge and Ediff more convenient. (Ediff supersedes Emerge, so
  4210. you probably don’t want to use the latter anyway.)
  4211. In the Magit status buffer, files with unresolved conflicts are
  4212. listed in the "Unstaged changes" and/or "Staged changes" sections. They
  4213. are prefixed with the word "unmerged", which in this context essentially
  4214. is a synonym for "unresolved".
  4215. Pressing ‘RET’ while point is on such a file section shows a buffer
  4216. visiting that file, turns on ‘smerge-mode’ in that buffer, and places
  4217. point inside the first area with conflicts. You should then resolve
  4218. that conflict using regular edit commands and/or Smerge commands.
  4219. Unfortunately Smerge does not have a manual, but you can get a list
  4220. of commands and binding ‘C-c ^ C-h’ and press ‘RET’ while point is on a
  4221. command name to read its documentation.
  4222. Normally you would edit one version and then tell Smerge to keep only
  4223. that version. Use ‘C-c ^ m’ (‘smerge-keep-mine’) to keep the ‘HEAD’
  4224. version or ‘C-c ^ o’ (‘smerge-keep-other’) to keep the version that
  4225. follows "|||||||". Then use ‘C-c ^ n’ to move to the next conflicting
  4226. area in the same file. Once you are done resolving conflicts, return to
  4227. the Magit status buffer. The file should now be shown as "modified", no
  4228. longer as "unmerged", because Smerge automatically stages the file when
  4229. you save the buffer after resolving the last conflict.
  4230. Alternatively you could use Ediff, which uses separate buffers for
  4231. the different versions of the file. To resolve conflicts in a file
  4232. using Ediff press ‘e’ while point is on such a file in the status
  4233. buffer.
  4234. Ediff can be used for other purposes as well. For more information
  4235. on how to enter Ediff from Magit, see *note Ediffing::. Explaining how
  4236. to use Ediff is beyond the scope of this manual, instead see *note
  4237. (ediff)Top::.
  4238. If you are unsure whether you should Smerge or Ediff, then use the
  4239. former. It is much easier to understand and use, and except for truly
  4240. complex conflicts, the latter is usually overkill.
  4241. 
  4242. File: magit.info, Node: Rebasing, Next: Cherry Picking, Prev: Resolving Conflicts, Up: Manipulating
  4243. 6.9 Rebasing
  4244. ============
  4245. Also see *note (gitman)git-rebase::. For information on how to resolve
  4246. conflicts that occur during rebases see the preceding section.
  4247. ‘r’ (‘magit-rebase’)
  4248. This transient prefix command binds the following suffix commands
  4249. along with the appropriate infix arguments and displays them in a
  4250. temporary buffer until a suffix is invoked.
  4251. When no rebase is in progress, then the transient features the
  4252. following suffix commands.
  4253. Using one of these commands _starts_ a rebase sequence. Git might
  4254. then stop somewhere along the way, either because you told it to do so,
  4255. or because applying a commit failed due to a conflict. When that
  4256. happens, then the status buffer shows information about the rebase
  4257. sequence which is in progress in a section similar to a log section.
  4258. See *note Information About In-Progress Rebase::.
  4259. For information about the upstream and the push-remote, see *note The
  4260. Two Remotes::.
  4261. ‘r p’ (‘magit-rebase-onto-pushremote’)
  4262. This command rebases the current branch onto its push-remote.
  4263. When ‘magit-remote-set-if-missing’ is non-nil and the push-remote
  4264. is not configured, then configure it before rebasing. With a
  4265. prefix argument let the user change the push-remote before rebasing
  4266. onto it.
  4267. ‘r u’ (‘magit-rebase-onto-upstream’)
  4268. This command rebases the current branch onto its upstream branch.
  4269. When ‘magit-remote-set-if-missing’ is non-nil and the upstream is
  4270. not configured, then configure it before rebasing. With a prefix
  4271. argument let the user change the upstream before rebasing onto it.
  4272. ‘r e’ (‘magit-rebase-branch’)
  4273. This command rebases the current branch onto a branch read in the
  4274. minibuffer. All commits that are reachable from head but not from
  4275. the selected branch TARGET are being rebased.
  4276. ‘r s’ (‘magit-rebase-subset’)
  4277. This command starts a non-interactive rebase sequence to transfer
  4278. commits from START to ‘HEAD’ onto NEWBASE. START has to be
  4279. selected from a list of recent commits.
  4280. By default Magit uses the ‘--autostash’ argument, which causes
  4281. uncommitted changes to be stored in a stash before the rebase begins.
  4282. These changes are restored after the rebase completes and if possible
  4283. the stash is removed. If the stash does not apply cleanly, then the
  4284. stash is not removed. In case something goes wrong when resolving the
  4285. conflicts, this allows you to start over.
  4286. Even though one of the actions is dedicated to interactive rebases,
  4287. the transient also features the infix argument ‘--interactive’. This
  4288. can be used to turn one of the other, non-interactive rebase variants
  4289. into an interactive rebase.
  4290. For example if you want to clean up a feature branch and at the same
  4291. time rebase it onto ‘master’, then you could use ‘r-iu’. But we
  4292. recommend that you instead do that in two steps. First use ‘ri’ to
  4293. cleanup the feature branch, and then in a second step ‘ru’ to rebase it
  4294. onto ‘master’. That way if things turn out to be more complicated than
  4295. you thought and/or you make a mistake and have to start over, then you
  4296. only have to redo half the work.
  4297. Explicitly enabling ‘--interactive’ won’t have an effect on the
  4298. following commands as they always use that argument anyway, even if it
  4299. is not enabled in the transient.
  4300. ‘r i’ (‘magit-rebase-interactive’)
  4301. This command starts an interactive rebase sequence.
  4302. ‘r f’ (‘magit-rebase-autosquash’)
  4303. This command combines squash and fixup commits with their intended
  4304. targets.
  4305. ‘r m’ (‘magit-rebase-edit-commit’)
  4306. This command starts an interactive rebase sequence that lets the
  4307. user edit a single older commit.
  4308. ‘r w’ (‘magit-rebase-reword-commit’)
  4309. This command starts an interactive rebase sequence that lets the
  4310. user reword a single older commit.
  4311. ‘r k’ (‘magit-rebase-remove-commit’)
  4312. This command removes a single older commit using rebase.
  4313. When a rebase is in progress, then the transient instead features the
  4314. following suffix commands.
  4315. ‘r r’ (‘magit-rebase-continue’)
  4316. This command restart the current rebasing operation.
  4317. In some cases this pops up a commit message buffer for you do edit.
  4318. With a prefix argument the old message is reused as-is.
  4319. ‘r s’ (‘magit-rebase-skip’)
  4320. This command skips the current commit and restarts the current
  4321. rebase operation.
  4322. ‘r e’ (‘magit-rebase-edit’)
  4323. This command lets the user edit the todo list of the current rebase
  4324. operation.
  4325. ‘r a’ (‘magit-rebase-abort’)
  4326. This command aborts the current rebase operation, restoring the
  4327. original branch.
  4328. * Menu:
  4329. * Editing Rebase Sequences::
  4330. * Information About In-Progress Rebase::
  4331. 
  4332. File: magit.info, Node: Editing Rebase Sequences, Next: Information About In-Progress Rebase, Up: Rebasing
  4333. 6.9.1 Editing Rebase Sequences
  4334. ------------------------------
  4335. ‘C-c C-c’ (‘with-editor-finish’)
  4336. Finish the current editing session by returning with exit code 0.
  4337. Git then uses the rebase instructions it finds in the file.
  4338. ‘C-c C-k’ (‘with-editor-cancel’)
  4339. Cancel the current editing session by returning with exit code 1.
  4340. Git then forgoes starting the rebase sequence.
  4341. ‘RET’ (‘git-rebase-show-commit’)
  4342. Show the commit on the current line in another buffer and select
  4343. that buffer.
  4344. ‘SPC’ (‘git-rebase-show-or-scroll-up’)
  4345. Show the commit on the current line in another buffer without
  4346. selecting that buffer. If the revision buffer is already visible
  4347. in another window of the current frame, then instead scroll that
  4348. window up.
  4349. ‘DEL’ (‘git-rebase-show-or-scroll-down’)
  4350. Show the commit on the current line in another buffer without
  4351. selecting that buffer. If the revision buffer is already visible
  4352. in another window of the current frame, then instead scroll that
  4353. window down.
  4354. ‘p’ (‘git-rebase-backward-line’)
  4355. Move to previous line.
  4356. ‘n’ (‘forward-line’)
  4357. Move to next line.
  4358. ‘M-p’ (‘git-rebase-move-line-up’)
  4359. Move the current commit (or command) up.
  4360. ‘M-n’ (‘git-rebase-move-line-down’)
  4361. Move the current commit (or command) down.
  4362. ‘r’ (‘git-rebase-reword’)
  4363. Edit message of commit on current line.
  4364. ‘e’ (‘git-rebase-edit’)
  4365. Stop at the commit on the current line.
  4366. ‘s’ (‘git-rebase-squash’)
  4367. Meld commit on current line into previous commit, and edit message.
  4368. ‘f’ (‘git-rebase-fixup’)
  4369. Meld commit on current line into previous commit, discarding the
  4370. current commit’s message.
  4371. ‘k’ (‘git-rebase-kill-line’)
  4372. Kill the current action line.
  4373. ‘c’ (‘git-rebase-pick’)
  4374. Use commit on current line.
  4375. ‘x’ (‘git-rebase-exec’)
  4376. Insert a shell command to be run after the proceeding commit.
  4377. If there already is such a command on the current line, then edit
  4378. that instead. With a prefix argument insert a new command even
  4379. when there already is one on the current line. With empty input
  4380. remove the command on the current line, if any.
  4381. ‘b’ (‘git-rebase-break’)
  4382. Insert a break action before the current line, instructing Git to
  4383. return control to the user.
  4384. ‘y’ (‘git-rebase-insert’)
  4385. Read an arbitrary commit and insert it below current line.
  4386. ‘C-x u’ (‘git-rebase-undo’)
  4387. Undo some previous changes. Like ‘undo’ but works in read-only
  4388. buffers.
  4389. -- User Option: git-rebase-auto-advance
  4390. Whether to move to next line after changing a line.
  4391. -- User Option: git-rebase-show-instructions
  4392. Whether to show usage instructions inside the rebase buffer.
  4393. -- User Option: git-rebase-confirm-cancel
  4394. Whether confirmation is required to cancel.
  4395. When a rebase is performed with the ‘--rebase-merges’ option, the
  4396. sequence will include a few other types of actions and the following
  4397. commands become relevant.
  4398. ‘l’ (‘git-rebase-label’)
  4399. This commands inserts a label action or edits the one at point.
  4400. ‘t’ (‘git-rebase-reset’)
  4401. This command inserts a reset action or edits the one at point. The
  4402. prompt will offer the labels that are currently present in the
  4403. buffer.
  4404. ‘MM’ (‘git-rebase-merge’)
  4405. The command inserts a merge action or edits the one at point. The
  4406. prompt will offer the labels that are currently present in the
  4407. buffer. Specifying a message to reuse via ‘-c’ or ‘-C’ is not
  4408. supported; an editor will always be invoked for the merge.
  4409. ‘Mt’ (‘git-rebase-merge-toggle-editmsg’)
  4410. This command toggles between the ‘-C’ and ‘-c’ options of the merge
  4411. action at point. These options both specify a commit whose message
  4412. should be reused. The lower-case variant instructs Git to invoke
  4413. the editor when creating the merge, allowing the user to edit the
  4414. message.
  4415. 
  4416. File: magit.info, Node: Information About In-Progress Rebase, Prev: Editing Rebase Sequences, Up: Rebasing
  4417. 6.9.2 Information About In-Progress Rebase
  4418. ------------------------------------------
  4419. While a rebase sequence is in progress, the status buffer features a
  4420. section that lists the commits that have already been applied as well as
  4421. the commits that still have to be applied.
  4422. The commits are split in two halves. When rebase stops at a commit,
  4423. either because the user has to deal with a conflict or because s/he
  4424. explicitly requested that rebase stops at that commit, then point is
  4425. placed on the commit that separates the two groups, i.e. on ‘HEAD’.
  4426. The commits above it have not been applied yet, while the ‘HEAD’ and the
  4427. commits below it have already been applied. In between these two groups
  4428. of applied and yet-to-be applied commits, there sometimes is a commit
  4429. which has been dropped.
  4430. Each commit is prefixed with a word and these words are additionally
  4431. shown in different colors to indicate the status of the commits.
  4432. The following colors are used:
  4433. • Yellow commits have not been applied yet.
  4434. • Gray commits have already been applied.
  4435. • The blue commit is the ‘HEAD’ commit.
  4436. • The green commit is the commit the rebase sequence stopped at. If
  4437. this is the same commit as ‘HEAD’ (e.g. because you haven’t done
  4438. anything yet after rebase stopped at the commit, then this commit
  4439. is shown in blue, not green). There can only be a green *and* a
  4440. blue commit at the same time, if you create one or more new commits
  4441. after rebase stops at a commit.
  4442. • Red commits have been dropped. They are shown for reference only,
  4443. e.g. to make it easier to diff.
  4444. Of course these colors are subject to the color-theme in use.
  4445. The following words are used:
  4446. • Commits prefixed with ‘pick’, ‘reword’, ‘edit’, ‘squash’, and
  4447. ‘fixup’ have not been applied yet. These words have the same
  4448. meaning here as they do in the buffer used to edit the rebase
  4449. sequence. See *note Editing Rebase Sequences::. When the
  4450. ‘--rebase-merges’ option was specified, ‘reset’, ‘label’, and
  4451. ‘merge’ lines may also be present.
  4452. • Commits prefixed with ‘done’ and ‘onto’ have already been applied.
  4453. It is possible for such a commit to be the ‘HEAD’, in which case it
  4454. is blue. Otherwise it is grey.
  4455. • The commit prefixed with ‘onto’ is the commit on top of which
  4456. all the other commits are being re-applied. This commit
  4457. itself did not have to be re-applied, it is the commit rebase
  4458. did rewind to before starting to re-apply other commits.
  4459. • Commits prefixed with ‘done’ have already been re-applied.
  4460. This includes commits that have been re-applied but also new
  4461. commits that you have created during the rebase.
  4462. • All other commits, those not prefixed with any of the above words,
  4463. are in some way related to the commit at which rebase stopped.
  4464. To determine whether a commit is related to the stopped-at commit
  4465. their hashes, trees and patch-ids (1) are being compared. The
  4466. commit message is not used for this purpose.
  4467. Generally speaking commits that are related to the stopped-at
  4468. commit can have any of the used colors, though not all color/word
  4469. combinations are possible.
  4470. Words used for stopped-at commits are:
  4471. • When a commit is prefixed with ‘void’, then that indicates
  4472. that Magit knows for sure that all the changes in that commit
  4473. have been applied using several new commits. This commit is
  4474. no longer reachable from ‘HEAD’, and it also isn’t one of the
  4475. commits that will be applied when resuming the session.
  4476. • When a commit is prefixed with ‘join’, then that indicates
  4477. that the rebase sequence stopped at that commit due to a
  4478. conflict - you now have to join (merge) the changes with what
  4479. has already been applied. In a sense this is the commit
  4480. rebase stopped at, but while its effect is already in the
  4481. index and in the worktree (with conflict markers), the commit
  4482. itself has not actually been applied yet (it isn’t the
  4483. ‘HEAD’). So it is shown in yellow, like the other commits
  4484. that still have to be applied.
  4485. • When a commit is prefixed with ‘stop’ or a _blue_ or _green_
  4486. ‘same’, then that indicates that rebase stopped at this
  4487. commit, that it is still applied or has been applied again,
  4488. and that at least its patch-id is unchanged.
  4489. • When a commit is prefixed with ‘stop’, then that
  4490. indicates that rebase stopped at that commit because you
  4491. requested that earlier, and its patch-id is unchanged.
  4492. It might even still be the exact same commit.
  4493. • When a commit is prefixed with a _blue_ or _green_
  4494. ‘same’, then that indicates that while its tree or hash
  4495. changed, its patch-id did not. If it is blue, then it is
  4496. the ‘HEAD’ commit (as always for blue). When it is
  4497. green, then it no longer is ‘HEAD’ because other commit
  4498. have been created since (but before continuing the
  4499. rebase).
  4500. • When a commit is prefixed with ‘goal’, a _yellow_ ‘same,’ or
  4501. ‘work’, then that indicates that rebase applied that commit
  4502. but that you then reset ‘HEAD’ to an earlier commit (likely to
  4503. split it up into multiple commits), and that there are some
  4504. uncommitted changes remaining which likely (but not
  4505. necessarily) originate from that commit.
  4506. • When a commit is prefixed with ‘goal’, then that
  4507. indicates that it is still possible to create a new
  4508. commit with the exact same tree (the "goal") without
  4509. manually editing any files, by committing the index, or
  4510. by staging all changes and then committing that. This is
  4511. the case when the original tree still exists in the index
  4512. or worktree in untainted form.
  4513. • When a commit is prefixed with a yellow ‘same’, then that
  4514. indicates that it is no longer possible to create a
  4515. commit with the exact same tree, but that it is still
  4516. possible to create a commit with the same patch-id. This
  4517. would be the case if you created a new commit with other
  4518. changes, but the changes from the original commit still
  4519. exist in the index or working tree in untainted form.
  4520. • When a commit is prefixed with ‘work’, then that
  4521. indicates that you reset ‘HEAD’ to an earlier commit, and
  4522. that there are some staged and/or unstaged changes
  4523. (likely, but not necessarily) originating from that
  4524. commit. However it is no longer possible to create a new
  4525. commit with the same tree or at least the same patch-id
  4526. because you have already made other changes.
  4527. • When a commit is prefixed with ‘poof’ or ‘gone’, then that
  4528. indicates that rebase applied that commit but that you then
  4529. reset ‘HEAD’ to an earlier commit (likely to split it up into
  4530. multiple commits), and that there are no uncommitted changes.
  4531. • When a commit is prefixed with ‘poof’, then that
  4532. indicates that it is no longer reachable from ‘HEAD’, but
  4533. that it has been replaced with one or more commits, which
  4534. together have the exact same effect.
  4535. • When a commit is prefixed with ‘gone’, then that
  4536. indicates that it is no longer reachable from ‘HEAD’ and
  4537. that we also cannot determine whether its changes are
  4538. still in effect in one or more new commits. They might
  4539. be, but if so, then there must also be other changes
  4540. which makes it impossible to know for sure.
  4541. Do not worry if you do not fully understand the above. That’s okay,
  4542. you will acquire a good enough understanding through practice.
  4543. For other sequence operations such as cherry-picking, a similar
  4544. section is displayed, but they lack some of the features described
  4545. above, due to limitations in the git commands used to implement them.
  4546. Most importantly these sequences only support "picking" a commit but not
  4547. other actions such as "rewording", and they do not keep track of the
  4548. commits which have already been applied.
  4549. ---------- Footnotes ----------
  4550. (1) The patch-id is a hash of the _changes_ introduced by a commit.
  4551. It differs from the hash of the commit itself, which is a hash of the
  4552. result of applying that change (i.e. the resulting trees and blobs) as
  4553. well as author and committer information, the commit message, and the
  4554. hashes of the parents of the commit. The patch-id hash on the other
  4555. hand is created only from the added and removed lines, even line numbers
  4556. and whitespace changes are ignored when calculating this hash. The
  4557. patch-ids of two commits can be used to answer the question "Do these
  4558. commits make the same change?".
  4559. 
  4560. File: magit.info, Node: Cherry Picking, Next: Resetting, Prev: Rebasing, Up: Manipulating
  4561. 6.10 Cherry Picking
  4562. ===================
  4563. Also see *note (gitman)git-cherry-pick::.
  4564. ‘A’ (‘magit-cherry-pick’)
  4565. This transient prefix command binds the following suffix commands
  4566. along with the appropriate infix arguments and displays them in a
  4567. temporary buffer until a suffix is invoked.
  4568. When no cherry-pick or revert is in progress, then the transient
  4569. features the following suffix commands.
  4570. ‘A A’ (‘magit-cherry-copy’)
  4571. This command copies COMMITS from another branch onto the current
  4572. branch. If the region selects multiple commits, then those are
  4573. copied, without prompting. Otherwise the user is prompted for a
  4574. commit or range, defaulting to the commit at point.
  4575. ‘A a’ (‘magit-cherry-apply’)
  4576. This command applies the changes in COMMITS from another branch
  4577. onto the current branch. If the region selects multiple commits,
  4578. then those are used, without prompting. Otherwise the user is
  4579. prompted for a commit or range, defaulting to the commit at point.
  4580. This command also has a top-level binding, which can be invoked
  4581. without using the transient by typing ‘a’ at the top-level.
  4582. The following commands not only apply some commits to some branch,
  4583. but also remove them from some other branch. The removal is performed
  4584. using either ‘git-update-ref’ or if necessary ‘git-rebase’. Both
  4585. applying commits as well as removing them using ‘git-rebase’ can lead to
  4586. conflicts. If that happens, then these commands abort and you not only
  4587. have to resolve the conflicts but also finish the process the same way
  4588. you would have to if these commands didn’t exist at all.
  4589. ‘A h’ (‘magit-cherry-harvest’)
  4590. This command moves the selected COMMITS that must be located on
  4591. another BRANCH onto the current branch instead, removing them from
  4592. the former. When this command succeeds, then the same branch is
  4593. current as before.
  4594. Applying the commits on the current branch or removing them from
  4595. the other branch can lead to conflicts. When that happens, then
  4596. this command stops and you have to resolve the conflicts and then
  4597. finish the process manually.
  4598. ‘A d’ (‘magit-cherry-donate’)
  4599. This command moves the selected COMMITS from the current branch
  4600. onto another existing BRANCH, removing them from the former. When
  4601. this command succeeds, then the same branch is current as before.
  4602. Applying the commits on the other branch or removing them from the
  4603. current branch can lead to conflicts. When that happens, then this
  4604. command stops and you have to resolve the conflicts and then finish
  4605. the process manually.
  4606. ‘A n’ (‘magit-cherry-spinout’)
  4607. This command moves the selected COMMITS from the current branch
  4608. onto a new branch BRANCH, removing them from the former. When this
  4609. command succeeds, then the same branch is current as before.
  4610. Applying the commits on the other branch or removing them from the
  4611. current branch can lead to conflicts. When that happens, then this
  4612. command stops and you have to resolve the conflicts and then finish
  4613. the process manually.
  4614. ‘A s’ (‘magit-cherry-spinoff’)
  4615. This command moves the selected COMMITS from the current branch
  4616. onto a new branch BRANCH, removing them from the former. When this
  4617. command succeeds, then the new branch is checked out.
  4618. Applying the commits on the other branch or removing them from the
  4619. current branch can lead to conflicts. When that happens, then this
  4620. command stops and you have to resolve the conflicts and then finish
  4621. the process manually.
  4622. When a cherry-pick or revert is in progress, then the transient
  4623. instead features the following suffix commands.
  4624. ‘A A’ (‘magit-sequence-continue’)
  4625. Resume the current cherry-pick or revert sequence.
  4626. ‘A s’ (‘magit-sequence-skip’)
  4627. Skip the stopped at commit during a cherry-pick or revert sequence.
  4628. ‘A a’ (‘magit-sequence-abort’)
  4629. Abort the current cherry-pick or revert sequence. This discards
  4630. all changes made since the sequence started.
  4631. * Menu:
  4632. * Reverting::
  4633. 
  4634. File: magit.info, Node: Reverting, Up: Cherry Picking
  4635. 6.10.1 Reverting
  4636. ----------------
  4637. ‘V’ (‘magit-revert’)
  4638. This transient prefix command binds the following suffix commands
  4639. along with the appropriate infix arguments and displays them in a
  4640. temporary buffer until a suffix is invoked.
  4641. When no cherry-pick or revert is in progress, then the transient
  4642. features the following suffix commands.
  4643. ‘V V’ (‘magit-revert-and-commit’)
  4644. Revert a commit by creating a new commit. Prompt for a commit,
  4645. defaulting to the commit at point. If the region selects multiple
  4646. commits, then revert all of them, without prompting.
  4647. ‘V v’ (‘magit-revert-no-commit’)
  4648. Revert a commit by applying it in reverse to the working tree.
  4649. Prompt for a commit, defaulting to the commit at point. If the
  4650. region selects multiple commits, then revert all of them, without
  4651. prompting.
  4652. When a cherry-pick or revert is in progress, then the transient
  4653. instead features the following suffix commands.
  4654. ‘V A’ (‘magit-sequence-continue’)
  4655. Resume the current cherry-pick or revert sequence.
  4656. ‘V s’ (‘magit-sequence-skip’)
  4657. Skip the stopped at commit during a cherry-pick or revert sequence.
  4658. ‘V a’ (‘magit-sequence-abort’)
  4659. Abort the current cherry-pick or revert sequence. This discards
  4660. all changes made since the sequence started.
  4661. 
  4662. File: magit.info, Node: Resetting, Next: Stashing, Prev: Cherry Picking, Up: Manipulating
  4663. 6.11 Resetting
  4664. ==============
  4665. Also see *note (gitman)git-reset::.
  4666. ‘x’ (‘magit-reset-quickly’)
  4667. Reset the ‘HEAD’ and index to some commit read from the user and
  4668. defaulting to the commit at point, and possibly also reset the
  4669. working tree. With a prefix argument reset the working tree
  4670. otherwise don’t.
  4671. ‘X m’ (‘magit-reset-mixed’)
  4672. Reset the ‘HEAD’ and index to some commit read from the user and
  4673. defaulting to the commit at point. The working tree is kept as-is.
  4674. ‘X s’ (‘magit-reset-soft’)
  4675. Reset the ‘HEAD’ to some commit read from the user and defaulting
  4676. to the commit at point. The index and the working tree are kept
  4677. as-is.
  4678. ‘X h’ (‘magit-reset-hard’)
  4679. Reset the ‘HEAD’, index, and working tree to some commit read from
  4680. the user and defaulting to the commit at point.
  4681. ‘X i’ (‘magit-reset-index’)
  4682. Reset the index to some commit read from the user and defaulting to
  4683. the commit at point. Keep the ‘HEAD’ and working tree as-is, so if
  4684. the commit refers to the ‘HEAD’, then this effectively unstages all
  4685. changes.
  4686. ‘X w’ (‘magit-reset-worktree’)
  4687. Reset the working tree to some commit read from the user and
  4688. defaulting to the commit at point. Keep the ‘HEAD’ and index
  4689. as-is.
  4690. ‘X f’ (‘magit-file-checkout’)
  4691. Update file in the working tree and index to the contents from a
  4692. revision. Both the revision and file are read from the user.
  4693. 
  4694. File: magit.info, Node: Stashing, Prev: Resetting, Up: Manipulating
  4695. 6.12 Stashing
  4696. =============
  4697. Also see *note (gitman)git-stash::.
  4698. ‘z’ (‘magit-stash’)
  4699. This transient prefix command binds the following suffix commands
  4700. along with the appropriate infix arguments and displays them in a
  4701. temporary buffer until a suffix is invoked.
  4702. ‘z z’ (‘magit-stash-both’)
  4703. Create a stash of the index and working tree. Untracked files are
  4704. included according to infix arguments. One prefix argument is
  4705. equivalent to ‘--include-untracked’ while two prefix arguments are
  4706. equivalent to ‘--all’.
  4707. ‘z i’ (‘magit-stash-index’)
  4708. Create a stash of the index only. Unstaged and untracked changes
  4709. are not stashed.
  4710. ‘z w’ (‘magit-stash-worktree’)
  4711. Create a stash of unstaged changes in the working tree. Untracked
  4712. files are included according to infix arguments. One prefix
  4713. argument is equivalent to ‘--include-untracked’ while two prefix
  4714. arguments are equivalent to ‘--all’.
  4715. ‘z x’ (‘magit-stash-keep-index’)
  4716. Create a stash of the index and working tree, keeping index intact.
  4717. Untracked files are included according to infix arguments. One
  4718. prefix argument is equivalent to ‘--include-untracked’ while two
  4719. prefix arguments are equivalent to ‘--all’.
  4720. ‘z Z’ (‘magit-snapshot-both’)
  4721. Create a snapshot of the index and working tree. Untracked files
  4722. are included according to infix arguments. One prefix argument is
  4723. equivalent to ‘--include-untracked’ while two prefix arguments are
  4724. equivalent to ‘--all’.
  4725. ‘z I’ (‘magit-snapshot-index’)
  4726. Create a snapshot of the index only. Unstaged and untracked
  4727. changes are not stashed.
  4728. ‘z W’ (‘magit-snapshot-worktree’)
  4729. Create a snapshot of unstaged changes in the working tree.
  4730. Untracked files are included according to infix arguments. One
  4731. prefix argument is equivalent to ‘--include-untracked’ while two
  4732. prefix arguments are equivalent to ‘--all’-.
  4733. ‘z a’ (‘magit-stash-apply’)
  4734. Apply a stash to the working tree. Try to preserve the stash
  4735. index. If that fails because there are staged changes, apply
  4736. without preserving the stash index.
  4737. ‘z p’ (‘magit-stash-pop’)
  4738. Apply a stash to the working tree and remove it from stash list.
  4739. Try to preserve the stash index. If that fails because there are
  4740. staged changes, apply without preserving the stash index and forgo
  4741. removing the stash.
  4742. ‘z k’ (‘magit-stash-drop’)
  4743. Remove a stash from the stash list. When the region is active,
  4744. offer to drop all contained stashes.
  4745. ‘z v’ (‘magit-stash-show’)
  4746. Show all diffs of a stash in a buffer.
  4747. ‘z b’ (‘magit-stash-branch’)
  4748. Create and checkout a new BRANCH from STASH. The branch starts at
  4749. the commit that was current when the stash was created.
  4750. ‘z B’ (‘magit-stash-branch-here’)
  4751. Create and checkout a new BRANCH using ‘magit-branch’ with the
  4752. current branch or ‘HEAD’ as the starting-point. Then apply STASH,
  4753. dropping it if it applies cleanly.
  4754. ‘z f’ (‘magit-stash-format-patch’)
  4755. Create a patch from STASH.
  4756. ‘k’ (‘magit-stash-clear’)
  4757. Remove all stashes saved in REF’s reflog by deleting REF.
  4758. ‘z l’ (‘magit-stash-list’)
  4759. List all stashes in a buffer.
  4760. -- User Option: magit-stashes-margin
  4761. This option specifies whether the margin is initially shown in
  4762. stashes buffers and how it is formatted.
  4763. The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
  4764. • If INIT is non-nil, then the margin is shown initially.
  4765. • STYLE controls how to format the committer date. It can be
  4766. one of ‘age’ (to show the age of the commit),
  4767. ‘age-abbreviated’ (to abbreviate the time unit to a
  4768. character), or a string (suitable for ‘format-time-string’) to
  4769. show the actual date.
  4770. • WIDTH controls the width of the margin. This exists for
  4771. forward compatibility and currently the value should not be
  4772. changed.
  4773. • AUTHOR controls whether the name of the author is also shown
  4774. by default.
  4775. • AUTHOR-WIDTH has to be an integer. When the name of the
  4776. author is shown, then this specifies how much space is used to
  4777. do so.
  4778. 
  4779. File: magit.info, Node: Transferring, Next: Miscellaneous, Prev: Manipulating, Up: Top
  4780. 7 Transferring
  4781. **************
  4782. * Menu:
  4783. * Remotes::
  4784. * Fetching::
  4785. * Pulling::
  4786. * Pushing::
  4787. * Plain Patches::
  4788. * Maildir Patches::
  4789. 
  4790. File: magit.info, Node: Remotes, Next: Fetching, Up: Transferring
  4791. 7.1 Remotes
  4792. ===========
  4793. * Menu:
  4794. * Remote Commands::
  4795. * Remote Git Variables::
  4796. 
  4797. File: magit.info, Node: Remote Commands, Next: Remote Git Variables, Up: Remotes
  4798. 7.1.1 Remote Commands
  4799. ---------------------
  4800. The transient prefix command ‘magit-remote’ is used to add remotes and
  4801. to make changes to existing remotes. This command only deals with
  4802. remotes themselves, not with branches or the transfer of commits. Those
  4803. features are available from separate transient commands.
  4804. Also see *note (gitman)git-remote::.
  4805. ‘M’ (‘magit-remote’)
  4806. This transient prefix command binds the following suffix commands
  4807. and displays them in a temporary buffer until a suffix is invoked.
  4808. By default it also binds and displays the values of some
  4809. remote-related Git variables and allows changing their values.
  4810. -- User Option: magit-remote-direct-configure
  4811. This option controls whether remote-related Git variables are
  4812. accessible directly from the transient ‘magit-remote’.
  4813. If ‘t’ (the default) and a local branch is checked out, then
  4814. ‘magit-remote’ features the variables for the upstream remote of
  4815. that branch, or if ‘HEAD’ is detached, for ‘origin’, provided that
  4816. exists.
  4817. If ‘nil’, then ‘magit-remote-configure’ has to be used to do so.
  4818. ‘M C’ (‘magit-remote-configure’)
  4819. This transient prefix command binds commands that set the value of
  4820. remote-related variables and displays them in a temporary buffer
  4821. until the transient is exited.
  4822. With a prefix argument, this command always prompts for a remote.
  4823. Without a prefix argument this depends on whether it was invoked as
  4824. a suffix of ‘magit-remote’ and on the
  4825. ‘magit-remote-direct-configure’ option. If ‘magit-remote’ already
  4826. displays the variables for the upstream, then it does not make
  4827. sense to invoke another transient that displays them for the same
  4828. remote. In that case this command prompts for a remote.
  4829. The variables are described in *note Remote Git Variables::.
  4830. ‘M a’ (‘magit-remote-add’)
  4831. This command add a remote and fetches it. The remote name and url
  4832. are read in the minibuffer.
  4833. ‘M r’ (‘magit-remote-rename’)
  4834. This command renames a remote. Both the old and the new names are
  4835. read in the minibuffer.
  4836. ‘M u’ (‘magit-remote-set-url’)
  4837. This command changes the url of a remote. Both the remote and the
  4838. new url are read in the minibuffer.
  4839. ‘M k’ (‘magit-remote-remove’)
  4840. This command deletes a remote, read in the minibuffer.
  4841. ‘M p’ (‘magit-remote-prune’)
  4842. This command removes stale remote-tracking branches for a remote
  4843. read in the minibuffer.
  4844. ‘M P’ (‘magit-remote-prune-refspecs’)
  4845. This command removes stale refspecs for a remote read in the
  4846. minibuffer.
  4847. A refspec is stale if there no longer exists at least one branch on
  4848. the remote that would be fetched due to that refspec. A stale
  4849. refspec is problematic because its existence causes Git to refuse
  4850. to fetch according to the remaining non-stale refspecs.
  4851. If only stale refspecs remain, then this command offers to either
  4852. delete the remote or to replace the stale refspecs with the default
  4853. refspec ("+refs/heads/*:refs/remotes/REMOTE/*").
  4854. This command also removes the remote-tracking branches that were
  4855. created due to the now stale refspecs. Other stale branches are
  4856. not removed.
  4857. -- User Option: magit-remote-add-set-remote.pushDefault
  4858. This option controls whether the user is asked whether they want to
  4859. set ‘remote.pushDefault’ after adding a remote.
  4860. If ‘ask’, then users is always ask. If ‘ask-if-unset’, then the
  4861. user is only if the variable isn’t set already. If ‘nil’, then the
  4862. user isn’t asked and the variable isn’t set. If the value is a
  4863. string, then the variable is set without the user being asked,
  4864. provided that the name of the added remote is equal to that string
  4865. and the variable isn’t already set.
  4866. 
  4867. File: magit.info, Node: Remote Git Variables, Prev: Remote Commands, Up: Remotes
  4868. 7.1.2 Remote Git Variables
  4869. --------------------------
  4870. These variables can be set from the transient prefix command
  4871. ‘magit-remote-configure’. By default they can also be set from
  4872. ‘magit-remote’. See *note Remote Commands::.
  4873. -- Variable: remote.NAME.url
  4874. This variable specifies the url of the remote named NAME. It can
  4875. have multiple values.
  4876. -- Variable: remote.NAME.fetch
  4877. The refspec used when fetching from the remote named NAME. It can
  4878. have multiple values.
  4879. -- Variable: remote.NAME.pushurl
  4880. This variable specifies the url used for fetching from the remote
  4881. named NAME. If it is not specified, then ‘remote.NAME.url’ is used
  4882. instead. It can have multiple values.
  4883. -- Variable: remote.NAME.push
  4884. The refspec used when pushing to the remote named NAME. It can
  4885. have multiple values.
  4886. -- Variable: remote.NAME.tagOpts
  4887. This variable specifies what tags are fetched by default. If the
  4888. value is ‘--no-tags’ then no tags are fetched. If the value is
  4889. ‘--tags’, then all tags are fetched. If this variable has no
  4890. value, then only tags are fetched that are reachable from fetched
  4891. branches.
  4892. -- User Option: magit-remote-set-if-missing
  4893. This option controls whether missing remotes are configured before
  4894. fetching, pulling, pushing and rebasing.
  4895. When ‘nil’, then commands such as ‘magit-pull-from-upstream’ and
  4896. ‘magit-rebase-onto-uptream’ are not available as suffix commands if
  4897. the push-remote or upstream is not configured.
  4898. When ‘non-nil’, then these commands are always available in their
  4899. respective transient, but if the required configuration is missing,
  4900. then they do appear in a way that indicates that this is the case.
  4901. If the user invokes such a command, then it asks for the necessary
  4902. configuration, stores the configuration, and only then performs the
  4903. action.
  4904. This option also affects whether the argument ‘--set-upstream’ is
  4905. available in ‘magit-push’. If the value is ‘non-nil’, then that
  4906. argument would be redundant. But note that changing the value of
  4907. this option does not take affect immediately, the argument will
  4908. only be added or removed after restarting Emacs.
  4909. 
  4910. File: magit.info, Node: Fetching, Next: Pulling, Prev: Remotes, Up: Transferring
  4911. 7.2 Fetching
  4912. ============
  4913. Also see *note (gitman)git-fetch::. For information about the upstream
  4914. and the push-remote, see *note The Two Remotes::.
  4915. ‘f’ (‘magit-fetch’)
  4916. This transient prefix command binds the following suffix commands
  4917. along with the appropriate infix arguments and displays them in a
  4918. temporary buffer until a suffix is invoked.
  4919. ‘f p’ (‘magit-fetch-from-pushremote’)
  4920. This command fetches from the push-remote of the current branch.
  4921. When ‘magit-remote-set-if-missing’ is non-nil and the push-remote
  4922. is not configured, then configure it before fetching. With a
  4923. prefix argument let the user change the push-remote before fetching
  4924. from it.
  4925. ‘f u’ (‘magit-fetch-from-upstream’)
  4926. This command fetch from the upstream of the current branch.
  4927. When ‘magit-remote-set-if-missing’ is non-nil and the upstream is
  4928. not configured, then configure it before fetching. With a prefix
  4929. argument let the user change the upstream before fetching from it.
  4930. ‘f e’ (‘magit-fetch-other’)
  4931. This command fetch from a repository read from the minibuffer.
  4932. ‘f o’ (‘magit-fetch-branch’)
  4933. This command fetches a branch from a remote, both of which are read
  4934. from the minibuffer.
  4935. ‘f r’ (‘magit-fetch-refspec’)
  4936. This command fetches from a remote using an explicit refspec, both
  4937. of which are read from the minibuffer.
  4938. ‘f a’ (‘magit-fetch-all’)
  4939. This command fetches from all remotes.
  4940. ‘f m’ (‘magit-submodule-fetch’)
  4941. This command fetches all submodules. With a prefix argument it
  4942. fetches all remotes of all submodules.
  4943. -- User Option: magit-pull-or-fetch
  4944. By default fetch and pull commands are available from separate
  4945. transient prefix command. Setting this to ‘t’ adds some (but not
  4946. all) of the above suffix commands to the ‘magit-pull’ transient.
  4947. If you do that, then you might also want to change the key binding
  4948. for these prefix commands, e.g.:
  4949. (setq magit-pull-or-fetch t)
  4950. (define-key magit-mode-map "f" 'magit-pull) ; was magit-fetch
  4951. (define-key magit-mode-map "F" nil) ; was magit-pull
  4952. 
  4953. File: magit.info, Node: Pulling, Next: Pushing, Prev: Fetching, Up: Transferring
  4954. 7.3 Pulling
  4955. ===========
  4956. Also see *note (gitman)git-pull::. For information about the upstream
  4957. and the push-remote, see *note The Two Remotes::.
  4958. ‘F’ (‘magit-pull’)
  4959. This transient prefix command binds the following suffix commands
  4960. and displays them in a temporary buffer until a suffix is invoked.
  4961. ‘F p’ (‘magit-pull-from-pushremote’)
  4962. This command pulls from the push-remote of the current branch.
  4963. When ‘magit-remote-set-if-missing’ is non-nil and the push-remote
  4964. is not configured, then configure it before pulling. With a prefix
  4965. argument let the user change the push-remote before pulling from
  4966. it.
  4967. ‘F u’ (‘magit-pull-from-upstream’)
  4968. This command pulls from the upstream of the current branch.
  4969. When ‘magit-remote-set-if-missing’ is non-nil and the upstream is
  4970. not configured, then configure it before pulling. With a prefix
  4971. argument let the user change the upstream before pulling from it.
  4972. ‘F e’ (‘magit-pull-branch’)
  4973. This command pulls from a branch read in the minibuffer.
  4974. 
  4975. File: magit.info, Node: Pushing, Next: Plain Patches, Prev: Pulling, Up: Transferring
  4976. 7.4 Pushing
  4977. ===========
  4978. Also see *note (gitman)git-push::. For information about the upstream
  4979. and the push-remote, see *note The Two Remotes::.
  4980. ‘P’ (‘magit-push’)
  4981. This transient prefix command binds the following suffix commands
  4982. along with the appropriate infix arguments and displays them in a
  4983. temporary buffer until a suffix is invoked.
  4984. ‘P p’ (‘magit-push-current-to-pushremote’)
  4985. This command pushes the current branch to its push-remote.
  4986. When ‘magit-remote-set-if-missing’ is non-nil and the push-remote
  4987. is not configured, then configure it before pushing. With a prefix
  4988. argument let the user change the push-remote before pushing to it.
  4989. ‘P u’ (‘magit-push-current-to-upstream’)
  4990. This command pushes the current branch to its upstream branch.
  4991. When ‘magit-remote-set-if-missing’ is non-nil and the upstream is
  4992. not configured, then configure it before pushing. With a prefix
  4993. argument let the user change the upstream before pushing to it.
  4994. ‘P e’ (‘magit-push-current’)
  4995. This command pushes the current branch to a branch read in the
  4996. minibuffer.
  4997. ‘P o’ (‘magit-push-other’)
  4998. This command pushes an arbitrary branch or commit somewhere. Both
  4999. the source and the target are read in the minibuffer.
  5000. ‘P r’ (‘magit-push-refspecs’)
  5001. This command pushes one or multiple refspecs to a remote, both of
  5002. which are read in the minibuffer.
  5003. To use multiple refspecs, separate them with commas. Completion is
  5004. only available for the part before the colon, or when no colon is
  5005. used.
  5006. ‘P m’ (‘magit-push-matching’)
  5007. This command pushes all matching branches to another repository.
  5008. If only one remote exists, then push to that. Otherwise prompt for
  5009. a remote, offering the remote configured for the current branch as
  5010. default.
  5011. ‘P t’ (‘magit-push-tags’)
  5012. This command pushes all tags to another repository.
  5013. If only one remote exists, then push to that. Otherwise prompt for
  5014. a remote, offering the remote configured for the current branch as
  5015. default.
  5016. ‘P T’ (‘magit-push-tag’)
  5017. This command pushes a tag to another repository.
  5018. Two more push commands exist, which by default are not available from
  5019. the push transient. See their doc-strings for instructions on how to
  5020. add them to the transient.
  5021. -- Command: magit-push-implicitly args
  5022. This command pushes somewhere without using an explicit refspec.
  5023. This command simply runs ‘git push -v [ARGS]’. ARGS are the infix
  5024. arguments. No explicit refspec arguments are used. Instead the
  5025. behavior depends on at least these Git variables: ‘push.default’,
  5026. ‘remote.pushDefault’, ‘branch.<branch>.pushRemote’,
  5027. ‘branch.<branch>.remote’, ‘branch.<branch>.merge’, and
  5028. ‘remote.<remote>.push’.
  5029. -- Command: magit-push-to-remote remote args
  5030. This command pushes to the remote REMOTE without using an explicit
  5031. refspec. The remote is read in the minibuffer.
  5032. This command simply runs ‘git push -v [ARGS] REMOTE’. ARGS are the
  5033. infix arguments. No refspec arguments are used. Instead the
  5034. behavior depends on at least these Git variables: ‘push.default’,
  5035. ‘remote.pushDefault’, ‘branch.<branch>.pushRemote’,
  5036. ‘branch.<branch>.remote’, ‘branch.<branch>.merge’, and
  5037. ‘remote.<remote>.push’.
  5038. 
  5039. File: magit.info, Node: Plain Patches, Next: Maildir Patches, Prev: Pushing, Up: Transferring
  5040. 7.5 Plain Patches
  5041. =================
  5042. ‘W’ (‘magit-patch’)
  5043. This transient prefix command binds the following suffix commands
  5044. along with the appropriate infix arguments and displays them in a
  5045. temporary buffer until a suffix is invoked.
  5046. ‘W c’ (‘magit-patch-create’)
  5047. This command creates patches for a set commits. If the region
  5048. marks several commits, then it creates patches for all of them.
  5049. Otherwise it functions as a transient prefix command, which
  5050. features several infix arguments and binds itself as a suffix
  5051. command. When this command is invoked as a suffix of itself, then
  5052. it creates a patch using the specified infix arguments.
  5053. ‘w a’ (‘magit-patch-apply’)
  5054. This command applies a patch. This is a transient prefix command,
  5055. which features several infix arguments and binds itself as a suffix
  5056. command. When this command is invoked as a suffix of itself, then
  5057. it applies a patch using the specified infix arguments.
  5058. ‘W s’ (‘magit-patch-save’)
  5059. This command creates a patch from the current diff.
  5060. Inside ‘magit-diff-mode’ or ‘magit-revision-mode’ buffers, ‘C-x
  5061. C-w’ is also bound to this command.
  5062. FIXME It is also possible to save a plain patch file by using ‘C-x
  5063. C-w’ inside a ‘magit-diff-mode’ or ‘magit-revision-mode’ buffer.
  5064. 
  5065. File: magit.info, Node: Maildir Patches, Prev: Plain Patches, Up: Transferring
  5066. 7.6 Maildir Patches
  5067. ===================
  5068. Also see *note (gitman)git-am::. and *note (gitman)git-apply::.
  5069. ‘w’ (‘magit-am’)
  5070. This transient prefix command binds the following suffix commands
  5071. along with the appropriate infix arguments and displays them in a
  5072. temporary buffer until a suffix is invoked.
  5073. ‘w w’ (‘magit-am-apply-patches’)
  5074. This command applies one or more patches. If the region marks
  5075. files, then those are applied as patches. Otherwise this command
  5076. reads a file-name in the minibuffer, defaulting to the file at
  5077. point.
  5078. ‘w m’ (‘magit-am-apply-maildir’)
  5079. This command applies patches from a maildir.
  5080. ‘w a’ (‘magit-patch-apply’)
  5081. This command applies a plain patch. For a longer description see
  5082. *note Plain Patches::. This command is only available from the
  5083. ‘magit-am’ transient for historic reasons.
  5084. When an "am" operation is in progress, then the transient instead
  5085. features the following suffix commands.
  5086. ‘w w’ (‘magit-am-continue’)
  5087. This command resumes the current patch applying sequence.
  5088. ‘w s’ (‘magit-am-skip’)
  5089. This command skips the stopped at patch during a patch applying
  5090. sequence.
  5091. ‘w a’ (‘magit-am-abort’)
  5092. This command aborts the current patch applying sequence. This
  5093. discards all changes made since the sequence started.
  5094. 
  5095. File: magit.info, Node: Miscellaneous, Next: Customizing, Prev: Transferring, Up: Top
  5096. 8 Miscellaneous
  5097. ***************
  5098. * Menu:
  5099. * Tagging::
  5100. * Notes::
  5101. * Submodules::
  5102. * Subtree::
  5103. * Worktree::
  5104. * Common Commands::
  5105. * Wip Modes::
  5106. * Minor Mode for Buffers Visiting Files::
  5107. * Minor Mode for Buffers Visiting Blobs::
  5108. 
  5109. File: magit.info, Node: Tagging, Next: Notes, Up: Miscellaneous
  5110. 8.1 Tagging
  5111. ===========
  5112. Also see *note (gitman)git-tag::.
  5113. ‘t’ (‘magit-tag’)
  5114. This transient prefix command binds the following suffix commands
  5115. along with the appropriate infix arguments and displays them in a
  5116. temporary buffer until a suffix is invoked.
  5117. ‘t t’ (‘magit-tag-create’)
  5118. This command creates a new tag with the given NAME at REV. With a
  5119. prefix argument it creates an annotate tag.
  5120. ‘t r’ (‘magit-tag-release’)
  5121. This commands creates an annotated release tag. It assumes that
  5122. release tags match ‘magit-release-tag-regexp’.
  5123. First it prompts for the name of the new tag using the highest
  5124. existing tag as initial input and leaving it to the user to
  5125. increment the desired part of the version string.
  5126. Then it prompts for the message of the new tag. The proposed tag
  5127. message is based on the message of the highest tag, provided that
  5128. that contains the corresponding version string and substituting the
  5129. new version string for that. Otherwise it proposes something like
  5130. "Foo-Bar 1.2.3", given, for example, a TAG "v1.2.3" and a
  5131. repository located at something like "/path/to/foo-bar".
  5132. Then it calls "git tag –annotate –sign -m MSG TAG" to create the
  5133. tag, regardless of whether these arguments are enabled in the
  5134. transient. Finally it shows the refs buffer to let the user
  5135. quickly review the result.
  5136. ‘t k’ (‘magit-tag-delete’)
  5137. This command deletes one or more tags. If the region marks
  5138. multiple tags (and nothing else), then it offers to delete those.
  5139. Otherwise, it prompts for a single tag to be deleted, defaulting to
  5140. the tag at point.
  5141. ‘t p’ (‘magit-tag-prune’)
  5142. This command offers to delete tags missing locally from REMOTE, and
  5143. vice versa.
  5144. 
  5145. File: magit.info, Node: Notes, Next: Submodules, Prev: Tagging, Up: Miscellaneous
  5146. 8.2 Notes
  5147. =========
  5148. Also see *note (gitman)git-notes::.
  5149. ‘T’ (‘magit-notes’)
  5150. This transient prefix command binds the following suffix commands
  5151. along with the appropriate infix arguments and displays them in a
  5152. temporary buffer until a suffix is invoked.
  5153. ‘T T’ (‘magit-notes-edit’)
  5154. Edit the note attached to a commit, defaulting to the commit at
  5155. point.
  5156. By default use the value of Git variable ‘core.notesRef’ or
  5157. "refs/notes/commits" if that is undefined.
  5158. ‘T r’ (‘magit-notes-remove’)
  5159. Remove the note attached to a commit, defaulting to the commit at
  5160. point.
  5161. By default use the value of Git variable ‘core.notesRef’ or
  5162. "refs/notes/commits" if that is undefined.
  5163. ‘T p’ (‘magit-notes-prune’)
  5164. Remove notes about unreachable commits.
  5165. It is possible to merge one note ref into another. That may result
  5166. in conflicts which have to resolved in the temporary worktree
  5167. ".git/NOTES_MERGE_WORKTREE".
  5168. ‘T m’ (‘magit-notes-merge’)
  5169. Merge the notes of a ref read from the user into the current notes
  5170. ref. The current notes ref is the value of Git variable
  5171. ‘core.notesRef’ or "refs/notes/commits" if that is undefined.
  5172. When a notes merge is in progress then the transient features the
  5173. following suffix commands, instead of those listed above.
  5174. ‘T c’ (‘magit-notes-merge-commit’)
  5175. Commit the current notes ref merge, after manually resolving
  5176. conflicts.
  5177. ‘T a’ (‘magit-notes-merge-abort’)
  5178. Abort the current notes ref merge.
  5179. The following variables control what notes reference ‘magit-notes-*’,
  5180. ‘git notes’ and ‘git show’ act on and display. Both the local and
  5181. global values are displayed and can be modified.
  5182. -- Variable: core.notesRef
  5183. This variable specifies the notes ref that is displayed by default
  5184. and which commands act on by default.
  5185. -- Variable: notes.displayRef
  5186. This variable specifies additional notes ref to be displayed in
  5187. addition to the ref specified by ‘core.notesRef’. It can have
  5188. multiple values and may end with ‘*’ to display all refs in the
  5189. ‘refs/notes/’ namespace (or ‘**’ if some names contain slashes).
  5190. 
  5191. File: magit.info, Node: Submodules, Next: Subtree, Prev: Notes, Up: Miscellaneous
  5192. 8.3 Submodules
  5193. ==============
  5194. Also see *note (gitman)git-submodule::.
  5195. * Menu:
  5196. * Listing Submodules::
  5197. * Submodule Transient::
  5198. 
  5199. File: magit.info, Node: Listing Submodules, Next: Submodule Transient, Up: Submodules
  5200. 8.3.1 Listing Submodules
  5201. ------------------------
  5202. The command ‘magit-list-submodules’ displays a list of the current
  5203. repository’s submodules in a separate buffer. It’s also possible to
  5204. display information about submodules directly in the status buffer of
  5205. the super-repository by adding ‘magit-insert-submodules’ to the hook
  5206. ‘magit-status-sections-hook’ as described in *note Status Module
  5207. Sections::.
  5208. -- Command: magit-list-submodules
  5209. This command displays a list of the current repository’s submodules
  5210. in a separate buffer.
  5211. It can be invoked by pressing ‘RET’ on the section titled
  5212. "Modules".
  5213. -- User Option: magit-submodule-list-columns
  5214. This option controls what columns are displayed by the command
  5215. ‘magit-list-submodules’ and how they are displayed.
  5216. Each element has the form ‘(HEADER WIDTH FORMAT PROPS)’.
  5217. HEADER is the string displayed in the header. WIDTH is the width
  5218. of the column. FORMAT is a function that is called with one
  5219. argument, the repository identification (usually its basename), and
  5220. with ‘default-directory’ bound to the toplevel of its working tree.
  5221. It has to return a string to be inserted or nil. PROPS is an alist
  5222. that supports the keys ‘:right-align’ and ‘:pad-right’.
  5223. -- Function: magit-insert-submodules
  5224. Insert sections for all submodules. For each section insert the
  5225. path, the branch, and the output of ‘git describe --tags’, or,
  5226. failing that, the abbreviated HEAD commit hash.
  5227. Press ‘RET’ on such a submodule section to show its own status
  5228. buffer. Press ‘RET’ on the "Modules" section to display a list of
  5229. submodules in a separate buffer. This shows additional information
  5230. not displayed in the super-repository’s status buffer.
  5231. 
  5232. File: magit.info, Node: Submodule Transient, Prev: Listing Submodules, Up: Submodules
  5233. 8.3.2 Submodule Transient
  5234. -------------------------
  5235. ‘o’ (‘magit-submodule’)
  5236. This transient prefix command binds the following suffix commands
  5237. along with the appropriate infix arguments and displays them in a
  5238. temporary buffer until a suffix is invoked.
  5239. Some of the below commands default to act on the modules that are
  5240. selected using the region. For brevity their description talk about
  5241. "the selected modules", but if no modules are selected, then they act on
  5242. the current module instead, or if point isn’t on a module, then the read
  5243. a single module to act on. With a prefix argument these commands ignore
  5244. the selection and the current module and instead act on all suitable
  5245. modules.
  5246. ‘o a’ (‘magit-submodule-add’)
  5247. This commands adds the repository at URL as a module. Optional
  5248. PATH is the path to the module relative to the root of the
  5249. super-project. If it is nil then the path is determined based on
  5250. URL.
  5251. ‘o r’ (‘magit-submodule-register’)
  5252. This command registers the selected modules by copying their urls
  5253. from ".gitmodules" to "$GIT_DIR/config". These values can then be
  5254. edited before running ‘magit-submodule-populate’. If you don’t
  5255. need to edit any urls, then use the latter directly.
  5256. ‘o p’ (‘magit-submodule-populate’)
  5257. This command creates the working directory or directories of the
  5258. selected modules, checking out the recorded commits.
  5259. ‘o u’ (‘magit-submodule-update’)
  5260. This command updates the selected modules checking out the recorded
  5261. commits.
  5262. ‘o s’ (‘magit-submodule-synchronize’)
  5263. This command synchronizes the urls of the selected modules, copying
  5264. the values from ".gitmodules" to the ".git/config" of the
  5265. super-project as well those of the modules.
  5266. ‘o d’ (‘magit-submodule-unpopulate’)
  5267. This command removes the working directory of the selected modules.
  5268. ‘o l’ (‘magit-list-submodules’)
  5269. This command displays a list of the current repository’s modules.
  5270. ‘o f’ (‘magit-fetch-modules’)
  5271. This command fetches all modules.
  5272. Option ‘magit-fetch-modules-jobs’ controls how many submodules are
  5273. being fetched in parallel. Also fetch the super-repository,
  5274. because ‘git fetch’ does not support not doing that. With a prefix
  5275. argument fetch all remotes.
  5276. 
  5277. File: magit.info, Node: Subtree, Next: Worktree, Prev: Submodules, Up: Miscellaneous
  5278. 8.4 Subtree
  5279. ===========
  5280. Also see *note (gitman)git-subtree::.
  5281. ‘O’ (‘magit-subtree’)
  5282. This transient prefix command binds the two sub-transients; one for
  5283. importing a subtree and one for exporting a subtree.
  5284. ‘O i’ (‘magit-subtree-import’)
  5285. This transient prefix command binds the following suffix commands
  5286. along with the appropriate infix arguments and displays them in a
  5287. temporary buffer until a suffix is invoked.
  5288. The suffixes of this command import subtrees.
  5289. If the ‘--prefix’ argument is set, then the suffix commands use
  5290. that prefix without prompting the user. If it is unset, then they
  5291. read the prefix in the minibuffer.
  5292. ‘O i a’ (‘magit-subtree-add’)
  5293. This command adds COMMIT from REPOSITORY as a new subtree at
  5294. PREFIX.
  5295. ‘O i c’ (‘magit-subtree-add-commit’)
  5296. This command add COMMIT as a new subtree at PREFIX.
  5297. ‘O i m’ (‘magit-subtree-merge’)
  5298. This command merges COMMIT into the PREFIX subtree.
  5299. ‘O i f’ (‘magit-subtree-pull’)
  5300. This command pulls COMMIT from REPOSITORY into the PREFIX subtree.
  5301. ‘O e’ (‘magit-subtree-export’)
  5302. This transient prefix command binds the following suffix commands
  5303. along with the appropriate infix arguments and displays them in a
  5304. temporary buffer until a suffix is invoked.
  5305. The suffixes of this command export subtrees.
  5306. If the ‘--prefix’ argument is set, then the suffix commands use
  5307. that prefix without prompting the user. If it is unset, then they
  5308. read the prefix in the minibuffer.
  5309. ‘O e p’ (‘magit-subtree-push’)
  5310. This command extract the history of the subtree PREFIX and pushes
  5311. it to REF on REPOSITORY.
  5312. ‘O e s’ (‘magit-subtree-split’)
  5313. This command extracts the history of the subtree PREFIX.
  5314. 
  5315. File: magit.info, Node: Worktree, Next: Common Commands, Prev: Subtree, Up: Miscellaneous
  5316. 8.5 Worktree
  5317. ============
  5318. Also see *note (gitman)git-worktree::.
  5319. ‘%’ (‘magit-worktree’)
  5320. This transient prefix command binds the following suffix commands
  5321. and displays them in a temporary buffer until a suffix is invoked.
  5322. ‘% b’ (‘magit-worktree-checkout’)
  5323. Checkout BRANCH in a new worktree at PATH.
  5324. ‘% c’ (‘magit-worktree-branch’)
  5325. Create a new BRANCH and check it out in a new worktree at PATH.
  5326. ‘% k’ (‘magit-worktree-delete’)
  5327. Delete a worktree, defaulting to the worktree at point. The
  5328. primary worktree cannot be deleted.
  5329. ‘% g’ (‘magit-worktree-status’)
  5330. Show the status for the worktree at point.
  5331. If there is no worktree at point, then read one in the minibuffer.
  5332. If the worktree at point is the one whose status is already being
  5333. displayed in the current buffer, then show it in Dired instead.
  5334. 
  5335. File: magit.info, Node: Common Commands, Next: Wip Modes, Prev: Worktree, Up: Miscellaneous
  5336. 8.6 Common Commands
  5337. ===================
  5338. These are some of the commands that can be used in all buffers whose
  5339. major-modes derive from ‘magit-mode’. There are other common commands
  5340. beside the ones below, but these didn’t fit well anywhere else.
  5341. ‘M-w’ (‘magit-copy-section-value’)
  5342. This command saves the value of the current section to the
  5343. ‘kill-ring’, and, provided that the current section is a commit,
  5344. branch, or tag section, it also pushes the (referenced) revision to
  5345. the ‘magit-revision-stack’.
  5346. When the current section is a branch or a tag, and a prefix
  5347. argument is used, then it saves the revision at its tip to the
  5348. ‘kill-ring’ instead of the reference name.
  5349. When the region is active, this command saves that to the
  5350. ‘kill-ring’, like ‘kill-ring-save’ would, instead of behaving as
  5351. described above. If a prefix argument is used and the region is
  5352. within a hunk, it strips the outer diff marker column before saving
  5353. the text.
  5354. ‘C-w’ (‘magit-copy-buffer-revision’)
  5355. This command saves the revision being displayed in the current
  5356. buffer to the ‘kill-ring’ and also pushes it to the
  5357. ‘magit-revision-stack’. It is mainly intended for use in
  5358. ‘magit-revision-mode’ buffers, the only buffers where it is always
  5359. unambiguous exactly which revision should be saved.
  5360. Most other Magit buffers usually show more than one revision, in
  5361. some way or another, so this command has to select one of them, and
  5362. that choice might not always be the one you think would have been
  5363. the best pick.
  5364. Outside of Magit ‘M-w’ and ‘C-w’ are usually bound to
  5365. ‘kill-ring-save’ and ‘kill-region’, and these commands would also be
  5366. useful in Magit buffers. Therefore when the region is active, then both
  5367. of these commands behave like ‘kill-ring-save’ instead of as described
  5368. above.
  5369. 
  5370. File: magit.info, Node: Wip Modes, Next: Minor Mode for Buffers Visiting Files, Prev: Common Commands, Up: Miscellaneous
  5371. 8.7 Wip Modes
  5372. =============
  5373. Git keeps *committed* changes around long enough for users to recover
  5374. changes they have accidentally deleted. It does so by not garbage
  5375. collecting any committed but no longer referenced objects for a certain
  5376. period of time, by default 30 days.
  5377. But Git does *not* keep track of *uncommitted* changes in the working
  5378. tree and not even the index (the staging area). Because Magit makes it
  5379. so convenient to modify uncommitted changes, it also makes it easy to
  5380. shoot yourself in the foot in the process.
  5381. For that reason Magit provides a global mode that saves *tracked*
  5382. files to work-in-progress references after or before certain actions.
  5383. (At present untracked files are never saved and for technical reasons
  5384. nothing is saved before the first commit has been created).
  5385. Two separate work-in-progress references are used to track the state
  5386. of the index and of the working tree: ‘refs/wip/index/<branchref>’ and
  5387. ‘refs/wip/wtree/<branchref>’, where ‘<branchref>’ is the full ref of the
  5388. current branch, e.g. ‘refs/heads/master’. When the ‘HEAD’ is detached
  5389. then ‘HEAD’ is used in place of ‘<branchref>’.
  5390. Checking out another branch (or detaching ‘HEAD’) causes the use of
  5391. different wip refs for subsequent changes.
  5392. -- User Option: magit-wip-mode
  5393. When this mode is enabled, then uncommitted changes are committed
  5394. to dedicated work-in-progress refs whenever appropriate (i.e. when
  5395. dataloss would be a possibility otherwise).
  5396. Setting this variable directly does not take effect; either use the
  5397. Custom interface to do so or call the respective mode function.
  5398. For historic reasons this mode is implemented on top of four other
  5399. ‘magit-wip-*’ modes, which can also be used individually, if you
  5400. want finer control over when the wip refs are updated; but that is
  5401. discouraged. See *note Legacy Wip Modes::.
  5402. To view the log for a branch and its wip refs use the commands
  5403. ‘magit-wip-log’ and ‘magit-wip-log-current’. You should use ‘--graph’
  5404. when using these commands.
  5405. -- Command: magit-wip-log
  5406. This command shows the log for a branch and its wip refs. With a
  5407. negative prefix argument only the worktree wip ref is shown.
  5408. The absolute numeric value of the prefix argument controls how many
  5409. "branches" of each wip ref are shown. This is only relevant if the
  5410. value of ‘magit-wip-merge-branch’ is ‘nil’.
  5411. -- Command: magit-wip-log-current
  5412. This command shows the log for the current branch and its wip refs.
  5413. With a negative prefix argument only the worktree wip ref is shown.
  5414. The absolute numeric value of the prefix argument controls how many
  5415. "branches" of each wip ref are shown. This is only relevant if the
  5416. value of ‘magit-wip-merge-branch’ is ‘nil’.
  5417. ‘X w’ (‘magit-reset-worktree’)
  5418. This command resets the working tree to some commit read from the
  5419. user and defaulting to the commit at point, while keeping the
  5420. ‘HEAD’ and index as-is.
  5421. This can be used to restore files to the state committed to a wip
  5422. ref. Note that this will discard any unstaged changes that might
  5423. have existed before invoking this command (but of course only after
  5424. committing that to the working tree wip ref).
  5425. Note that even if you enable ‘magit-wip-mode’ this won’t give you
  5426. perfect protection. The most likely scenario for losing changes despite
  5427. the use of ‘magit-wip-mode’ is making a change outside Emacs and then
  5428. destroying it also outside Emacs. In some such a scenario, Magit, being
  5429. an Emacs package, didn’t get the opportunity to keep you from shooting
  5430. yourself in the foot.
  5431. When you are unsure whether Magit did commit a change to the wip
  5432. refs, then you can explicitly request that all changes to all tracked
  5433. files are being committed.
  5434. ‘M-x magit-wip-commit’ (‘magit-wip-commit’)
  5435. This command commits all changes to all tracked files to the index
  5436. and working tree work-in-progress refs. Like the modes described
  5437. above, it does not commit untracked files, but it does check all
  5438. tracked files for changes. Use this command when you suspect that
  5439. the modes might have overlooked a change made outside Emacs/Magit.
  5440. -- User Option: magit-wip-namespace
  5441. The namespace used for work-in-progress refs. It has to end with a
  5442. slash. The wip refs are named ‘<namespace>index/<branchref>’ and
  5443. ‘<namespace>wtree/<branchref>’. When snapshots are created while
  5444. the ‘HEAD’ is detached then ‘HEAD’ is used in place of
  5445. ‘<branchref>’.
  5446. -- User Option: magit-wip-mode-lighter
  5447. Mode-line lighter for ‘magit-wip--mode’.
  5448. * Menu:
  5449. * Wip Graph::
  5450. * Legacy Wip Modes::