dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

magit.info-1 (301537B)


      1 This is magit.info, produced by makeinfo version 6.7 from magit.texi.
      2 
      3      Copyright (C) 2015-2021 Jonas Bernoulli <jonas@bernoul.li>
      4 
      5      You can redistribute this document and/or modify it under the terms
      6      of the GNU General Public License as published by the Free Software
      7      Foundation, either version 3 of the License, or (at your option)
      8      any later version.
      9 
     10      This document is distributed in the hope that it will be useful,
     11      but WITHOUT ANY WARRANTY; without even the implied warranty of
     12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13      General Public License for more details.
     14 
     15 INFO-DIR-SECTION Emacs
     16 START-INFO-DIR-ENTRY
     17 * Magit: (magit).       Using Git from Emacs with Magit.
     18 END-INFO-DIR-ENTRY
     19 
     20 
     21 File: magit.info,  Node: Top,  Next: Introduction,  Up: (dir)
     22 
     23 Magit User Manual
     24 *****************
     25 
     26 Magit is an interface to the version control system Git, implemented as
     27 an Emacs package.  Magit aspires to be a complete Git porcelain.  While
     28 we cannot (yet) claim that Magit wraps and improves upon each and every
     29 Git command, it is complete enough to allow even experienced Git users
     30 to perform almost all of their daily version control tasks directly from
     31 within Emacs.  While many fine Git clients exist, only Magit and Git
     32 itself deserve to be called porcelains.
     33 
     34 This manual is for Magit version 3.3.0.
     35 
     36      Copyright (C) 2015-2021 Jonas Bernoulli <jonas@bernoul.li>
     37 
     38      You can redistribute this document and/or modify it under the terms
     39      of the GNU General Public License as published by the Free Software
     40      Foundation, either version 3 of the License, or (at your option)
     41      any later version.
     42 
     43      This document is distributed in the hope that it will be useful,
     44      but WITHOUT ANY WARRANTY; without even the implied warranty of
     45      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     46      General Public License for more details.
     47 
     48 * Menu:
     49 
     50 * Introduction::
     51 * Installation::
     52 * Getting Started::
     53 * Interface Concepts::
     54 * Inspecting::
     55 * Manipulating::
     56 * Transferring::
     57 * Miscellaneous::
     58 * Customizing::
     59 * Plumbing::
     60 * FAQ::
     61 * Debugging Tools::
     62 * Keystroke Index::
     63 * Command Index::
     64 * Function Index::
     65 * Variable Index::
     66 
     67 — The Detailed Node Listing —
     68 
     69 Installation
     70 
     71 * Installing from Melpa::
     72 * Installing from the Git Repository::
     73 * Post-Installation Tasks::
     74 
     75 Interface Concepts
     76 
     77 * Modes and Buffers::
     78 * Sections::
     79 * Transient Commands::
     80 * Transient Arguments and Buffer Variables::
     81 * Completion, Confirmation and the Selection: Completion Confirmation and the Selection.
     82 * Running Git::
     83 
     84 Modes and Buffers
     85 
     86 * Switching Buffers::
     87 * Naming Buffers::
     88 * Quitting Windows::
     89 * Automatic Refreshing of Magit Buffers::
     90 * Automatic Saving of File-Visiting Buffers::
     91 * Automatic Reverting of File-Visiting Buffers::
     92 
     93 
     94 Sections
     95 
     96 * Section Movement::
     97 * Section Visibility::
     98 * Section Hooks::
     99 * Section Types and Values::
    100 * Section Options::
    101 
    102 
    103 Completion, Confirmation and the Selection
    104 
    105 * Action Confirmation::
    106 * Completion and Confirmation::
    107 * The Selection::
    108 * The hunk-internal region::
    109 * Support for Completion Frameworks::
    110 * Additional Completion Options::
    111 
    112 
    113 Running Git
    114 
    115 * Viewing Git Output::
    116 * Git Process Status::
    117 * Running Git Manually::
    118 * Git Executable::
    119 * Global Git Arguments::
    120 
    121 
    122 Inspecting
    123 
    124 * Status Buffer::
    125 * Repository List::
    126 * Logging::
    127 * Diffing::
    128 * Ediffing::
    129 * References Buffer::
    130 * Bisecting::
    131 * Visiting Files and Blobs::
    132 * Blaming::
    133 
    134 Status Buffer
    135 
    136 * Status Sections::
    137 * Status Header Sections::
    138 * Status Module Sections::
    139 * Status Options::
    140 
    141 
    142 Logging
    143 
    144 * Refreshing Logs::
    145 * Log Buffer::
    146 * Log Margin::
    147 * Select from Log::
    148 * Reflog::
    149 * Cherries::
    150 
    151 
    152 Diffing
    153 
    154 * Refreshing Diffs::
    155 * Commands Available in Diffs::
    156 * Diff Options::
    157 * Revision Buffer::
    158 
    159 
    160 References Buffer
    161 
    162 * References Sections::
    163 
    164 
    165 Visiting Files and Blobs
    166 
    167 * General-Purpose Visit Commands::
    168 * Visiting Files and Blobs from a Diff::
    169 
    170 
    171 Manipulating
    172 
    173 * Creating Repository::
    174 * Cloning Repository::
    175 * Staging and Unstaging::
    176 * Applying::
    177 * Committing::
    178 * Branching::
    179 * Merging::
    180 * Resolving Conflicts::
    181 * Rebasing::
    182 * Cherry Picking::
    183 * Resetting::
    184 * Stashing::
    185 
    186 Staging and Unstaging
    187 
    188 * Staging from File-Visiting Buffers::
    189 
    190 
    191 Committing
    192 
    193 * Initiating a Commit::
    194 * Editing Commit Messages::
    195 
    196 
    197 Branching
    198 
    199 * The Two Remotes::
    200 * Branch Commands::
    201 * Branch Git Variables::
    202 * Auxiliary Branch Commands::
    203 
    204 
    205 Rebasing
    206 
    207 * Editing Rebase Sequences::
    208 * Information About In-Progress Rebase::
    209 
    210 
    211 Cherry Picking
    212 
    213 * Reverting::
    214 
    215 
    216 Transferring
    217 
    218 * Remotes::
    219 * Fetching::
    220 * Pulling::
    221 * Pushing::
    222 * Plain Patches::
    223 * Maildir Patches::
    224 
    225 Remotes
    226 
    227 * Remote Commands::
    228 * Remote Git Variables::
    229 
    230 
    231 Miscellaneous
    232 
    233 * Tagging::
    234 * Notes::
    235 * Submodules::
    236 * Subtree::
    237 * Worktree::
    238 * Bundle::
    239 * Common Commands::
    240 * Wip Modes::
    241 * Commands for Buffers Visiting Files::
    242 * Minor Mode for Buffers Visiting Blobs::
    243 
    244 Submodules
    245 
    246 * Listing Submodules::
    247 * Submodule Transient::
    248 
    249 
    250 Wip Modes
    251 
    252 * Wip Graph::
    253 * Legacy Wip Modes::
    254 
    255 
    256 Customizing
    257 
    258 * Per-Repository Configuration::
    259 * Essential Settings::
    260 
    261 Essential Settings
    262 
    263 * Safety::
    264 * Performance::
    265 * Default Bindings::
    266 
    267 
    268 Plumbing
    269 
    270 * Calling Git::
    271 * Section Plumbing::
    272 * Refreshing Buffers::
    273 * Conventions::
    274 
    275 Calling Git
    276 
    277 * Getting a Value from Git::
    278 * Calling Git for Effect::
    279 
    280 
    281 Section Plumbing
    282 
    283 * Creating Sections::
    284 * Section Selection::
    285 * Matching Sections::
    286 
    287 
    288 Conventions
    289 
    290 * Theming Faces::
    291 
    292 
    293 FAQ
    294 
    295 * FAQ - How to ...?::
    296 * FAQ - Issues and Errors::
    297 
    298 FAQ - How to ...?
    299 
    300 * How to pronounce Magit?::
    301 * How to show git's output?::
    302 * How to install the gitman info manual?::
    303 * How to show diffs for gpg-encrypted files?::
    304 * How does branching and pushing work?::
    305 * Can Magit be used as ediff-version-control-package?::
    306 * Should I disable VC?::
    307 
    308 
    309 FAQ - Issues and Errors
    310 
    311 * Magit is slow::
    312 * I changed several thousand files at once and now Magit is unusable::
    313 * I am having problems committing::
    314 * I am using MS Windows and cannot push with Magit::
    315 * 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.
    316 * Expanding a file to show the diff causes it to disappear::
    317 * Point is wrong in the COMMIT_EDITMSG buffer::
    318 * The mode-line information isn't always up-to-date::
    319 * A branch and tag sharing the same name breaks SOMETHING::
    320 * My Git hooks work on the command-line but not inside Magit::
    321 * git-commit-mode isn't used when committing from the command-line::
    322 * Point ends up inside invisible text when jumping to a file-visiting buffer::
    323 * I am unable to stage when using Tramp from MS Windows::
    324 * I am no longer able to save popup defaults::
    325 
    326 
    327 
    328 
    329 File: magit.info,  Node: Introduction,  Next: Installation,  Prev: Top,  Up: Top
    330 
    331 1 Introduction
    332 **************
    333 
    334 Magit is an interface to the version control system Git, implemented as
    335 an Emacs package.  Magit aspires to be a complete Git porcelain.  While
    336 we cannot (yet) claim that Magit wraps and improves upon each and every
    337 Git command, it is complete enough to allow even experienced Git users
    338 to perform almost all of their daily version control tasks directly from
    339 within Emacs.  While many fine Git clients exist, only Magit and Git
    340 itself deserve to be called porcelains.
    341 
    342    Staging and otherwise applying changes is one of the most important
    343 features in a Git porcelain and here Magit outshines anything else,
    344 including Git itself.  Git’s own staging interface (‘git add --patch’)
    345 is so cumbersome that many users only use it in exceptional cases.  In
    346 Magit staging a hunk or even just part of a hunk is as trivial as
    347 staging all changes made to a file.
    348 
    349    The most visible part of Magit’s interface is the status buffer,
    350 which displays information about the current repository.  Its content is
    351 created by running several Git commands and making their output
    352 actionable.  Among other things, it displays information about the
    353 current branch, lists unpulled and unpushed changes and contains
    354 sections displaying the staged and unstaged changes.  That might sound
    355 noisy, but, since sections are collapsible, it’s not.
    356 
    357    To stage or unstage a change one places the cursor on the change and
    358 then types ‘s’ or ‘u’.  The change can be a file or a hunk, or when the
    359 region is active (i.e.  when there is a selection) several files or
    360 hunks, or even just part of a hunk.  The change or changes that these
    361 commands - and many others - would act on are highlighted.
    362 
    363    Magit also implements several other "apply variants" in addition to
    364 staging and unstaging.  One can discard or reverse a change, or apply it
    365 to the working tree.  Git’s own porcelain only supports this for staging
    366 and unstaging and you would have to do something like ‘git diff ... |
    367 ??? | git apply ...’ to discard, revert, or apply a single hunk on the
    368 command line.  In fact that’s exactly what Magit does internally (which
    369 is what lead to the term "apply variants").
    370 
    371    Magit isn’t just for Git experts, but it does assume some prior
    372 experience with Git as well as Emacs.  That being said, many users have
    373 reported that using Magit was what finally taught them what Git is
    374 capable of and how to use it to its fullest.  Other users wished they
    375 had switched to Emacs sooner so that they would have gotten their hands
    376 on Magit earlier.
    377 
    378    While one has to know the basic features of Emacs to be able to make
    379 full use of Magit, acquiring just enough Emacs skills doesn’t take long
    380 and is worth it, even for users who prefer other editors.  Vim users are
    381 advised to give Evil (https://bitbucket.org/lyro/evil/wiki/Home), the
    382 "Extensible VI Layer for Emacs", and Spacemacs
    383 (https://github.com/syl20bnr/spacemacs), an "Emacs starter-kit focused
    384 on Evil" a try.
    385 
    386    Magit provides a consistent and efficient Git porcelain.  After a
    387 short learning period, you will be able to perform most of your daily
    388 version control tasks faster than you would on the command line.  You
    389 will likely also start using features that seemed too daunting in the
    390 past.
    391 
    392    Magit fully embraces Git.  It exposes many advanced features using a
    393 simple but flexible interface instead of only wrapping the trivial ones
    394 like many GUI clients do.  Of course Magit supports logging, cloning,
    395 pushing, and other commands that usually don’t fail in spectacular ways;
    396 but it also supports tasks that often cannot be completed in a single
    397 step.  Magit fully supports tasks such as merging, rebasing,
    398 cherry-picking, reverting, and blaming by not only providing a command
    399 to initiate these tasks but also by displaying context sensitive
    400 information along the way and providing commands that are useful for
    401 resolving conflicts and resuming the sequence after doing so.
    402 
    403    Magit wraps and in many cases improves upon at least the following
    404 Git porcelain commands: ‘add’, ‘am’, ‘bisect’, ‘blame’, ‘branch’,
    405 ‘checkout’, ‘cherry’, ‘cherry-pick’, ‘clean’, ‘clone’, ‘commit’,
    406 ‘config’, ‘describe’, ‘diff’, ‘fetch’, ‘format-patch’, ‘init’, ‘log’,
    407 ‘merge’, ‘merge-tree’, ‘mv’, ‘notes’, ‘pull’, ‘rebase’, ‘reflog’,
    408 ‘remote’, ‘request-pull’, ‘reset’, ‘revert’, ‘rm’, ‘show’, ‘stash’,
    409 ‘submodule’, ‘subtree’, ‘tag’, and ‘worktree.’ Many more Magit porcelain
    410 commands are implemented on top of Git plumbing commands.
    411 
    412 
    413 File: magit.info,  Node: Installation,  Next: Getting Started,  Prev: Introduction,  Up: Top
    414 
    415 2 Installation
    416 **************
    417 
    418 Magit can be installed using Emacs’ package manager or manually from its
    419 development repository.
    420 
    421 * Menu:
    422 
    423 * Installing from Melpa::
    424 * Installing from the Git Repository::
    425 * Post-Installation Tasks::
    426 
    427 
    428 File: magit.info,  Node: Installing from Melpa,  Next: Installing from the Git Repository,  Up: Installation
    429 
    430 2.1 Installing from Melpa
    431 =========================
    432 
    433 Magit is available from Melpa and Melpa-Stable.  If you haven’t used
    434 Emacs’ package manager before, then it is high time you familiarize
    435 yourself with it by reading the documentation in the Emacs manual, see
    436 *note (emacs)Packages::.  Then add one of the archives to
    437 ‘package-archives’:
    438 
    439    • To use Melpa:
    440 
    441      (require 'package)
    442      (add-to-list 'package-archives
    443                   '("melpa" . "http://melpa.org/packages/") t)
    444 
    445    • To use Melpa-Stable:
    446 
    447      (require 'package)
    448      (add-to-list 'package-archives
    449                   '("melpa-stable" . "http://stable.melpa.org/packages/") t)
    450 
    451    Once you have added your preferred archive, you need to update the
    452 local package list using:
    453 
    454      M-x package-refresh-contents RET
    455 
    456    Once you have done that, you can install Magit and its dependencies
    457 using:
    458 
    459      M-x package-install RET magit RET
    460 
    461    Now see *note Post-Installation Tasks::.
    462 
    463 
    464 File: magit.info,  Node: Installing from the Git Repository,  Next: Post-Installation Tasks,  Prev: Installing from Melpa,  Up: Installation
    465 
    466 2.2 Installing from the Git Repository
    467 ======================================
    468 
    469 Magit depends on the ‘dash’, ‘transient’ and ‘with-editor’ libraries
    470 which are available from Melpa and Melpa-Stable.  Install them using
    471 ‘M-x package-install RET <package> RET’.  Of course you may also install
    472 them manually from their repository.
    473 
    474    Then clone the Magit repository:
    475 
    476      $ git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit
    477      $ cd ~/.emacs.d/site-lisp/magit
    478 
    479    Then compile the libraries and generate the info manuals:
    480 
    481      $ make
    482 
    483    If you haven’t installed ‘dash’, ‘transient’ and ‘with-editor’ from
    484 Melpa or at ‘/path/to/magit/../<package>’, then you have to tell ‘make’
    485 where to find them.  To do so create the file ‘/path/to/magit/config.mk’
    486 with the following content before running ‘make’:
    487 
    488      LOAD_PATH  = -L ~/.emacs.d/site-lisp/magit/lisp
    489      LOAD_PATH += -L ~/.emacs.d/site-lisp/dash
    490      LOAD_PATH += -L ~/.emacs.d/site-lisp/transient/lisp
    491      LOAD_PATH += -L ~/.emacs.d/site-lisp/with-editor
    492 
    493    Finally add this to your init file:
    494 
    495      (add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
    496      (require 'magit)
    497 
    498      (with-eval-after-load 'info
    499        (info-initialize)
    500        (add-to-list 'Info-directory-list
    501                     "~/.emacs.d/site-lisp/magit/Documentation/"))
    502 
    503    Of course if you installed the dependencies manually as well, then
    504 you have to tell Emacs about them too, by prefixing the above with:
    505 
    506      (add-to-list 'load-path "~/.emacs.d/site-lisp/dash")
    507      (add-to-list 'load-path "~/.emacs.d/site-lisp/transient/lisp")
    508      (add-to-list 'load-path "~/.emacs.d/site-lisp/with-editor")
    509 
    510    Note that you have to add the ‘lisp’ subdirectory to the ‘load-path’,
    511 not the top-level of the repository, and that elements of ‘load-path’
    512 should not end with a slash, while those of ‘Info-directory-list’
    513 should.
    514 
    515    Instead of requiring the feature ‘magit’, you could load just the
    516 autoload definitions, by loading the file ‘magit-autoloads.el’.
    517 
    518      (load "/path/to/magit/lisp/magit-autoloads")
    519 
    520    Instead of running Magit directly from the repository by adding that
    521 to the ‘load-path’, you might want to instead install it in some other
    522 directory using ‘sudo make install’ and setting ‘load-path’ accordingly.
    523 
    524    To update Magit use:
    525 
    526      $ git pull
    527      $ make
    528 
    529    At times it might be necessary to run ‘make clean all’ instead.
    530 
    531    To view all available targets use ‘make help’.
    532 
    533    Now see *note Post-Installation Tasks::.
    534 
    535 
    536 File: magit.info,  Node: Post-Installation Tasks,  Prev: Installing from the Git Repository,  Up: Installation
    537 
    538 2.3 Post-Installation Tasks
    539 ===========================
    540 
    541 After installing Magit you should verify that you are indeed using the
    542 Magit, Git, and Emacs releases you think you are using.  It’s best to
    543 restart Emacs before doing so, to make sure you are not using an
    544 outdated value for ‘load-path’.
    545 
    546      M-x magit-version RET
    547 
    548    should display something like
    549 
    550      Magit 2.8.0, Git 2.10.2, Emacs 25.1.1, gnu/linux
    551 
    552    Then you might also want to read about options that many users likely
    553 want to customize.  See *note Essential Settings::.
    554 
    555    To be able to follow cross references to Git manpages found in this
    556 manual, you might also have to manually install the ‘gitman’ info
    557 manual, or advice ‘Info-follow-nearest-node’ to instead open the actual
    558 manpage.  See *note How to install the gitman info manual?::.
    559 
    560    If you are completely new to Magit then see *note Getting Started::.
    561 
    562    If you run into problems, then please see the *note FAQ::.  Also see
    563 the *note Debugging Tools::.
    564 
    565    And last but not least please consider making a donation, to ensure
    566 that I can keep working on Magit.  See <https://magit.vc/donations>.
    567 for various donation options.
    568 
    569 
    570 File: magit.info,  Node: Getting Started,  Next: Interface Concepts,  Prev: Installation,  Up: Top
    571 
    572 3 Getting Started
    573 *****************
    574 
    575 This short tutorial describes the most essential features that many
    576 Magitians use on a daily basis.  It only scratches the surface but
    577 should be enough to get you started.
    578 
    579    IMPORTANT: It is safest if you clone some repository just for this
    580 tutorial.  Alternatively you can use an existing local repository, but
    581 if you do that, then you should commit all uncommitted changes before
    582 proceeding.
    583 
    584    Type ‘C-x g’ to display information about the current Git repository
    585 in a dedicated buffer, called the status buffer.
    586 
    587    Most Magit commands are commonly invoked from the status buffer.  It
    588 can be considered the primary interface for interacting with Git using
    589 Magit.  Many other Magit buffers may exist at a given time, but they are
    590 often created from this buffer.
    591 
    592    Depending on what state your repository is in, this buffer may
    593 contain sections titled "Staged changes", "Unstaged changes", "Unmerged
    594 into origin/master", "Unpushed to origin/master", and many others.
    595 
    596    Since we are starting from a safe state, which you can easily return
    597 to (by doing a ‘git reset --hard PRE-MAGIT-STATE’), there currently are
    598 no staged or unstaged changes.  Edit some files and save the changes.
    599 Then go back to the status buffer, while at the same time refreshing it,
    600 by typing ‘C-x g’.  (When the status buffer, or any Magit buffer for
    601 that matter, is the current buffer, then you can also use just ‘g’ to
    602 refresh it).
    603 
    604    Move between sections using ‘p’ and ‘n’.  Note that the bodies of
    605 some sections are hidden.  Type ‘TAB’ to expand or collapse the section
    606 at point.  You can also use ‘C-tab’ to cycle the visibility of the
    607 current section and its children.  Move to a file section inside the
    608 section named "Unstaged changes" and type ‘s’ to stage the changes you
    609 have made to that file.  That file now appears under "Staged changes".
    610 
    611    Magit can stage and unstage individual hunks, not just complete
    612 files.  Move to the file you have just staged, expand it using ‘TAB’,
    613 move to one of the hunks using ‘n’, and unstage just that by typing ‘u’.
    614 Note how the staging (‘s’) and unstaging (‘u’) commands operate on the
    615 change at point.  Many other commands behave the same way.
    616 
    617    You can also un-/stage just part of a hunk.  Inside the body of a
    618 hunk section (move there using ‘C-n’), set the mark using ‘C-SPC’ and
    619 move down until some added and/or removed lines fall inside the region
    620 but not all of them.  Again type ‘s’ to stage.
    621 
    622    It is also possible to un-/stage multiple files at once.  Move to a
    623 file section, type ‘C-SPC’, move to the next file using ‘n’, and then
    624 ‘s’ to stage both files.  Note that both the mark and point have to be
    625 on the headings of sibling sections for this to work.  If the region
    626 looks like it does in other buffers, then it doesn’t select Magit
    627 sections that can be acted on as a unit.
    628 
    629    And then of course you want to commit your changes.  Type ‘c’.  This
    630 shows the available commit commands and arguments in a buffer at the
    631 bottom of the frame.  Each command and argument is prefixed with the key
    632 that invokes/sets it.  Do not worry about this for now.  We want to
    633 create a "normal" commit, which is done by typing ‘c’ again.
    634 
    635    Now two new buffers appear.  One is for writing the commit message,
    636 the other shows a diff with the changes that you are about to commit.
    637 Write a message and then type ‘C-c C-c’ to actually create the commit.
    638 
    639    You probably don’t want to push the commit you just created because
    640 you just committed some random changes, but if that is not the case you
    641 could push it by typing ‘P’ to show all the available push commands and
    642 arguments and then ‘p’ to push to a branch with the same name as the
    643 local branch onto the remote configured as the push-remote.  (If the
    644 push-remote is not configured yet, then you would first be prompted for
    645 the remote to push to.)
    646 
    647    So far we have mentioned the commit, push, and log menu commands.
    648 These are probably among the menus you will be using the most, but many
    649 others exist.  To show a menu that lists all other menus (as well as the
    650 various apply commands and some other essential commands), type ‘h’.
    651 Try a few.  (Such menus are also called "transient prefix commands" or
    652 just "transients".)
    653 
    654    The key bindings in that menu correspond to the bindings in Magit
    655 buffers, including but not limited to the status buffer.  So you could
    656 type ‘h d’ to bring up the diff menu, but once you remember that "d"
    657 stands for "diff", you would usually do so by just typing ‘d’.  But this
    658 "prefix of prefixes" is useful even once you have memorized all the
    659 bindings, as it can provide easy access to Magit commands from non-Magit
    660 buffers.  The global binding is ‘C-x M-g’.
    661 
    662    In file visiting buffers ‘C-c M-g’ brings up a similar menu featuring
    663 commands that act on just the visited file, see *note Commands for
    664 Buffers Visiting Files::.
    665 
    666    It is not necessary that you do so now, but if you stick with Magit,
    667 then it is highly recommended that you read the next section too.
    668 
    669 
    670 File: magit.info,  Node: Interface Concepts,  Next: Inspecting,  Prev: Getting Started,  Up: Top
    671 
    672 4 Interface Concepts
    673 ********************
    674 
    675 * Menu:
    676 
    677 * Modes and Buffers::
    678 * Sections::
    679 * Transient Commands::
    680 * Transient Arguments and Buffer Variables::
    681 * Completion, Confirmation and the Selection: Completion Confirmation and the Selection.
    682 * Running Git::
    683 
    684 
    685 File: magit.info,  Node: Modes and Buffers,  Next: Sections,  Up: Interface Concepts
    686 
    687 4.1 Modes and Buffers
    688 =====================
    689 
    690 Magit provides several major-modes.  For each of these modes there
    691 usually exists only one buffer per repository.  Separate modes and thus
    692 buffers exist for commits, diffs, logs, and some other things.
    693 
    694    Besides these special purpose buffers, there also exists an overview
    695 buffer, called the *status buffer*.  It’s usually from this buffer that
    696 the user invokes Git commands, or creates or visits other buffers.
    697 
    698    In this manual we often speak about "Magit buffers".  By that we mean
    699 buffers whose major-modes derive from ‘magit-mode’.
    700 
    701 ‘M-x magit-toggle-buffer-lock’     (‘magit-toggle-buffer-lock’)
    702 
    703      This command locks the current buffer to its value or if the buffer
    704      is already locked, then it unlocks it.
    705 
    706      Locking a buffer to its value prevents it from being reused to
    707      display another value.  The name of a locked buffer contains its
    708      value, which allows telling it apart from other locked buffers and
    709      the unlocked buffer.
    710 
    711      Not all Magit buffers can be locked to their values; for example,
    712      it wouldn’t make sense to lock a status buffer.
    713 
    714      There can only be a single unlocked buffer using a certain
    715      major-mode per repository.  So when a buffer is being unlocked and
    716      another unlocked buffer already exists for that mode and
    717      repository, then the former buffer is instead deleted and the
    718      latter is displayed in its place.
    719 
    720 * Menu:
    721 
    722 * Switching Buffers::
    723 * Naming Buffers::
    724 * Quitting Windows::
    725 * Automatic Refreshing of Magit Buffers::
    726 * Automatic Saving of File-Visiting Buffers::
    727 * Automatic Reverting of File-Visiting Buffers::
    728 
    729 
    730 File: magit.info,  Node: Switching Buffers,  Next: Naming Buffers,  Up: Modes and Buffers
    731 
    732 4.1.1 Switching Buffers
    733 -----------------------
    734 
    735  -- Function: magit-display-buffer buffer &optional display-function
    736 
    737      This function is a wrapper around ‘display-buffer’ and is used to
    738      display any Magit buffer.  It displays BUFFER in some window and,
    739      unlike ‘display-buffer’, also selects that window, provided
    740      ‘magit-display-buffer-noselect’ is ‘nil’.  It also runs the hooks
    741      mentioned below.
    742 
    743      If optional DISPLAY-FUNCTION is non-nil, then that is used to
    744      display the buffer.  Usually that is ‘nil’ and the function
    745      specified by ‘magit-display-buffer-function’ is used.
    746 
    747  -- Variable: magit-display-buffer-noselect
    748 
    749      When this is non-nil, then ‘magit-display-buffer’ only displays the
    750      buffer but forgoes also selecting the window.  This variable should
    751      not be set globally, it is only intended to be let-bound, by code
    752      that automatically updates "the other window".  This is used for
    753      example when the revision buffer is updated when you move inside
    754      the log buffer.
    755 
    756  -- User Option: magit-display-buffer-function
    757 
    758      The function specified here is called by ‘magit-display-buffer’
    759      with one argument, a buffer, to actually display that buffer.  This
    760      function should call ‘display-buffer’ with that buffer as first and
    761      a list of display actions as second argument.
    762 
    763      Magit provides several functions, listed below, that are suitable
    764      values for this option.  If you want to use different rules, then a
    765      good way of doing that is to start with a copy of one of these
    766      functions and then adjust it to your needs.
    767 
    768      Instead of using a wrapper around ‘display-buffer’, that function
    769      itself can be used here, in which case the display actions have to
    770      be specified by adding them to ‘display-buffer-alist’ instead.
    771 
    772      To learn about display actions, see *note (elisp)Choosing Window::.
    773 
    774  -- Function: magit-display-buffer-traditional buffer
    775 
    776      This function is the current default value of the option
    777      ‘magit-display-buffer-function’.  Before that option and this
    778      function were added, the behavior was hard-coded in many places all
    779      over the code base but now all the rules are contained in this one
    780      function (except for the "noselect" special case mentioned above).
    781 
    782  -- Function: magit-display-buffer-same-window-except-diff-v1
    783 
    784      This function displays most buffers in the currently selected
    785      window.  If a buffer’s mode derives from ‘magit-diff-mode’ or
    786      ‘magit-process-mode’, it is displayed in another window.
    787 
    788  -- Function: magit-display-buffer-fullframe-status-v1
    789 
    790      This function fills the entire frame when displaying a status
    791      buffer.  Otherwise, it behaves like
    792      ‘magit-display-buffer-traditional’.
    793 
    794  -- Function: magit-display-buffer-fullframe-status-topleft-v1
    795 
    796      This function fills the entire frame when displaying a status
    797      buffer.  It behaves like ‘magit-display-buffer-fullframe-status-v1’
    798      except that it displays buffers that derive from ‘magit-diff-mode’
    799      or ‘magit-process-mode’ to the top or left of the current buffer
    800      rather than to the bottom or right.  As a result, Magit buffers
    801      tend to pop up on the same side as they would if
    802      ‘magit-display-buffer-traditional’ were in use.
    803 
    804  -- Function: magit-display-buffer-fullcolumn-most-v1
    805 
    806      This function displays most buffers so that they fill the entire
    807      height of the frame.  However, the buffer is displayed in another
    808      window if (1) the buffer’s mode derives from ‘magit-process-mode’,
    809      or (2) the buffer’s mode derives from ‘magit-diff-mode’, provided
    810      that the mode of the current buffer derives from ‘magit-log-mode’
    811      or ‘magit-cherry-mode’.
    812 
    813  -- User Option: magit-pre-display-buffer-hook
    814 
    815      This hook is run by ‘magit-display-buffer’ before displaying the
    816      buffer.
    817 
    818  -- Function: magit-save-window-configuration
    819 
    820      This function saves the current window configuration.  Later when
    821      the buffer is buried, it may be restored by
    822      ‘magit-restore-window-configuration’.
    823 
    824  -- User Option: magit-post-display-buffer-hook
    825 
    826      This hook is run by ‘magit-display-buffer’ after displaying the
    827      buffer.
    828 
    829  -- Function: magit-maybe-set-dedicated
    830 
    831      This function remembers if a new window had to be created to
    832      display the buffer, or whether an existing window was reused.  This
    833      information is later used by ‘magit-mode-quit-window’, to determine
    834      whether the window should be deleted when its last Magit buffer is
    835      buried.
    836 
    837 
    838 File: magit.info,  Node: Naming Buffers,  Next: Quitting Windows,  Prev: Switching Buffers,  Up: Modes and Buffers
    839 
    840 4.1.2 Naming Buffers
    841 --------------------
    842 
    843  -- User Option: magit-generate-buffer-name-function
    844 
    845      The function used to generate the names of Magit buffers.
    846 
    847      Such a function should take the options
    848      ‘magit-uniquify-buffer-names’ as well as ‘magit-buffer-name-format’
    849      into account.  If it doesn’t, then should be clearly stated in the
    850      doc-string.  And if it supports %-sequences beyond those mentioned
    851      in the doc-string of the option ‘magit-buffer-name-format’, then
    852      its own doc-string should describe the additions.
    853 
    854  -- Function: magit-generate-buffer-name-default-function mode
    855 
    856      This function returns a buffer name suitable for a buffer whose
    857      major-mode is MODE and which shows information about the repository
    858      in which ‘default-directory’ is located.
    859 
    860      This function uses ‘magit-buffer-name-format’ and supporting all of
    861      the %-sequences mentioned the documentation of that option.  It
    862      also respects the option ‘magit-uniquify-buffer-names’.
    863 
    864  -- User Option: magit-buffer-name-format
    865 
    866      The format string used to name Magit buffers.
    867 
    868      At least the following %-sequences are supported:
    869 
    870         • ‘%m’
    871 
    872           The name of the major-mode, but with the ‘-mode’ suffix
    873           removed.
    874 
    875         • ‘%M’
    876 
    877           Like ‘%m’ but abbreviate ‘magit-status-mode’ as ‘magit’.
    878 
    879         • ‘%v’
    880 
    881           The value the buffer is locked to, in parentheses, or an empty
    882           string if the buffer is not locked to a value.
    883 
    884         • ‘%V’
    885 
    886           Like ‘%v’, but the string is prefixed with a space, unless it
    887           is an empty string.
    888 
    889         • ‘%t’
    890 
    891           The top-level directory of the working tree of the repository,
    892           or if ‘magit-uniquify-buffer-names’ is non-nil an abbreviation
    893           of that.
    894 
    895         • ‘%x’
    896 
    897           If ‘magit-uniquify-buffer-names’ is nil "*", otherwise the
    898           empty string.  Due to limitations of the ‘uniquify’ package,
    899           buffer names must end with the path.
    900 
    901         • ‘%T’
    902 
    903           Obsolete, use "%t%x" instead.  Like ‘%t’, but append an
    904           asterisk if and only if ‘magit-uniquify-buffer-names’ is nil.
    905 
    906      The value should always contain ‘%m’ or ‘%M’, ‘%v’ or ‘%V’, and
    907      ‘%t’ (or the obsolete ‘%T’).  If ‘magit-uniquify-buffer-names’ is
    908      non-nil, then the value must end with ‘%t’ or ‘%t%x’ (or the
    909      obsolete ‘%T’).  See issue #2841.
    910 
    911  -- User Option: magit-uniquify-buffer-names
    912 
    913      This option controls whether the names of Magit buffers are
    914      uniquified.  If the names are not being uniquified, then they
    915      contain the full path of the top-level of the working tree of the
    916      corresponding repository.  If they are being uniquified, then they
    917      end with the basename of the top-level, or if that would conflict
    918      with the name used for other buffers, then the names of all these
    919      buffers are adjusted until they no longer conflict.
    920 
    921      This is done using the ‘uniquify’ package; customize its options to
    922      control how buffer names are uniquified.
    923 
    924 
    925 File: magit.info,  Node: Quitting Windows,  Next: Automatic Refreshing of Magit Buffers,  Prev: Naming Buffers,  Up: Modes and Buffers
    926 
    927 4.1.3 Quitting Windows
    928 ----------------------
    929 
    930 ‘q’     (‘magit-mode-bury-buffer’)
    931 
    932      This command buries the current Magit buffer.
    933 
    934      With a prefix argument, it instead kills the buffer.  With a double
    935      prefix argument, also kills all other Magit buffers associated with
    936      the current project.
    937 
    938  -- User Option: magit-bury-buffer-function
    939 
    940      The function used to actually bury or kill the current buffer.
    941 
    942      ‘magit-mode-bury-buffer’ calls this function with one argument.  If
    943      the argument is non-nil, then the function has to kill the current
    944      buffer.  Otherwise it has to bury it alive.  The default value
    945      currently is ‘magit-restore-window-configuration’.
    946 
    947  -- Function: magit-restore-window-configuration kill-buffer
    948 
    949      Bury or kill the current buffer using ‘quit-window’, which is
    950      called with KILL-BUFFER as first and the selected window as second
    951      argument.
    952 
    953      Then restore the window configuration that existed right before the
    954      current buffer was displayed in the selected frame.  Unfortunately
    955      that also means that point gets adjusted in all the buffers, which
    956      are being displayed in the selected frame.
    957 
    958  -- Function: magit-mode-quit-window kill-buffer
    959 
    960      Bury or kill the current buffer using ‘quit-window’, which is
    961      called with KILL-BUFFER as first and the selected window as second
    962      argument.
    963 
    964      Then, if the window was originally created to display a Magit
    965      buffer and the buried buffer was the last remaining Magit buffer
    966      that was ever displayed in the window, then that is deleted.
    967 
    968 
    969 File: magit.info,  Node: Automatic Refreshing of Magit Buffers,  Next: Automatic Saving of File-Visiting Buffers,  Prev: Quitting Windows,  Up: Modes and Buffers
    970 
    971 4.1.4 Automatic Refreshing of Magit Buffers
    972 -------------------------------------------
    973 
    974 After running a command which may change the state of the current
    975 repository, the current Magit buffer and the corresponding status buffer
    976 are refreshed.  The status buffer can be automatically refreshed
    977 whenever a buffer is saved to a file inside the respective repository by
    978 adding a hook, like so:
    979 
    980      (with-eval-after-load 'magit-mode
    981        (add-hook 'after-save-hook 'magit-after-save-refresh-status t))
    982 
    983    Automatically refreshing Magit buffers ensures that the displayed
    984 information is up-to-date most of the time but can lead to a noticeable
    985 delay in big repositories.  Other Magit buffers are not refreshed to
    986 keep the delay to a minimum and also because doing so can sometimes be
    987 undesirable.
    988 
    989    Buffers can also be refreshed explicitly, which is useful in buffers
    990 that weren’t current during the last refresh and after changes were made
    991 to the repository outside of Magit.
    992 
    993 ‘g’     (‘magit-refresh’)
    994 
    995      This command refreshes the current buffer if its major mode derives
    996      from ‘magit-mode’ as well as the corresponding status buffer.
    997 
    998      If the option ‘magit-revert-buffers’ calls for it, then it also
    999      reverts all unmodified buffers that visit files being tracked in
   1000      the current repository.
   1001 
   1002 ‘G’     (‘magit-refresh-all’)
   1003 
   1004      This command refreshes all Magit buffers belonging to the current
   1005      repository and also reverts all unmodified buffers that visit files
   1006      being tracked in the current repository.
   1007 
   1008      The file-visiting buffers are always reverted, even if
   1009      ‘magit-revert-buffers’ is nil.
   1010 
   1011  -- User Option: magit-refresh-buffer-hook
   1012 
   1013      This hook is run in each Magit buffer that was refreshed during the
   1014      current refresh - normally the current buffer and the status
   1015      buffer.
   1016 
   1017  -- User Option: magit-refresh-status-buffer
   1018 
   1019      When this option is non-nil, then the status buffer is
   1020      automatically refreshed after running git for side-effects, in
   1021      addition to the current Magit buffer, which is always refreshed
   1022      automatically.
   1023 
   1024      Only set this to nil after exhausting all other options to improve
   1025      performance.
   1026 
   1027  -- Function: magit-after-save-refresh-status
   1028 
   1029      This function is intended to be added to ‘after-save-hook’.  After
   1030      doing that the corresponding status buffer is refreshed whenever a
   1031      buffer is saved to a file inside a repository.
   1032 
   1033      Note that refreshing a Magit buffer is done by re-creating its
   1034      contents from scratch, which can be slow in large repositories.  If
   1035      you are not satisfied with Magit’s performance, then you should
   1036      obviously not add this function to that hook.
   1037 
   1038 
   1039 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
   1040 
   1041 4.1.5 Automatic Saving of File-Visiting Buffers
   1042 -----------------------------------------------
   1043 
   1044 File-visiting buffers are by default saved at certain points in time.
   1045 This doesn’t guarantee that Magit buffers are always up-to-date, but,
   1046 provided one only edits files by editing them in Emacs and uses only
   1047 Magit to interact with Git, one can be fairly confident.  When in doubt
   1048 or after outside changes, type ‘g’ (‘magit-refresh’) to save and refresh
   1049 explicitly.
   1050 
   1051  -- User Option: magit-save-repository-buffers
   1052 
   1053      This option controls whether file-visiting buffers are saved before
   1054      certain events.
   1055 
   1056      If this is non-nil then all modified file-visiting buffers
   1057      belonging to the current repository may be saved before running
   1058      commands, before creating new Magit buffers, and before explicitly
   1059      refreshing such buffers.  If this is ‘dontask’ then this is done
   1060      without user intervention.  If it is ‘t’ then the user has to
   1061      confirm each save.
   1062 
   1063 
   1064 File: magit.info,  Node: Automatic Reverting of File-Visiting Buffers,  Prev: Automatic Saving of File-Visiting Buffers,  Up: Modes and Buffers
   1065 
   1066 4.1.6 Automatic Reverting of File-Visiting Buffers
   1067 --------------------------------------------------
   1068 
   1069 By default Magit automatically reverts buffers that are visiting files
   1070 that are being tracked in a Git repository, after they have changed on
   1071 disk.  When using Magit one often changes files on disk by running Git,
   1072 i.e.  "outside Emacs", making this a rather important feature.
   1073 
   1074    For example, if you discard a change in the status buffer, then that
   1075 is done by running ‘git apply --reverse ...’, and Emacs considers the
   1076 file to have "changed on disk".  If Magit did not automatically revert
   1077 the buffer, then you would have to type ‘M-x revert-buffer RET RET’ in
   1078 the visiting buffer before you could continue making changes.
   1079 
   1080  -- User Option: magit-auto-revert-mode
   1081 
   1082      When this mode is enabled, then buffers that visit tracked files
   1083      are automatically reverted after the visited files change on disk.
   1084 
   1085  -- User Option: global-auto-revert-mode
   1086 
   1087      When this mode is enabled, then any file-visiting buffer is
   1088      automatically reverted after the visited file changes on disk.
   1089 
   1090      If you like buffers that visit tracked files to be automatically
   1091      reverted, then you might also like any buffer to be reverted, not
   1092      just those visiting tracked files.  If that is the case, then
   1093      enable this mode _instead of_ ‘magit-auto-revert-mode’.
   1094 
   1095  -- User Option: magit-auto-revert-immediately
   1096 
   1097      This option controls whether Magit reverts buffers immediately.
   1098 
   1099      If this is non-nil and either ‘global-auto-revert-mode’ or
   1100      ‘magit-auto-revert-mode’ is enabled, then Magit immediately reverts
   1101      buffers by explicitly calling ‘auto-revert-buffers’ after running
   1102      Git for side-effects.
   1103 
   1104      If ‘auto-revert-use-notify’ is non-nil (and file notifications are
   1105      actually supported), then ‘magit-auto-revert-immediately’ does not
   1106      have to be non-nil, because the reverts happen immediately anyway.
   1107 
   1108      If ‘magit-auto-revert-immediately’ and ‘auto-revert-use-notify’ are
   1109      both ‘nil’, then reverts happen after ‘auto-revert-interval’
   1110      seconds of user inactivity.  That is not desirable.
   1111 
   1112  -- User Option: auto-revert-use-notify
   1113 
   1114      This option controls whether file notification functions should be
   1115      used.  Note that this variable unfortunately defaults to ‘t’ even
   1116      on systems on which file notifications cannot be used.
   1117 
   1118  -- User Option: magit-auto-revert-tracked-only
   1119 
   1120      This option controls whether ‘magit-auto-revert-mode’ only reverts
   1121      tracked files or all files that are located inside Git
   1122      repositories, including untracked files and files located inside
   1123      Git’s control directory.
   1124 
   1125  -- User Option: auto-revert-mode
   1126 
   1127      The global mode ‘magit-auto-revert-mode’ works by turning on this
   1128      local mode in the appropriate buffers (but
   1129      ‘global-auto-revert-mode’ is implemented differently).  You can
   1130      also turn it on or off manually, which might be necessary if Magit
   1131      does not notice that a previously untracked file now is being
   1132      tracked or vice-versa.
   1133 
   1134  -- User Option: auto-revert-stop-on-user-input
   1135 
   1136      This option controls whether the arrival of user input suspends the
   1137      automatic reverts for ‘auto-revert-interval’ seconds.
   1138 
   1139  -- User Option: auto-revert-interval
   1140 
   1141      This option controls how many seconds Emacs waits for before
   1142      resuming suspended reverts.
   1143 
   1144  -- User Option: auto-revert-buffer-list-filter
   1145 
   1146      This option specifies an additional filter used by
   1147      ‘auto-revert-buffers’ to determine whether a buffer should be
   1148      reverted or not.
   1149 
   1150      This option is provided by Magit, which also advises
   1151      ‘auto-revert-buffers’ to respect it.  Magit users who do not turn
   1152      on the local mode ‘auto-revert-mode’ themselves, are best served by
   1153      setting the value to ‘magit-auto-revert-repository-buffer-p’.
   1154 
   1155      However the default is nil, so as not to disturb users who do use
   1156      the local mode directly.  If you experience delays when running
   1157      Magit commands, then you should consider using one of the
   1158      predicates provided by Magit - especially if you also use Tramp.
   1159 
   1160      Users who do turn on ‘auto-revert-mode’ in buffers in which Magit
   1161      doesn’t do that for them, should likely not use any filter.  Users
   1162      who turn on ‘global-auto-revert-mode’, do not have to worry about
   1163      this option, because it is disregarded if the global mode is
   1164      enabled.
   1165 
   1166  -- User Option: auto-revert-verbose
   1167 
   1168      This option controls whether Emacs reports when a buffer has been
   1169      reverted.
   1170 
   1171    The options with the ‘auto-revert-’ prefix are located in the Custom
   1172 group named ‘auto-revert’.  The other, Magit-specific, options are
   1173 located in the ‘magit’ group.
   1174 
   1175 * Menu:
   1176 
   1177 * Risk of Reverting Automatically::
   1178 
   1179 
   1180 File: magit.info,  Node: Risk of Reverting Automatically,  Up: Automatic Reverting of File-Visiting Buffers
   1181 
   1182 Risk of Reverting Automatically
   1183 ...............................
   1184 
   1185 For the vast majority of users, automatically reverting file-visiting
   1186 buffers after they have changed on disk is harmless.
   1187 
   1188    If a buffer is modified (i.e.  it contains changes that haven’t been
   1189 saved yet), then Emacs will refuse to automatically revert it.  If you
   1190 save a previously modified buffer, then that results in what is seen by
   1191 Git as an uncommitted change.  Git will then refuse to carry out any
   1192 commands that would cause these changes to be lost.  In other words, if
   1193 there is anything that could be lost, then either Git or Emacs will
   1194 refuse to discard the changes.
   1195 
   1196    However, if you use file-visiting buffers as a sort of ad hoc
   1197 "staging area", then the automatic reverts could potentially cause data
   1198 loss.  So far I have heard from only one user who uses such a workflow.
   1199 
   1200    An example: You visit some file in a buffer, edit it, and save the
   1201 changes.  Then, outside of Emacs (or at least not using Magit or by
   1202 saving the buffer) you change the file on disk again.  At this point the
   1203 buffer is the only place where the intermediate version still exists.
   1204 You have saved the changes to disk, but that has since been overwritten.
   1205 Meanwhile Emacs considers the buffer to be unmodified (because you have
   1206 not made any changes to it since you last saved it to the visited file)
   1207 and therefore would not object to it being automatically reverted.  At
   1208 this point an Auto-Revert mode would kick in.  It would check whether
   1209 the buffer is modified and since that is not the case it would revert
   1210 it.  The intermediate version would be lost.  (Actually you could still
   1211 get it back using the ‘undo’ command.)
   1212 
   1213    If your workflow depends on Emacs preserving the intermediate version
   1214 in the buffer, then you have to disable all Auto-Revert modes.  But
   1215 please consider that such a workflow would be dangerous even without
   1216 using an Auto-Revert mode, and should therefore be avoided.  If Emacs
   1217 crashes or if you quit Emacs by mistake, then you would also lose the
   1218 buffer content.  There would be no autosave file still containing the
   1219 intermediate version (because that was deleted when you saved the
   1220 buffer) and you would not be asked whether you want to save the buffer
   1221 (because it isn’t modified).
   1222 
   1223 
   1224 File: magit.info,  Node: Sections,  Next: Transient Commands,  Prev: Modes and Buffers,  Up: Interface Concepts
   1225 
   1226 4.2 Sections
   1227 ============
   1228 
   1229 Magit buffers are organized into nested sections, which can be collapsed
   1230 and expanded, similar to how sections are handled in Org mode.  Each
   1231 section also has a type, and some sections also have a value.  For each
   1232 section type there can also be a local keymap, shared by all sections of
   1233 that type.
   1234 
   1235    Taking advantage of the section value and type, many commands operate
   1236 on the current section, or when the region is active and selects
   1237 sections of the same type, all of the selected sections.  Commands that
   1238 only make sense for a particular section type (as opposed to just
   1239 behaving differently depending on the type) are usually bound in section
   1240 type keymaps.
   1241 
   1242 * Menu:
   1243 
   1244 * Section Movement::
   1245 * Section Visibility::
   1246 * Section Hooks::
   1247 * Section Types and Values::
   1248 * Section Options::
   1249 
   1250 
   1251 File: magit.info,  Node: Section Movement,  Next: Section Visibility,  Up: Sections
   1252 
   1253 4.2.1 Section Movement
   1254 ----------------------
   1255 
   1256 To move within a section use the usual keys (‘C-p’, ‘C-n’, ‘C-b’, ‘C-f’
   1257 etc), whose global bindings are not shadowed.  To move to another
   1258 section use the following commands.
   1259 
   1260 ‘p’     (‘magit-section-backward’)
   1261 
   1262      When not at the beginning of a section, then move to the beginning
   1263      of the current section.  At the beginning of a section, instead
   1264      move to the beginning of the previous visible section.
   1265 
   1266 ‘n’     (‘magit-section-forward’)
   1267 
   1268      Move to the beginning of the next visible section.
   1269 
   1270 ‘M-p’     (‘magit-section-backward-siblings’)
   1271 
   1272      Move to the beginning of the previous sibling section.  If there is
   1273      no previous sibling section, then move to the parent section
   1274      instead.
   1275 
   1276 ‘M-n’     (‘magit-section-forward-siblings’)
   1277 
   1278      Move to the beginning of the next sibling section.  If there is no
   1279      next sibling section, then move to the parent section instead.
   1280 
   1281 ‘^’     (‘magit-section-up’)
   1282 
   1283      Move to the beginning of the parent of the current section.
   1284 
   1285    The above commands all call the hook ‘magit-section-movement-hook’.
   1286 Any of the functions listed below can be used as members of this hook.
   1287 
   1288    You might want to remove some of the functions that Magit adds using
   1289 ‘add-hook’.  In doing so you have to make sure you do not attempt to
   1290 remove function that haven’t even been added yet, for example:
   1291 
   1292      (with-eval-after-load 'magit-diff
   1293        (remove-hook 'magit-section-movement-hook
   1294                     'magit-hunk-set-window-start))
   1295 
   1296  -- Variable: magit-section-movement-hook
   1297 
   1298      This hook is run by all of the above movement commands, after
   1299      arriving at the destination.
   1300 
   1301  -- Function: magit-hunk-set-window-start
   1302 
   1303      This hook function ensures that the beginning of the current
   1304      section is visible, provided it is a ‘hunk’ section.  Otherwise, it
   1305      does nothing.
   1306 
   1307      Loading ‘magit-diff’ adds this function to the hook.
   1308 
   1309  -- Function: magit-section-set-window-start
   1310 
   1311      This hook function ensures that the beginning of the current
   1312      section is visible, regardless of the section’s type.  If you add
   1313      this to ‘magit-section-movement-hook’, then you must remove the
   1314      hunk-only variant in turn.
   1315 
   1316  -- Function: magit-log-maybe-show-more-commits
   1317 
   1318      This hook function only has an effect in log buffers, and ‘point’
   1319      is on the "show more" section.  If that is the case, then it
   1320      doubles the number of commits that are being shown.
   1321 
   1322      Loading ‘magit-log’ adds this function to the hook.
   1323 
   1324  -- Function: magit-log-maybe-update-revision-buffer
   1325 
   1326      When moving inside a log buffer, then this function updates the
   1327      revision buffer, provided it is already being displayed in another
   1328      window of the same frame.
   1329 
   1330      Loading ‘magit-log’ adds this function to the hook.
   1331 
   1332  -- Function: magit-log-maybe-update-blob-buffer
   1333 
   1334      When moving inside a log buffer and another window of the same
   1335      frame displays a blob buffer, then this function instead displays
   1336      the blob buffer for the commit at point in that window.
   1337 
   1338  -- Function: magit-status-maybe-update-revision-buffer
   1339 
   1340      When moving inside a status buffer, then this function updates the
   1341      revision buffer, provided it is already being displayed in another
   1342      window of the same frame.
   1343 
   1344  -- Function: magit-status-maybe-update-stash-buffer
   1345 
   1346      When moving inside a status buffer, then this function updates the
   1347      stash buffer, provided it is already being displayed in another
   1348      window of the same frame.
   1349 
   1350  -- Function: magit-status-maybe-update-blob-buffer
   1351 
   1352      When moving inside a status buffer and another window of the same
   1353      frame displays a blob buffer, then this function instead displays
   1354      the blob buffer for the commit at point in that window.
   1355 
   1356  -- Function: magit-stashes-maybe-update-stash-buffer
   1357 
   1358      When moving inside a buffer listing stashes, then this function
   1359      updates the stash buffer, provided it is already being displayed in
   1360      another window of the same frame.
   1361 
   1362  -- User Option: magit-update-other-window-delay
   1363 
   1364      Delay before automatically updating the other window.
   1365 
   1366      When moving around in certain buffers, then certain other buffers,
   1367      which are being displayed in another window, may optionally be
   1368      updated to display information about the section at point.
   1369 
   1370      When holding down a key to move by more than just one section, then
   1371      that would update that buffer for each section on the way.  To
   1372      prevent that, updating the revision buffer is delayed, and this
   1373      option controls for how long.  For optimal experience you might
   1374      have to adjust this delay and/or the keyboard repeat rate and delay
   1375      of your graphical environment or operating system.
   1376 
   1377 
   1378 File: magit.info,  Node: Section Visibility,  Next: Section Hooks,  Prev: Section Movement,  Up: Sections
   1379 
   1380 4.2.2 Section Visibility
   1381 ------------------------
   1382 
   1383 Magit provides many commands for changing the visibility of sections,
   1384 but all you need to get started are the next two.
   1385 
   1386 ‘TAB’     (‘magit-section-toggle’)
   1387 
   1388      Toggle the visibility of the body of the current section.
   1389 
   1390 ‘C-<tab>’     (‘magit-section-cycle’)
   1391 
   1392      Cycle the visibility of current section and its children.
   1393 
   1394 ‘M-<tab>’     (‘magit-section-cycle-diffs’)
   1395 
   1396      Cycle the visibility of diff-related sections in the current
   1397      buffer.
   1398 
   1399 ‘S-<tab>’     (‘magit-section-cycle-global’)
   1400 
   1401      Cycle the visibility of all sections in the current buffer.
   1402 
   1403 ‘1’     (‘magit-section-show-level-1’)
   1404 ‘2’     (‘magit-section-show-level-2’)
   1405 ‘3’     (‘magit-section-show-level-3’)
   1406 ‘4’     (‘magit-section-show-level-4’)
   1407 
   1408      Show sections surrounding the current section up to level N.
   1409 
   1410 ‘M-1’     (‘magit-section-show-level-1-all’)
   1411 ‘M-2’     (‘magit-section-show-level-2-all’)
   1412 ‘M-3’     (‘magit-section-show-level-3-all’)
   1413 ‘M-4’     (‘magit-section-show-level-4-all’)
   1414 
   1415      Show all sections up to level N.
   1416 
   1417    Some functions, which are used to implement the above commands, are
   1418 also exposed as commands themselves.  By default no keys are bound to
   1419 these commands, as they are generally perceived to be much less useful.
   1420 But your mileage may vary.
   1421 
   1422  -- Command: magit-section-show
   1423 
   1424      Show the body of the current section.
   1425 
   1426  -- Command: magit-section-hide
   1427 
   1428      Hide the body of the current section.
   1429 
   1430  -- Command: magit-section-show-headings
   1431 
   1432      Recursively show headings of children of the current section.  Only
   1433      show the headings.  Previously shown text-only bodies are hidden.
   1434 
   1435  -- Command: magit-section-show-children
   1436 
   1437      Recursively show the bodies of children of the current section.
   1438      With a prefix argument show children down to the level of the
   1439      current section, and hide deeper children.
   1440 
   1441  -- Command: magit-section-hide-children
   1442 
   1443      Recursively hide the bodies of children of the current section.
   1444 
   1445  -- Command: magit-section-toggle-children
   1446 
   1447      Toggle visibility of bodies of children of the current section.
   1448 
   1449    When a buffer is first created then some sections are shown expanded
   1450 while others are not.  This is hard coded.  When a buffer is refreshed
   1451 then the previous visibility is preserved.  The initial visibility of
   1452 certain sections can also be overwritten using the hook
   1453 ‘magit-section-set-visibility-hook’.
   1454 
   1455  -- User Option: magit-section-initial-visibility-alist
   1456 
   1457      This options can be used to override the initial visibility of
   1458      sections.  In the future it will also be used to define the
   1459      defaults, but currently a section’s default is still hardcoded.
   1460 
   1461      The value is an alist.  Each element maps a section type or lineage
   1462      to the initial visibility state for such sections.  The state has
   1463      to be one of ‘show’ or ‘hide’, or a function that returns one of
   1464      these symbols.  A function is called with the section as the only
   1465      argument.
   1466 
   1467      Use the command ‘magit-describe-section-briefly’ to determine a
   1468      section’s lineage or type.  The vector in the output is the section
   1469      lineage and the type is the first element of that vector.
   1470      Wildcards can be used, see ‘magit-section-match’.
   1471 
   1472  -- User Option: magit-section-cache-visibility
   1473 
   1474      This option controls for which sections the previous visibility
   1475      state should be restored if a section disappears and later appears
   1476      again.  The value is a boolean or a list of section types.  If t,
   1477      then the visibility of all sections is cached.  Otherwise this is
   1478      only done for sections whose type matches one of the listed types.
   1479 
   1480      This requires that the function ‘magit-section-cached-visibility’
   1481      is a member of ‘magit-section-set-visibility-hook’.
   1482 
   1483  -- Variable: magit-section-set-visibility-hook
   1484 
   1485      This hook is run when first creating a buffer and also when
   1486      refreshing an existing buffer, and is used to determine the
   1487      visibility of the section currently being inserted.
   1488 
   1489      Each function is called with one argument, the section being
   1490      inserted.  It should return ‘hide’ or ‘show’, or to leave the
   1491      visibility undefined ‘nil’.  If no function decides on the
   1492      visibility and the buffer is being refreshed, then the visibility
   1493      is preserved; or if the buffer is being created, then the hard
   1494      coded default is used.
   1495 
   1496      Usually this should only be used to set the initial visibility but
   1497      not during refreshes.  If ‘magit-insert-section--oldroot’ is
   1498      non-nil, then the buffer is being refreshed and these functions
   1499      should immediately return ‘nil’.
   1500 
   1501  -- User Option: magit-section-visibility-indicator
   1502 
   1503      This option controls whether and how to indicate that a section can
   1504      be expanded/collapsed.
   1505 
   1506      If nil, then no visibility indicators are shown.  Otherwise the
   1507      value has to have one of these two forms:
   1508 
   1509         • ‘(EXPANDABLE-BITMAP . COLLAPSIBLE-BITMAP)’
   1510 
   1511           Both values have to be variables whose values are fringe
   1512           bitmaps.  In this case every section that can be expanded or
   1513           collapsed gets an indicator in the left fringe.
   1514 
   1515           To provide extra padding around the indicator, set
   1516           ‘left-fringe-width’ in ‘magit-mode-hook’, e.g.:
   1517 
   1518                (add-hook 'magit-mode-hook (lambda ()
   1519                                             (setq left-fringe-width 20)))
   1520 
   1521         • ‘(STRING . BOOLEAN)’
   1522 
   1523           In this case STRING (usually an ellipsis) is shown at the end
   1524           of the heading of every collapsed section.  Expanded sections
   1525           get no indicator.  The cdr controls whether the appearance of
   1526           these ellipsis take section highlighting into account.  Doing
   1527           so might potentially have an impact on performance, while not
   1528           doing so is kinda ugly.
   1529 
   1530 
   1531 File: magit.info,  Node: Section Hooks,  Next: Section Types and Values,  Prev: Section Visibility,  Up: Sections
   1532 
   1533 4.2.3 Section Hooks
   1534 -------------------
   1535 
   1536 Which sections are inserted into certain buffers is controlled with
   1537 hooks.  This includes the status and the refs buffers.  For other
   1538 buffers, e.g.  log and diff buffers, this is not possible.  The command
   1539 ‘magit-describe-section’ can be used to see which hook (if any) was
   1540 responsible for inserting the section at point.
   1541 
   1542    For buffers whose sections can be customized by the user, a hook
   1543 variable called ‘magit-TYPE-sections-hook’ exists.  This hook should be
   1544 changed using ‘magit-add-section-hook’.  Avoid using ‘add-hooks’ or the
   1545 Custom interface.
   1546 
   1547    The various available section hook variables are described later in
   1548 this manual along with the appropriate "section inserter functions".
   1549 
   1550  -- Function: magit-add-section-hook hook function &optional at append
   1551           local
   1552 
   1553      Add the function FUNCTION to the value of section hook HOOK.
   1554 
   1555      Add FUNCTION at the beginning of the hook list unless optional
   1556      APPEND is non-nil, in which case FUNCTION is added at the end.  If
   1557      FUNCTION already is a member then move it to the new location.
   1558 
   1559      If optional AT is non-nil and a member of the hook list, then add
   1560      FUNCTION next to that instead.  Add before or after AT, or replace
   1561      AT with FUNCTION depending on APPEND.  If APPEND is the symbol
   1562      ‘replace’, then replace AT with FUNCTION.  For any other non-nil
   1563      value place FUNCTION right after AT.  If nil, then place FUNCTION
   1564      right before AT.  If FUNCTION already is a member of the list but
   1565      AT is not, then leave FUNCTION where ever it already is.
   1566 
   1567      If optional LOCAL is non-nil, then modify the hook’s buffer-local
   1568      value rather than its global value.  This makes the hook local by
   1569      copying the default value.  That copy is then modified.
   1570 
   1571      HOOK should be a symbol.  If HOOK is void, it is first set to nil.
   1572      HOOK’s value must not be a single hook function.  FUNCTION should
   1573      be a function that takes no arguments and inserts one or multiple
   1574      sections at point, moving point forward.  FUNCTION may choose not
   1575      to insert its section(s), when doing so would not make sense.  It
   1576      should not be abused for other side-effects.
   1577 
   1578    To remove a function from a section hook, use ‘remove-hook’.
   1579 
   1580 
   1581 File: magit.info,  Node: Section Types and Values,  Next: Section Options,  Prev: Section Hooks,  Up: Sections
   1582 
   1583 4.2.4 Section Types and Values
   1584 ------------------------------
   1585 
   1586 Each section has a type, for example ‘hunk’, ‘file’, and ‘commit’.
   1587 Instances of certain section types also have a value.  The value of a
   1588 section of type ‘file’, for example, is a file name.
   1589 
   1590    Users usually do not have to worry about a section’s type and value,
   1591 but knowing them can be handy at times.
   1592 
   1593 ‘H’     (‘magit-describe-section’)
   1594 
   1595      This command shows information about the section at point in a
   1596      separate buffer.
   1597 
   1598  -- Command: magit-describe-section-briefly
   1599 
   1600      This command shows information about the section at point in the
   1601      echo area, as ‘#<magit-section VALUE [TYPE PARENT-TYPE...]
   1602      BEGINNING-END>’.
   1603 
   1604    Many commands behave differently depending on the type of the section
   1605 at point and/or somehow consume the value of that section.  But that is
   1606 only one of the reasons why the same key may do something different,
   1607 depending on what section is current.
   1608 
   1609    Additionally for each section type a keymap *might* be defined, named
   1610 ‘magit-TYPE-section-map’.  That keymap is used as text property keymap
   1611 of all text belonging to any section of the respective type.  If such a
   1612 map does not exist for a certain type, then you can define it yourself,
   1613 and it will automatically be used.
   1614 
   1615 
   1616 File: magit.info,  Node: Section Options,  Prev: Section Types and Values,  Up: Sections
   1617 
   1618 4.2.5 Section Options
   1619 ---------------------
   1620 
   1621 This section describes options that have an effect on more than just a
   1622 certain type of sections.  As you can see there are not many of those.
   1623 
   1624  -- User Option: magit-section-show-child-count
   1625 
   1626      Whether to append the number of children to section headings.  This
   1627      only affects sections that could benefit from this information.
   1628 
   1629 
   1630 File: magit.info,  Node: Transient Commands,  Next: Transient Arguments and Buffer Variables,  Prev: Sections,  Up: Interface Concepts
   1631 
   1632 4.3 Transient Commands
   1633 ======================
   1634 
   1635 Many Magit commands are implemented as *transient* commands.  First the
   1636 user invokes a *prefix* command, which causes its *infix* arguments and
   1637 *suffix* commands to be displayed in the echo area.  The user then
   1638 optionally sets some infix arguments and finally invokes one of the
   1639 suffix commands.
   1640 
   1641    This is implemented in the library ‘transient’.  Earlier Magit
   1642 releases used the package ‘magit-popup’ and even earlier versions
   1643 library ‘magit-key-mode’.
   1644 
   1645    Transient is documented in *note (transient)Top::.
   1646 
   1647 ‘C-c C-c’     (‘magit-dispatch’)
   1648 
   1649      This transient prefix command binds most of Magit’s other prefix
   1650      commands as suffix commands and displays them in a temporary buffer
   1651      until one of them is invoked.  Invoking such a sub-prefix causes
   1652      the suffixes of that command to be bound and displayed instead of
   1653      those of ‘magit-dispatch’.
   1654 
   1655    This command is also, or especially, useful outside Magit buffers, so
   1656 you should setup a global binding:
   1657 
   1658      (global-set-key (kbd "C-x M-g") 'magit-dispatch)
   1659 
   1660 
   1661 File: magit.info,  Node: Transient Arguments and Buffer Variables,  Next: Completion Confirmation and the Selection,  Prev: Transient Commands,  Up: Interface Concepts
   1662 
   1663 4.4 Transient Arguments and Buffer Variables
   1664 ============================================
   1665 
   1666 The infix arguments of many of Magit’s transient prefix commands cease
   1667 to have an effect once the ‘git’ command that is called with those
   1668 arguments has returned.  Commands that create a commit are a good
   1669 example for this.  If the user changes the arguments, then that only
   1670 affects the next invocation of a suffix command.  If the same transient
   1671 prefix command is later invoked again, then the arguments are initially
   1672 reset to the default value.  This default value can be set for the
   1673 current Emacs session or saved permanently, see *note (transient)Saving
   1674 Values::.  It is also possible to cycle through previously used sets of
   1675 arguments using ‘M-p’ and ‘M-n’, see *note (transient)Using History::.
   1676 
   1677    However the infix arguments of many other transient commands continue
   1678 to have an effect even after the ‘git’ command that was called with
   1679 those arguments has returned.  The most important commands like this are
   1680 those that display a diff or log in a dedicated buffer.  Their arguments
   1681 obviously continue to have an effect for as long as the respective diff
   1682 or log is being displayed.  Furthermore the used arguments are stored in
   1683 buffer-local variables for future reference.
   1684 
   1685    For commands in the second group it isn’t always desirable to reset
   1686 their arguments to the global value when the transient prefix command is
   1687 invoked again.
   1688 
   1689    As mentioned above, it is possible to cycle through previously used
   1690 sets of arguments while a transient popup is visible.  That means that
   1691 we could always reset the infix arguments to the default because the set
   1692 of arguments that is active in the existing buffer is only a few ‘M-p’
   1693 away.  Magit can be configured to behave like that, but because I expect
   1694 that most users would not find that very convenient, it is not the
   1695 default.
   1696 
   1697    Also note that it is possible to change the diff and log arguments
   1698 used in the current buffer (including the status buffer, which contains
   1699 both diff and log sections) using the respective "refresh" transient
   1700 prefix commands on ‘D’ and ‘L’.  (‘d’ and ‘l’ on the other hand are
   1701 intended to change *what* diff or log is being displayed.  It is
   1702 possible to also change *how* the diff or log is being displayed at the
   1703 same time, but if you only want to do the latter, then you should use
   1704 the refresh variants.)  Because these secondary diff and log transient
   1705 prefixes are about *changing* the arguments used in the current buffer,
   1706 they *always* start out with the set of arguments that are currently in
   1707 effect in that buffer.
   1708 
   1709    Some commands are usually invoked directly even though they can also
   1710 be invoked as the suffix of a transient prefix command.  Most
   1711 prominently ‘magit-show-commit’ is usually invoked by typing ‘RET’ while
   1712 point is on a commit in a log, but it can also be invoked from the
   1713 ‘magit-diff’ transient prefix.
   1714 
   1715    When such a command is invoked directly, then it is important to
   1716 reuse the arguments as specified by the respective buffer-local values,
   1717 instead of using the default arguments.  Imagine you press ‘RET’ in a
   1718 log to display the commit at point in a different buffer and then use
   1719 ‘D’ to change how the diff is displayed in that buffer.  And then you
   1720 press ‘RET’ on another commit to show that instead and the diff
   1721 arguments are reset to the default.  Not cool; so Magit does not do that
   1722 by default.
   1723 
   1724  -- User Option: magit-prefix-use-buffer-arguments
   1725 
   1726      This option controls whether the infix arguments initially shown in
   1727      certain transient prefix commands are based on the arguments that
   1728      are currently in effect in the buffer that their suffixes update.
   1729 
   1730      The ‘magit-diff’ and ‘magit-log’ transient prefix commands are
   1731      affected by this option.
   1732 
   1733  -- User Option: magit-direct-use-buffer-arguments
   1734 
   1735      This option controls whether certain commands, when invoked
   1736      directly (i.e.  not as the suffix of a transient prefix command),
   1737      use the arguments that are currently active in the buffer that they
   1738      are about to update.  The alternative is to use the default value
   1739      for these arguments, which might change the arguments that are used
   1740      in the buffer.
   1741 
   1742 Valid values for both of the above options are:
   1743 
   1744    • ‘always’: Always use the set of arguments that is currently active
   1745      in the respective buffer, provided that buffer exists of course.
   1746 
   1747    • ‘selected’ or ‘t’: Use the set of arguments from the respective
   1748      buffer, but only if it is displayed in a window of the current
   1749      frame.  This is the default for both variables.
   1750 
   1751    • ‘current’: Use the set of arguments from the respective buffer, but
   1752      only if it is the current buffer.
   1753 
   1754    • ‘never’: Never use the set of arguments from the respective buffer.
   1755 
   1756 I am afraid it gets more complicated still:
   1757 
   1758    • The global diff and log arguments are set for each supported mode
   1759      individually.  The diff arguments for example have different values
   1760      in ‘magit-diff-mode’, ‘magit-revision-mode’,
   1761      ‘magit-merge-preview-mode’ and ‘magit-status-mode’ buffers.
   1762      Setting or saving the value for one mode does not change the value
   1763      for other modes.  The history however is shared.
   1764 
   1765    • When ‘magit-show-commit’ is invoked directly from a log buffer,
   1766      then the file filter is picked up from that buffer, not from the
   1767      revision buffer or the mode’s global diff arguments.
   1768 
   1769    • Even though they are suffixes of the diff prefix
   1770      ‘magit-show-commit’ and ‘magit-stash-show’ do not use the diff
   1771      buffer used by the diff commands, instead they use the dedicated
   1772      revision and stash buffers.
   1773 
   1774      At the time you invoke the diff prefix it is unknown to Magit which
   1775      of the suffix commands you are going to invoke.  While not certain,
   1776      more often than not users invoke one of the commands that use the
   1777      diff buffer, so the initial infix arguments are those used in that
   1778      buffer.  However if you invoke one of these commands directly, then
   1779      Magit knows that it should use the arguments from the revision
   1780      resp.  stash buffer.
   1781 
   1782    • The log prefix also features reflog commands, but these commands do
   1783      not use the log arguments.
   1784 
   1785    • If ‘magit-show-refs’ is invoked from a ‘magit-refs-mode’ buffer,
   1786      then it acts as a refresh prefix and therefore unconditionally uses
   1787      the buffer’s arguments as initial arguments.  If it is invoked
   1788      elsewhere with a prefix argument, then it acts as regular prefix
   1789      and therefore respects ‘magit-prefix-use-buffer-arguments’.  If it
   1790      is invoked elsewhere without a prefix argument, then it acts as a
   1791      direct command and therefore respects
   1792      ‘magit-direct-use-buffer-arguments’.
   1793 
   1794 
   1795 File: magit.info,  Node: Completion Confirmation and the Selection,  Next: Running Git,  Prev: Transient Arguments and Buffer Variables,  Up: Interface Concepts
   1796 
   1797 4.5 Completion, Confirmation and the Selection
   1798 ==============================================
   1799 
   1800 * Menu:
   1801 
   1802 * Action Confirmation::
   1803 * Completion and Confirmation::
   1804 * The Selection::
   1805 * The hunk-internal region::
   1806 * Support for Completion Frameworks::
   1807 * Additional Completion Options::
   1808 
   1809 
   1810 File: magit.info,  Node: Action Confirmation,  Next: Completion and Confirmation,  Up: Completion Confirmation and the Selection
   1811 
   1812 4.5.1 Action Confirmation
   1813 -------------------------
   1814 
   1815 By default many actions that could potentially lead to data loss have to
   1816 be confirmed.  This includes many very common actions, so this can
   1817 quickly become annoying.  Many of these actions can be undone and if you
   1818 have thought about how to undo certain mistakes, then it should be safe
   1819 to disable confirmation for the respective actions.
   1820 
   1821    The option ‘magit-no-confirm’ can be used to tell Magit to perform
   1822 certain actions without the user having to confirm them.  Note that
   1823 while this option can only be used to disable confirmation for a
   1824 specific set of actions, the next section explains another way of
   1825 telling Magit to ask fewer questions.
   1826 
   1827  -- User Option: magit-no-confirm
   1828 
   1829      The value of this option is a list of symbols, representing actions
   1830      that do not have to be confirmed by the user before being carried
   1831      out.
   1832 
   1833      By default many potentially dangerous commands ask the user for
   1834      confirmation.  Each of the below symbols stands for an action
   1835      which, when invoked unintentionally or without being fully aware of
   1836      the consequences, could lead to tears.  In many cases there are
   1837      several commands that perform variations of a certain action, so we
   1838      don’t use the command names but more generic symbols.
   1839 
   1840         • Applying changes:
   1841 
   1842              • ‘discard’ Discarding one or more changes (i.e.  hunks or
   1843                the complete diff for a file) loses that change,
   1844                obviously.
   1845 
   1846              • ‘reverse’ Reverting one or more changes can usually be
   1847                undone by reverting the reversion.
   1848 
   1849              • ‘stage-all-changes’, ‘unstage-all-changes’ When there are
   1850                both staged and unstaged changes, then un-/staging
   1851                everything would destroy that distinction.  Of course
   1852                that also applies when un-/staging a single change, but
   1853                then less is lost and one does that so often that having
   1854                to confirm every time would be unacceptable.
   1855 
   1856         • Files:
   1857 
   1858              • ‘delete’ When a file that isn’t yet tracked by Git is
   1859                deleted, then it is completely lost, not just the last
   1860                changes.  Very dangerous.
   1861 
   1862              • ‘trash’ Instead of deleting a file it can also be move to
   1863                the system trash.  Obviously much less dangerous than
   1864                deleting it.
   1865 
   1866                Also see option ‘magit-delete-by-moving-to-trash’.
   1867 
   1868              • ‘resurrect’ A deleted file can easily be resurrected by
   1869                "deleting" the deletion, which is done using the same
   1870                command that was used to delete the same file in the
   1871                first place.
   1872 
   1873              • ‘untrack’ Untracking a file can be undone by tracking it
   1874                again.
   1875 
   1876              • ‘rename’ Renaming a file can easily be undone.
   1877 
   1878         • Sequences:
   1879 
   1880              • ‘reset-bisect’ Aborting (known to Git as "resetting") a
   1881                bisect operation loses all information collected so far.
   1882 
   1883              • ‘abort-rebase’ Aborting a rebase throws away all already
   1884                modified commits, but it’s possible to restore those from
   1885                the reflog.
   1886 
   1887              • ‘abort-merge’ Aborting a merge throws away all conflict
   1888                resolutions which have already been carried out by the
   1889                user.
   1890 
   1891              • ‘merge-dirty’ Merging with a dirty worktree can make it
   1892                hard to go back to the state before the merge was
   1893                initiated.
   1894 
   1895         • References:
   1896 
   1897              • ‘delete-unmerged-branch’ Once a branch has been deleted,
   1898                it can only be restored using low-level recovery tools
   1899                provided by Git.  And even then the reflog is gone.  The
   1900                user always has to confirm the deletion of a branch by
   1901                accepting the default choice (or selecting another
   1902                branch), but when a branch has not been merged yet, also
   1903                make sure the user is aware of that.
   1904 
   1905              • ‘delete-pr-remote’ When deleting a branch that was
   1906                created from a pull-request and if no other branches
   1907                still exist on that remote, then ‘magit-branch-delete’
   1908                offers to delete the remote as well.  This should be safe
   1909                because it only happens if no other refs exist in the
   1910                remotes namespace, and you can recreate the remote if
   1911                necessary.
   1912 
   1913              • ‘drop-stashes’ Dropping a stash is dangerous because Git
   1914                stores stashes in the reflog.  Once a stash is removed,
   1915                there is no going back without using low-level recovery
   1916                tools provided by Git.  When a single stash is dropped,
   1917                then the user always has to confirm by accepting the
   1918                default (or selecting another).  This action only
   1919                concerns the deletion of multiple stashes at once.
   1920 
   1921         • Publishing:
   1922 
   1923              • ‘set-and-push’ When pushing to the upstream or the
   1924                push-remote and that isn’t actually configured yet, then
   1925                the user can first set the target.  If s/he confirms the
   1926                default too quickly, then s/he might end up pushing to
   1927                the wrong branch and if the remote repository is
   1928                configured to disallow fixing such mistakes, then that
   1929                can be quite embarrassing and annoying.
   1930 
   1931         • Edit published history:
   1932 
   1933           Without adding these symbols here, you will be warned before
   1934           editing commits that have already been pushed to one of the
   1935           branches listed in ‘magit-published-branches’.
   1936 
   1937              • ‘amend-published’ Affects most commands that amend to
   1938                "HEAD".
   1939 
   1940              • ‘rebase-published’ Affects commands that perform
   1941                interactive rebases.  This includes commands from the
   1942                commit transient that modify a commit other than "HEAD",
   1943                namely the various fixup and squash variants.
   1944 
   1945              • ‘edit-published’ Affects the commands
   1946                ‘magit-edit-line-commit’ and
   1947                ‘magit-diff-edit-hunk-commit’.  These two commands make
   1948                it quite easy to accidentally edit a published commit, so
   1949                you should think twice before configuring them not to ask
   1950                for confirmation.
   1951 
   1952           To disable confirmation completely, add all three symbols here
   1953           or set ‘magit-published-branches’ to ‘nil’.
   1954 
   1955         • Various:
   1956 
   1957              • ‘kill-process’ There seldom is a reason to kill a
   1958                process.
   1959 
   1960         • Global settings:
   1961 
   1962           Instead of adding all of the above symbols to the value of
   1963           this option, you can also set it to the atom ‘t’, which has
   1964           the same effect as adding all of the above symbols.  Doing
   1965           that most certainly is a bad idea, especially because other
   1966           symbols might be added in the future.  So even if you don’t
   1967           want to be asked for confirmation for any of these actions,
   1968           you are still better of adding all of the respective symbols
   1969           individually.
   1970 
   1971           When ‘magit-wip-before-change-mode’ is enabled, then the
   1972           following actions can be undone fairly easily: ‘discard’,
   1973           ‘reverse’, ‘stage-all-changes’, and ‘unstage-all-changes’.  If
   1974           and only if this mode is enabled, then ‘safe-with-wip’ has the
   1975           same effect as adding all of these symbols individually.
   1976 
   1977 
   1978 File: magit.info,  Node: Completion and Confirmation,  Next: The Selection,  Prev: Action Confirmation,  Up: Completion Confirmation and the Selection
   1979 
   1980 4.5.2 Completion and Confirmation
   1981 ---------------------------------
   1982 
   1983 Many Magit commands ask the user to select from a list of possible
   1984 things to act on, while offering the most likely choice as the default.
   1985 For many of these commands the default is the thing at point, provided
   1986 that it actually is a valid thing to act on.  For many commands that act
   1987 on a branch, the current branch serves as the default if there is no
   1988 branch at point.
   1989 
   1990    These commands combine asking for confirmation and asking for a
   1991 target to act on into a single action.  The user can confirm the default
   1992 target using ‘RET’ or abort using ‘C-g’.  This is similar to a
   1993 ‘y-or-n-p’ prompt, but the keys to confirm or abort differ.
   1994 
   1995    At the same time the user is also given the opportunity to select
   1996 another target, which is useful because for some commands and/or in some
   1997 situations you might want to select the action before selecting the
   1998 target by moving to it.
   1999 
   2000    However you might find that for some commands you always want to use
   2001 the default target, if any, or even that you want the command to act on
   2002 the default without requiring any confirmation at all.  The option
   2003 ‘magit-dwim-selection’ can be used to configure certain commands to that
   2004 effect.
   2005 
   2006    Note that when the region is active then many commands act on the
   2007 things that are selected using a mechanism based on the region, in many
   2008 cases after asking for confirmation.  This region-based mechanism is
   2009 called the "selection" and is described in detail in the next section.
   2010 When a selection exists that is valid for the invoked command, then that
   2011 command never offers to act on something else, and whether it asks for
   2012 confirmation is not controlled by this option.
   2013 
   2014    Also note that Magit asks for confirmation of certain actions that
   2015 are not coupled with completion (or the selection).  Such dialogs are
   2016 also not affected by this option and are described in the previous
   2017 section.
   2018 
   2019  -- User Option: magit-dwim-selection
   2020 
   2021    This option can be used to tell certain commands to use the thing at
   2022 point instead of asking the user to select a candidate to act on, with
   2023 or without confirmation.
   2024 
   2025    The value has the form ‘((COMMAND nil|PROMPT DEFAULT)...)’.
   2026 
   2027    • COMMAND is the command that should not prompt for a choice.  To
   2028      have an effect, the command has to use the function
   2029      ‘magit-completing-read’ or a utility function which in turn uses
   2030      that function.
   2031 
   2032    • If the command uses ‘magit-completing-read’ multiple times, then
   2033      PROMPT can be used to only affect one of these uses.  PROMPT, if
   2034      non-nil, is a regular expression that is used to match against the
   2035      PROMPT argument passed to ‘magit-completing-read’.
   2036 
   2037    • DEFAULT specifies how to use the default.  If it is ‘t’, then the
   2038      DEFAULT argument passed to ‘magit-completing-read’ is used without
   2039      confirmation.  If it is ‘ask’, then the user is given a chance to
   2040      abort.  DEFAULT can also be ‘nil’, in which case the entry has no
   2041      effect.
   2042 
   2043 
   2044 File: magit.info,  Node: The Selection,  Next: The hunk-internal region,  Prev: Completion and Confirmation,  Up: Completion Confirmation and the Selection
   2045 
   2046 4.5.3 The Selection
   2047 -------------------
   2048 
   2049 If the region is active, then many Magit commands act on the things that
   2050 are selected using a mechanism based on the region instead of one single
   2051 thing.  When the region is not active, then these commands act on the
   2052 thing at point or read a single thing to act on.  This is described in
   2053 the previous section — this section only covers how multiple things are
   2054 selected, how that is visualized, and how certain commands behave when
   2055 that is the case.
   2056 
   2057    Magit’s mechanism for selecting multiple things, or rather sections
   2058 that represent these things, is based on the Emacs region, but the area
   2059 that Magit considers to be selected is typically larger than the region
   2060 and additional restrictions apply.
   2061 
   2062    Magit makes a distinction between a region that qualifies as forming
   2063 a valid Magit selection and a region that does not.  If the region does
   2064 not qualify, then it is displayed as it is in other Emacs buffers.  If
   2065 the region does qualify as a Magit selection, then the selection is
   2066 always visualized, while the region itself is only visualized if it
   2067 begins and ends on the same line.
   2068 
   2069    For a region to qualify as a Magit selection, it must begin in the
   2070 heading of one section and end in the heading of a sibling section.
   2071 Note that if the end of the region is at the very beginning of section
   2072 heading (i.e.  at the very beginning of a line) then that section is
   2073 considered to be *inside* the selection.
   2074 
   2075    This is not consistent with how the region is normally treated in
   2076 Emacs — if the region ends at the beginning of a line, then that line is
   2077 outside the region.  Due to how Magit visualizes the selection, it
   2078 should be obvious that this difference exists.
   2079 
   2080    Not every command acts on every valid selection.  Some commands do
   2081 not even consider the location of point, others may act on the section
   2082 at point but not support acting on the selection, and even commands that
   2083 do support the selection of course only do so if it selects things that
   2084 they can act on.
   2085 
   2086    This is the main reason why the selection must include the section at
   2087 point.  Even if a selection exists, the invoked command may disregard
   2088 it, in which case it may act on the current section only.  It is much
   2089 safer to only act on the current section but not the other selected
   2090 sections than it is to act on the current section *instead* of the
   2091 selected sections.  The latter would be much more surprising and if the
   2092 current section always is part of the selection, then that cannot
   2093 happen.
   2094 
   2095  -- Variable: magit-keep-region-overlay
   2096 
   2097      This variable controls whether the region is visualized as usual
   2098      even when a valid Magit selection or a hunk-internal region exists.
   2099      See the doc-string for more information.
   2100 
   2101 
   2102 File: magit.info,  Node: The hunk-internal region,  Next: Support for Completion Frameworks,  Prev: The Selection,  Up: Completion Confirmation and the Selection
   2103 
   2104 4.5.4 The hunk-internal region
   2105 ------------------------------
   2106 
   2107 Somewhat related to the Magit selection described in the previous
   2108 section is the hunk-internal region.
   2109 
   2110    Like the selection, the hunk-internal region is based on the Emacs
   2111 region but causes that region to not be visualized as it would in other
   2112 Emacs buffers, and includes the line on which the region ends even if it
   2113 ends at the very beginning of that line.
   2114 
   2115    Unlike the selection, which is based on a region that must begin in
   2116 the heading of one section and ends in the section of a sibling section,
   2117 the hunk-internal region must begin inside the *body* of a hunk section
   2118 and end in the body of the *same* section.
   2119 
   2120    The hunk-internal region is honored by "apply" commands, which can,
   2121 among other targets, act on a hunk.  If the hunk-internal region is
   2122 active, then such commands act only on the marked part of the hunk
   2123 instead of on the complete hunk.
   2124 
   2125 
   2126 File: magit.info,  Node: Support for Completion Frameworks,  Next: Additional Completion Options,  Prev: The hunk-internal region,  Up: Completion Confirmation and the Selection
   2127 
   2128 4.5.5 Support for Completion Frameworks
   2129 ---------------------------------------
   2130 
   2131 The built-in option ‘completing-read-function’ specifies the low-level
   2132 function used by ‘completing-read’ to ask a user to select from a list
   2133 of choices.  Its default value is ‘completing-read-default’.
   2134 Alternative completion frameworks typically activate themselves by
   2135 substituting their own implementation.
   2136 
   2137    Mostly for historic reasons Magit provides a similar option named
   2138 ‘magit-completing-read-function’, which only controls the low-level
   2139 function used by ‘magit-completing-read’.  This option also makes it
   2140 possible to use a different completing mechanism for Magit than for the
   2141 rest of Emacs, but doing that is not recommend.
   2142 
   2143    You most likely don’t have to customize the magit-specific option to
   2144 use an alternative completion framework.  For example, if you enable
   2145 ‘ivy-mode’, then Magit will respect that, and if you enable ‘helm-mode’,
   2146 then you are done too.
   2147 
   2148    However if you want to use Ido, then ‘ido-mode’ won’t do the trick.
   2149 You will also have to install the ‘ido-completing-read+’ package and use
   2150 ‘magit-ido-completing-read’ as ‘magit-completing-read-function’.
   2151 
   2152  -- User Option: magit-completing-read-function
   2153 
   2154      The value of this variable is the low-level function used to
   2155      perform completion by code that uses ‘magit-completing-read’ (as
   2156      opposed to the built-in ‘completing-read’).
   2157 
   2158      The default value, ‘magit-builtin-completing-read’, is suitable for
   2159      the standard completion mechanism, ‘ivy-mode’, and ‘helm-mode’ at
   2160      least.
   2161 
   2162      The built-in ‘completing-read’ and ‘completing-read-default’ are
   2163      *not* suitable to be used here.  ‘magit-builtin-completing-read’
   2164      performs some additional work, and any function used in its place
   2165      has to do the same.
   2166 
   2167  -- Function: magit-builtin-completing-read prompt choices &optional
   2168           predicate require-match initial-input hist def
   2169 
   2170      This function performs completion using the built-in
   2171      ‘completing-read’ and does some additional magit-specific work.
   2172 
   2173  -- Function: magit-ido-completing-read prompt choices &optional
   2174           predicate require-match initial-input hist def
   2175 
   2176      This function performs completion using ‘ido-completing-read+’ from
   2177      the package by the same name (which you have to explicitly install)
   2178      and does some additional magit-specific work.
   2179 
   2180      We have to use ‘ido-completing-read+’ instead of the
   2181      ‘ido-completing-read’ that comes with Ido itself, because the
   2182      latter, while intended as a drop-in replacement, cannot serve that
   2183      purpose because it violates too many of the implicit conventions.
   2184 
   2185  -- Function: magit-completing-read prompt choices &optional predicate
   2186           require-match initial-input hist def fallback
   2187 
   2188      This is the function that Magit commands use when they need the
   2189      user to select a single thing to act on.  The arguments have the
   2190      same meaning as for ‘completing-read’, except for FALLBACK, which
   2191      is unique to this function and is described below.
   2192 
   2193      Instead of asking the user to choose from a list of possible
   2194      candidates, this function may just return the default specified by
   2195      DEF, with or without requiring user confirmation.  Whether that is
   2196      the case depends on PROMPT, ‘this-command’ and
   2197      ‘magit-dwim-selection’.  See the documentation of the latter for
   2198      more information.
   2199 
   2200      If it does read a value in the minibuffer, then this function acts
   2201      similar to ‘completing-read’, except for the following:
   2202 
   2203         • COLLECTION must be a list of choices.  A function is not
   2204           supported.
   2205 
   2206         • If REQUIRE-MATCH is ‘nil’ and the user exits without a choice,
   2207           then ‘nil’ is returned instead of an empty string.
   2208 
   2209         • If REQUIRE-MATCH is non-nil and the users exits without a
   2210           choice, an user-error is raised.
   2211 
   2212         • FALLBACK specifies a secondary default that is only used if
   2213           the primary default DEF is ‘nil’.  The secondary default is
   2214           not subject to ‘magit-dwim-selection’ — if DEF is ‘nil’ but
   2215           FALLBACK is not, then this function always asks the user to
   2216           choose a candidate, just as if both defaults were ‘nil’.
   2217 
   2218         • ": " is appended to PROMPT.
   2219 
   2220         • PROMPT is modified to end with \" (default DEF|FALLBACK): \"
   2221           provided that DEF or FALLBACK is non-nil, that neither
   2222           ‘ivy-mode’ nor ‘helm-mode’ is enabled, and that
   2223           ‘magit-completing-read-function’ is set to its default value
   2224           of ‘magit-builtin-completing-read’.
   2225 
   2226 
   2227 File: magit.info,  Node: Additional Completion Options,  Prev: Support for Completion Frameworks,  Up: Completion Confirmation and the Selection
   2228 
   2229 4.5.6 Additional Completion Options
   2230 -----------------------------------
   2231 
   2232  -- User Option: magit-list-refs-sortby
   2233 
   2234      For many commands that read a ref or refs from the user, the value
   2235      of this option can be used to control the order of the refs.  Valid
   2236      values include any key accepted by the ‘--sort’ flag of ‘git
   2237      for-each-ref’.  By default, refs are sorted alphabetically by their
   2238      full name (e.g., "refs/heads/master").
   2239 
   2240 
   2241 File: magit.info,  Node: Running Git,  Prev: Completion Confirmation and the Selection,  Up: Interface Concepts
   2242 
   2243 4.6 Running Git
   2244 ===============
   2245 
   2246 * Menu:
   2247 
   2248 * Viewing Git Output::
   2249 * Git Process Status::
   2250 * Running Git Manually::
   2251 * Git Executable::
   2252 * Global Git Arguments::
   2253 
   2254 
   2255 File: magit.info,  Node: Viewing Git Output,  Next: Git Process Status,  Up: Running Git
   2256 
   2257 4.6.1 Viewing Git Output
   2258 ------------------------
   2259 
   2260 Magit runs Git either for side-effects (e.g.  when pushing) or to get
   2261 some value (e.g.  the name of the current branch).
   2262 
   2263    When Git is run for side-effects, the process output is logged in a
   2264 per-repository log buffer, which can be consulted using the
   2265 ‘magit-process’ command when things don’t go as expected.
   2266 
   2267    The output/errors for up to ‘magit-process-log-max’ Git commands are
   2268 retained.
   2269 
   2270 ‘$’     (‘magit-process’)
   2271 
   2272      This commands displays the process buffer for the current
   2273      repository.
   2274 
   2275    Inside that buffer, the usual key bindings for navigating and showing
   2276 sections are available.  There is one additional command.
   2277 
   2278 ‘k’     (‘magit-process-kill’)
   2279 
   2280      This command kills the process represented by the section at point.
   2281 
   2282  -- Variable: magit-git-debug
   2283 
   2284      This option controls whether additional reporting of git errors is
   2285      enabled.
   2286 
   2287      Magit basically calls git for one of these two reasons: for
   2288      side-effects or to do something with its standard output.
   2289 
   2290      When git is run for side-effects then its output, including error
   2291      messages, go into the process buffer which is shown when using ‘$’.
   2292 
   2293      When git’s output is consumed in some way, then it would be too
   2294      expensive to also insert it into this buffer, but when this option
   2295      is non-nil and git returns with a non-zero exit status, then at
   2296      least its standard error is inserted into this buffer.
   2297 
   2298      This is only intended for debugging purposes.  Do not enable this
   2299      permanently, that would negatively affect performance.
   2300 
   2301  -- Variable: magit-process-extreme-logging
   2302 
   2303      This option controls whether ‘magit-process-file’ logs to the
   2304      ‘*Messages*’ buffer.
   2305 
   2306      Only intended for temporary use when you try to figure out how
   2307      Magit uses Git behind the scene.  Output that normally goes to the
   2308      magit-process buffer continues to go there.  Not all output goes to
   2309      either of these two buffers.
   2310 
   2311 
   2312 File: magit.info,  Node: Git Process Status,  Next: Running Git Manually,  Prev: Viewing Git Output,  Up: Running Git
   2313 
   2314 4.6.2 Git Process Status
   2315 ------------------------
   2316 
   2317 When a Git process is running for side-effects, Magit displays an
   2318 indicator in the mode line, using the ‘magit-mode-line-process’ face.
   2319 
   2320    If the Git process exits successfully, the process indicator is
   2321 removed from the mode line immediately.
   2322 
   2323    In the case of a Git error, the process indicator is not removed, but
   2324 is instead highlighted with the ‘magit-mode-line-process-error’ face,
   2325 and the error details from the process buffer are provided as a tooltip
   2326 for mouse users.  This error indicator persists in the mode line until
   2327 the next magit buffer refresh.
   2328 
   2329    If you do not wish process errors to be indicated in the mode line,
   2330 customize the ‘magit-process-display-mode-line-error’ user option.
   2331 
   2332    Process errors are additionally indicated at the top of the status
   2333 buffer.
   2334 
   2335 
   2336 File: magit.info,  Node: Running Git Manually,  Next: Git Executable,  Prev: Git Process Status,  Up: Running Git
   2337 
   2338 4.6.3 Running Git Manually
   2339 --------------------------
   2340 
   2341 While Magit provides many Emacs commands to interact with Git, it does
   2342 not cover everything.  In those cases your existing Git knowledge will
   2343 come in handy.  Magit provides some commands for running arbitrary Git
   2344 commands by typing them into the minibuffer, instead of having to switch
   2345 to a shell.
   2346 
   2347 ‘!’     (‘magit-run’)
   2348 
   2349      This transient prefix command binds the following suffix commands
   2350      and displays them in a temporary buffer until a suffix is invoked.
   2351 
   2352 ‘! !’     (‘magit-git-command-topdir’)
   2353 
   2354      This command reads a command from the user and executes it in the
   2355      top-level directory of the current working tree.
   2356 
   2357      The string "git " is used as initial input when prompting the user
   2358      for the command.  It can be removed to run another command.
   2359 
   2360 ‘:’     (‘magit-git-command’)
   2361 ‘! p’     (‘magit-git-command’)
   2362 
   2363      This command reads a command from the user and executes it in
   2364      ‘default-directory’.  With a prefix argument the command is
   2365      executed in the top-level directory of the current working tree
   2366      instead.
   2367 
   2368      The string "git " is used as initial input when prompting the user
   2369      for the command.  It can be removed to run another command.
   2370 
   2371 ‘! s’     (‘magit-shell-command-topdir’)
   2372 
   2373      This command reads a command from the user and executes it in the
   2374      top-level directory of the current working tree.
   2375 
   2376 ‘! S’     (‘magit-shell-command’)
   2377 
   2378      This command reads a command from the user and executes it in
   2379      ‘default-directory’.  With a prefix argument the command is
   2380      executed in the top-level directory of the current working tree
   2381      instead.
   2382 
   2383  -- User Option: magit-shell-command-verbose-prompt
   2384 
   2385      Whether the prompt, used by the above commands when reading a shell
   2386      command, shows the directory in which it will be run.
   2387 
   2388    These suffix commands start external gui tools.
   2389 
   2390 ‘! k’     (‘magit-run-gitk’)
   2391 
   2392      This command runs ‘gitk’ in the current repository.
   2393 
   2394 ‘! a’     (‘magit-run-gitk-all’)
   2395 
   2396      This command runs ‘gitk --all’ in the current repository.
   2397 
   2398 ‘! b’     (‘magit-run-gitk-branches’)
   2399 
   2400      This command runs ‘gitk --branches’ in the current repository.
   2401 
   2402 ‘! g’     (‘magit-run-git-gui’)
   2403 
   2404      This command runs ‘git gui’ in the current repository.
   2405 
   2406 
   2407 File: magit.info,  Node: Git Executable,  Next: Global Git Arguments,  Prev: Running Git Manually,  Up: Running Git
   2408 
   2409 4.6.4 Git Executable
   2410 --------------------
   2411 
   2412 When Magit calls Git, then it may do so using the absolute path to the
   2413 ‘git’ executable, or using just its name.
   2414 
   2415    When running ‘git’ locally and the ‘system-type’ is ‘windows-nt’ (any
   2416 Windows version) or ‘darwin’ (macOS) then ‘magit-git-executable’ is set
   2417 to an absolute path when Magit is loaded.
   2418 
   2419    On Windows it is necessary to use an absolute path because Git comes
   2420 with several wrapper scripts for the actual ‘git’ binary, which are also
   2421 placed on ‘$PATH’, and using one of these wrappers instead of the binary
   2422 would degrade performance horribly.  For some macOS users using just the
   2423 name of the executable also performs horribly, so we avoid doing that on
   2424 that platform as well.  On other platforms, using just the name seems to
   2425 work just fine.
   2426 
   2427    Using an absolute path when running ‘git’ on a remote machine over
   2428 Tramp, would be problematic to use an absolute path that is suitable on
   2429 the local machine, so a separate option is used to control the name or
   2430 path that is used on remote machines.
   2431 
   2432  -- User Option: magit-git-executable
   2433 
   2434      The ‘git’ executable used by Magit on the local host.  This should
   2435      be either the absolute path to the executable, or the string "git"
   2436      to let Emacs find the executable itself, using the standard
   2437      mechanism for doing such things.
   2438 
   2439  -- User Option: magit-remote-git-executable
   2440 
   2441      The ‘git’ executable used by Magit on remote machines over Tramp.
   2442      Normally this should be just the string "git".  Consider
   2443      customizing ‘tramp-remote-path’ instead of this option.
   2444 
   2445    If Emacs is unable to find the correct executable, then you can work
   2446 around that by explicitly setting the value of one of these two options.
   2447 Doing that should be considered a kludge; it is better to make sure that
   2448 the order in ‘exec-path’ or ‘tramp-remote-path’ is correct.
   2449 
   2450    Note that ‘exec-path’ is set based on the value of the ‘PATH’
   2451 environment variable that is in effect when Emacs is started.  If you
   2452 set ‘PATH’ in your shell’s init files, then that only has an effect on
   2453 Emacs if you start it from that shell (because the environment of a
   2454 process is only passed to its child processes, not to arbitrary other
   2455 processes).  If that is not how you start Emacs, then the
   2456 ‘exec-path-from-shell’ package can help; though honestly I consider that
   2457 a kludge too.
   2458 
   2459    The command ‘magit-debug-git-executable’ can be useful to find out
   2460 where Emacs is searching for ‘git’.
   2461 
   2462 ‘M-x magit-debug-git-executable’     (‘magit-debug-git-executable’)
   2463 
   2464      This command displays a buffer with information about
   2465      ‘magit-git-executable’ and ‘magit-remote-git-executable’.
   2466 
   2467 ‘M-x magit-version’     (‘magit-version’)
   2468 
   2469      This command shows the currently used versions of Magit, Git, and
   2470      Emacs in the echo area.  Non-interactively this just returns the
   2471      Magit version.
   2472 
   2473 
   2474 File: magit.info,  Node: Global Git Arguments,  Prev: Git Executable,  Up: Running Git
   2475 
   2476 4.6.5 Global Git Arguments
   2477 --------------------------
   2478 
   2479  -- User Option: magit-git-global-arguments
   2480 
   2481      The arguments set here are used every time the git executable is
   2482      run as a subprocess.  They are placed right after the executable
   2483      itself and before the git command - as in ‘git HERE... COMMAND
   2484      REST’.  For valid arguments see *note (gitman)git::.
   2485 
   2486      Be careful what you add here, especially if you are using Tramp to
   2487      connect to servers with ancient Git versions.  Never remove
   2488      anything that is part of the default value, unless you really know
   2489      what you are doing.  And think very hard before adding something;
   2490      it will be used every time Magit runs Git for any purpose.
   2491 
   2492 
   2493 File: magit.info,  Node: Inspecting,  Next: Manipulating,  Prev: Interface Concepts,  Up: Top
   2494 
   2495 5 Inspecting
   2496 ************
   2497 
   2498 The functionality provided by Magit can be roughly divided into three
   2499 groups: inspecting existing data, manipulating existing data or adding
   2500 new data, and transferring data.  Of course that is a rather crude
   2501 distinction that often falls short, but it’s more useful than no
   2502 distinction at all.  This section is concerned with inspecting data, the
   2503 next two with manipulating and transferring it.  Then follows a section
   2504 about miscellaneous functionality, which cannot easily be fit into this
   2505 distinction.
   2506 
   2507    Of course other distinctions make sense too, e.g.  Git’s distinction
   2508 between porcelain and plumbing commands, which for the most part is
   2509 equivalent to Emacs’ distinction between interactive commands and
   2510 non-interactive functions.  All of the sections mentioned before are
   2511 mainly concerned with the porcelain – Magit’s plumbing layer is
   2512 described later.
   2513 
   2514 * Menu:
   2515 
   2516 * Status Buffer::
   2517 * Repository List::
   2518 * Logging::
   2519 * Diffing::
   2520 * Ediffing::
   2521 * References Buffer::
   2522 * Bisecting::
   2523 * Visiting Files and Blobs::
   2524 * Blaming::
   2525 
   2526 
   2527 File: magit.info,  Node: Status Buffer,  Next: Repository List,  Up: Inspecting
   2528 
   2529 5.1 Status Buffer
   2530 =================
   2531 
   2532 While other Magit buffers contain e.g.  one particular diff or one
   2533 particular log, the status buffer contains the diffs for staged and
   2534 unstaged changes, logs for unpushed and unpulled commits, lists of
   2535 stashes and untracked files, and information related to the current
   2536 branch.
   2537 
   2538    During certain incomplete operations – for example when a merge
   2539 resulted in a conflict – additional information is displayed that helps
   2540 proceeding with or aborting the operation.
   2541 
   2542    The command ‘magit-status’ displays the status buffer belonging to
   2543 the current repository in another window.  This command is used so often
   2544 that it should be bound globally.  We recommend using ‘C-x g’:
   2545 
   2546      (global-set-key (kbd "C-x g") 'magit-status)
   2547 
   2548 ‘C-x g’     (‘magit-status’)
   2549 
   2550      When invoked from within an existing Git repository, then this
   2551      command shows the status of that repository in a buffer.
   2552 
   2553      If the current directory isn’t located within a Git repository,
   2554      then this command prompts for an existing repository or an
   2555      arbitrary directory, depending on the option
   2556      ‘magit-repository-directories’, and the status for the selected
   2557      repository is shown instead.
   2558 
   2559         • If that option specifies any existing repositories, then the
   2560           user is asked to select one of them.
   2561 
   2562         • Otherwise the user is asked to select an arbitrary directory
   2563           using regular file-name completion.  If the selected directory
   2564           is the top-level directory of an existing working tree, then
   2565           the status buffer for that is shown.
   2566 
   2567         • Otherwise the user is offered to initialize the selected
   2568           directory as a new repository.  After creating the repository
   2569           its status buffer is shown.
   2570 
   2571      These fallback behaviors can also be forced using one or more
   2572      prefix arguments:
   2573 
   2574         • With two prefix arguments (or more precisely a numeric prefix
   2575           value of 16 or greater) an arbitrary directory is read, which
   2576           is then acted on as described above.  The same could be
   2577           accomplished using the command ‘magit-init’.
   2578 
   2579         • With a single prefix argument an existing repository is read
   2580           from the user, or if no repository can be found based on the
   2581           value of ‘magit-repository-directories’, then the behavior is
   2582           the same as with two prefix arguments.
   2583 
   2584  -- User Option: magit-repository-directories
   2585 
   2586      List of directories that are Git repositories or contain Git
   2587      repositories.
   2588 
   2589      Each element has the form ‘(DIRECTORY . DEPTH)’.  DIRECTORY has to
   2590      be a directory or a directory file-name, a string.  DEPTH, an
   2591      integer, specifies the maximum depth to look for Git repositories.
   2592      If it is 0, then only add DIRECTORY itself.
   2593 
   2594      This option controls which repositories are being listed by
   2595      ‘magit-list-repositories’.  It also affects ‘magit-status’ (which
   2596      see) in potentially surprising ways (see above).
   2597 
   2598  -- Command: magit-status-quick
   2599 
   2600      This command is an alternative to ‘magit-status’ that usually
   2601      avoids refreshing the status buffer.
   2602 
   2603      If the status buffer of the current Git repository exists but isn’t
   2604      being displayed in the selected frame, then it is displayed without
   2605      being refreshed.
   2606 
   2607      If the status buffer is being displayed in the selected frame, then
   2608      this command refreshes it.
   2609 
   2610      Prefix arguments have the same meaning as for ‘magit-status’, and
   2611      additionally cause the buffer to be refresh.
   2612 
   2613      To use this command add this to your init file:
   2614 
   2615           (global-set-key (kbd "C-x g") 'magit-status-quick).
   2616 
   2617      If you do that and then for once want to redisplay the buffer and
   2618      also immediately refresh it, then type ‘C-x g’ followed by ‘g’.
   2619 
   2620      A possible alternative command is
   2621      ‘magit-display-repository-buffer’.  It supports displaying any
   2622      existing Magit buffer that belongs to the current repository; not
   2623      just the status buffer.
   2624 
   2625  -- Command: ido-enter-magit-status
   2626 
   2627      From an Ido prompt used to open a file, instead drop into
   2628      ‘magit-status’.  This is similar to ‘ido-magic-delete-char’, which,
   2629      despite its name, usually causes a Dired buffer to be created.
   2630 
   2631      To make this command available, use something like:
   2632 
   2633           (add-hook 'ido-setup-hook
   2634                     (lambda ()
   2635                       (define-key ido-completion-map
   2636                         (kbd \"C-x g\") 'ido-enter-magit-status)))
   2637 
   2638      Starting with Emacs 25.1 the Ido keymaps are defined just once
   2639      instead of every time Ido is invoked, so now you can modify it like
   2640      pretty much every other keymap:
   2641 
   2642           (define-key ido-common-completion-map
   2643             (kbd \"C-x g\") 'ido-enter-magit-status)
   2644 
   2645 * Menu:
   2646 
   2647 * Status Sections::
   2648 * Status Header Sections::
   2649 * Status Module Sections::
   2650 * Status Options::
   2651 
   2652 
   2653 File: magit.info,  Node: Status Sections,  Next: Status Header Sections,  Up: Status Buffer
   2654 
   2655 5.1.1 Status Sections
   2656 ---------------------
   2657 
   2658 The contents of status buffers is controlled using the hook
   2659 ‘magit-status-sections-hook’.  See *note Section Hooks:: to learn about
   2660 such hooks and how to customize them.
   2661 
   2662  -- User Option: magit-status-sections-hook
   2663 
   2664      Hook run to insert sections into a status buffer.
   2665 
   2666    The first function on that hook by default is
   2667 ‘magit-insert-status-headers’; it is described in the next section.  By
   2668 default the following functions are also members of that hook:
   2669 
   2670  -- Function: magit-insert-merge-log
   2671 
   2672      Insert section for the on-going merge.  Display the heads that are
   2673      being merged.  If no merge is in progress, do nothing.
   2674 
   2675  -- Function: magit-insert-rebase-sequence
   2676 
   2677      Insert section for the on-going rebase sequence.  If no such
   2678      sequence is in progress, do nothing.
   2679 
   2680  -- Function: magit-insert-am-sequence
   2681 
   2682      Insert section for the on-going patch applying sequence.  If no
   2683      such sequence is in progress, do nothing.
   2684 
   2685  -- Function: magit-insert-sequencer-sequence
   2686 
   2687      Insert section for the on-going cherry-pick or revert sequence.  If
   2688      no such sequence is in progress, do nothing.
   2689 
   2690  -- Function: magit-insert-bisect-output
   2691 
   2692      While bisecting, insert section with output from ‘git bisect’.
   2693 
   2694  -- Function: magit-insert-bisect-rest
   2695 
   2696      While bisecting, insert section visualizing the bisect state.
   2697 
   2698  -- Function: magit-insert-bisect-log
   2699 
   2700      While bisecting, insert section logging bisect progress.
   2701 
   2702  -- Function: magit-insert-untracked-files
   2703 
   2704      Maybe insert a list or tree of untracked files.
   2705 
   2706      Do so depending on the value of ‘status.showUntrackedFiles’.  Note
   2707      that even if the value is ‘all’, Magit still initially only shows
   2708      directories.  But the directory sections can then be expanded using
   2709      ‘TAB’.
   2710 
   2711  -- Function: magit-insert-unstaged-changes
   2712 
   2713      Insert section showing unstaged changes.
   2714 
   2715  -- Function: magit-insert-staged-changes
   2716 
   2717      Insert section showing staged changes.
   2718 
   2719  -- Function: magit-insert-stashes &optional ref heading
   2720 
   2721      Insert the ‘stashes’ section showing reflog for "refs/stash".  If
   2722      optional REF is non-nil show reflog for that instead.  If optional
   2723      HEADING is non-nil use that as section heading instead of
   2724      "Stashes:".
   2725 
   2726  -- Function: magit-insert-unpulled-from-upstream
   2727 
   2728      Insert section showing commits that haven’t been pulled from the
   2729      upstream branch yet.
   2730 
   2731  -- Function: magit-insert-unpulled-from-pushremote
   2732 
   2733      Insert section showing commits that haven’t been pulled from the
   2734      push-remote branch yet.
   2735 
   2736  -- Function: magit-insert-unpushed-to-upstream
   2737 
   2738      Insert section showing commits that haven’t been pushed to the
   2739      upstream yet.
   2740 
   2741  -- Function: magit-insert-unpushed-to-pushremote
   2742 
   2743      Insert section showing commits that haven’t been pushed to the
   2744      push-remote yet.
   2745 
   2746    The following functions can also be added to the above hook:
   2747 
   2748  -- Function: magit-insert-tracked-files
   2749 
   2750      Insert a tree of tracked files.
   2751 
   2752  -- Function: magit-insert-ignored-files
   2753 
   2754      Insert a tree of ignored files.  Its possible to limit the logs in
   2755      the current buffer to a certain directory using ‘D = f <DIRECTORY>
   2756      RET g’.  If you do that, then that that also affects this command.
   2757 
   2758      The log filter can be used to limit to multiple files.  In that
   2759      case this function only respects the first of the files and only if
   2760      it is a directory.
   2761 
   2762  -- Function: magit-insert-skip-worktree-files
   2763 
   2764      Insert a tree of skip-worktree files.  If the first element of
   2765      ‘magit-buffer-diff-files’ is a directory, then limit the list to
   2766      files below that.  The value of that variable can be set using ‘D
   2767      -- DIRECTORY RET g’.
   2768 
   2769  -- Function: magit-insert-assumed-unchanged-files
   2770 
   2771      Insert a tree of files that are assumed to be unchanged.  If the
   2772      first element of ‘magit-buffer-diff-files’ is a directory, then
   2773      limit the list to files below that.  The value of that variable can
   2774      be set using ‘D -- DIRECTORY RET g’.
   2775 
   2776  -- Function: magit-insert-unpulled-or-recent-commits
   2777 
   2778      Insert section showing unpulled or recent commits.  If an upstream
   2779      is configured for the current branch and it is ahead of the current
   2780      branch, then show the missing commits.  Otherwise, show the last
   2781      ‘magit-log-section-commit-count’ commits.
   2782 
   2783  -- Function: magit-insert-recent-commits
   2784 
   2785      Insert section showing the last ‘magit-log-section-commit-count’
   2786      commits.
   2787 
   2788  -- User Option: magit-log-section-commit-count
   2789 
   2790      How many recent commits ‘magit-insert-recent-commits’ and
   2791      ‘magit-insert-unpulled-or-recent-commits’ (provided there are no
   2792      unpulled commits) show.
   2793 
   2794  -- Function: magit-insert-unpulled-cherries
   2795 
   2796      Insert section showing unpulled commits.  Like
   2797      ‘magit-insert-unpulled-commits’ but prefix each commit that has not
   2798      been applied yet (i.e.  a commit with a patch-id not shared with
   2799      any local commit) with "+", and all others with "-".
   2800 
   2801  -- Function: magit-insert-unpushed-cherries
   2802 
   2803      Insert section showing unpushed commits.  Like
   2804      ‘magit-insert-unpushed-commits’ but prefix each commit which has
   2805      not been applied to upstream yet (i.e.  a commit with a patch-id
   2806      not shared with any upstream commit) with "+" and all others with
   2807      "-".
   2808 
   2809    See *note References Buffer:: for some more section inserters, which
   2810 could be used here.
   2811 
   2812 
   2813 File: magit.info,  Node: Status Header Sections,  Next: Status Module Sections,  Prev: Status Sections,  Up: Status Buffer
   2814 
   2815 5.1.2 Status Header Sections
   2816 ----------------------------
   2817 
   2818 The contents of status buffers is controlled using the hook
   2819 ‘magit-status-sections-hook’ (see *note Status Sections::).
   2820 
   2821    By default ‘magit-insert-status-headers’ is the first member of that
   2822 hook variable.
   2823 
   2824  -- Function: magit-insert-status-headers
   2825 
   2826      Insert headers sections appropriate for ‘magit-status-mode’
   2827      buffers.  The sections are inserted by running the functions on the
   2828      hook ‘magit-status-headers-hook’.
   2829 
   2830  -- User Option: magit-status-headers-hook
   2831 
   2832      Hook run to insert headers sections into the status buffer.
   2833 
   2834      This hook is run by ‘magit-insert-status-headers’, which in turn
   2835      has to be a member of ‘magit-status-sections-hook’ to be used at
   2836      all.
   2837 
   2838    By default the following functions are members of the above hook:
   2839 
   2840  -- Function: magit-insert-error-header
   2841 
   2842      Insert a header line showing the message about the Git error that
   2843      just occurred.
   2844 
   2845      This function is only aware of the last error that occur when Git
   2846      was run for side-effects.  If, for example, an error occurs while
   2847      generating a diff, then that error won’t be inserted.  Refreshing
   2848      the status buffer causes this section to disappear again.
   2849 
   2850  -- Function: magit-insert-diff-filter-header
   2851 
   2852      Insert a header line showing the effective diff filters.
   2853 
   2854  -- Function: magit-insert-head-branch-header
   2855 
   2856      Insert a header line about the current branch or detached ‘HEAD’.
   2857 
   2858  -- Function: magit-insert-upstream-branch-header
   2859 
   2860      Insert a header line about the branch that is usually pulled into
   2861      the current branch.
   2862 
   2863  -- Function: magit-insert-push-branch-header
   2864 
   2865      Insert a header line about the branch that the current branch is
   2866      usually pushed to.
   2867 
   2868  -- Function: magit-insert-tags-header
   2869 
   2870      Insert a header line about the current and/or next tag, along with
   2871      the number of commits between the tag and ‘HEAD’.
   2872 
   2873    The following functions can also be added to the above hook:
   2874 
   2875  -- Function: magit-insert-repo-header
   2876 
   2877      Insert a header line showing the path to the repository top-level.
   2878 
   2879  -- Function: magit-insert-remote-header
   2880 
   2881      Insert a header line about the remote of the current branch.
   2882 
   2883      If no remote is configured for the current branch, then fall back
   2884      showing the "origin" remote, or if that does not exist the first
   2885      remote in alphabetic order.
   2886 
   2887  -- Function: magit-insert-user-header
   2888 
   2889      Insert a header line about the current user.
   2890 
   2891 
   2892 File: magit.info,  Node: Status Module Sections,  Next: Status Options,  Prev: Status Header Sections,  Up: Status Buffer
   2893 
   2894 5.1.3 Status Module Sections
   2895 ----------------------------
   2896 
   2897 The contents of status buffers is controlled using the hook
   2898 ‘magit-status-sections-hook’ (see *note Status Sections::).
   2899 
   2900    By default ‘magit-insert-modules’ is _not_ a member of that hook
   2901 variable.
   2902 
   2903  -- Function: magit-insert-modules
   2904 
   2905      Insert submodule sections.
   2906 
   2907      Hook ‘magit-module-sections-hook’ controls which module sections
   2908      are inserted, and option ‘magit-module-sections-nested’ controls
   2909      whether they are wrapped in an additional section.
   2910 
   2911  -- User Option: magit-module-sections-hook
   2912 
   2913      Hook run by ‘magit-insert-modules’.
   2914 
   2915  -- User Option: magit-module-sections-nested
   2916 
   2917      This option controls whether ‘magit-insert-modules’ wraps inserted
   2918      sections in an additional section.
   2919 
   2920      If this is non-nil, then only a single top-level section is
   2921      inserted.  If it is nil, then all sections listed in
   2922      ‘magit-module-sections-hook’ become top-level sections.
   2923 
   2924  -- Function: magit-insert-modules-overview
   2925 
   2926      Insert sections for all submodules.  For each section insert the
   2927      path, the branch, and the output of ‘git describe --tags’, or,
   2928      failing that, the abbreviated HEAD commit hash.
   2929 
   2930      Press ‘RET’ on such a submodule section to show its own status
   2931      buffer.  Press ‘RET’ on the "Modules" section to display a list of
   2932      submodules in a separate buffer.  This shows additional information
   2933      not displayed in the super-repository’s status buffer.
   2934 
   2935  -- Function: magit-insert-modules-unpulled-from-upstream
   2936 
   2937      Insert sections for modules that haven’t been pulled from the
   2938      upstream yet.  These sections can be expanded to show the
   2939      respective commits.
   2940 
   2941  -- Function: magit-insert-modules-unpulled-from-pushremote
   2942 
   2943      Insert sections for modules that haven’t been pulled from the
   2944      push-remote yet.  These sections can be expanded to show the
   2945      respective commits.
   2946 
   2947  -- Function: magit-insert-modules-unpushed-to-upstream
   2948 
   2949      Insert sections for modules that haven’t been pushed to the
   2950      upstream yet.  These sections can be expanded to show the
   2951      respective commits.
   2952 
   2953  -- Function: magit-insert-modules-unpushed-to-pushremote
   2954 
   2955      Insert sections for modules that haven’t been pushed to the
   2956      push-remote yet.  These sections can be expanded to show the
   2957      respective commits.
   2958 
   2959 
   2960 File: magit.info,  Node: Status Options,  Prev: Status Module Sections,  Up: Status Buffer
   2961 
   2962 5.1.4 Status Options
   2963 --------------------
   2964 
   2965  -- User Option: magit-status-refresh-hook
   2966 
   2967      Hook run after a status buffer has been refreshed.
   2968 
   2969  -- User Option: magit-status-margin
   2970 
   2971      This option specifies whether the margin is initially shown in
   2972      Magit-Status mode buffers and how it is formatted.
   2973 
   2974      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   2975 
   2976         • If INIT is non-nil, then the margin is shown initially.
   2977 
   2978         • STYLE controls how to format the author or committer date.  It
   2979           can be one of ‘age’ (to show the age of the commit),
   2980           ‘age-abbreviated’ (to abbreviate the time unit to a
   2981           character), or a string (suitable for ‘format-time-string’) to
   2982           show the actual date.  Option
   2983           ‘magit-log-margin-show-committer-date’ controls which date is
   2984           being displayed.
   2985 
   2986         • WIDTH controls the width of the margin.  This exists for
   2987           forward compatibility and currently the value should not be
   2988           changed.
   2989 
   2990         • AUTHOR controls whether the name of the author is also shown
   2991           by default.
   2992 
   2993         • AUTHOR-WIDTH has to be an integer.  When the name of the
   2994           author is shown, then this specifies how much space is used to
   2995           do so.
   2996 
   2997    Also see the proceeding section for more options concerning status
   2998 buffers.
   2999 
   3000 
   3001 File: magit.info,  Node: Repository List,  Next: Logging,  Prev: Status Buffer,  Up: Inspecting
   3002 
   3003 5.2 Repository List
   3004 ===================
   3005 
   3006  -- Command: magit-list-repositories
   3007 
   3008      This command displays a list of repositories in a separate buffer.
   3009 
   3010      The options ‘magit-repository-directories’ and
   3011      ‘magit-repository-directories-depth’ control which repositories are
   3012      displayed.
   3013 
   3014  -- User Option: magit-repolist-columns
   3015 
   3016      This option controls what columns are displayed by the command
   3017      ‘magit-list-repositories’ and how they are displayed.
   3018 
   3019      Each element has the form ‘(HEADER WIDTH FORMAT PROPS)’.
   3020 
   3021      HEADER is the string displayed in the header.  WIDTH is the width
   3022      of the column.  FORMAT is a function that is called with one
   3023      argument, the repository identification (usually its basename), and
   3024      with ‘default-directory’ bound to the toplevel of its working tree.
   3025      It has to return a string to be inserted or nil.  PROPS is an alist
   3026      that supports the keys ‘:right-align’ and ‘:pad-right’.
   3027 
   3028      You may wish to display a range of numeric columns using just one
   3029      character per column and without any padding between columns, in
   3030      which case you should use an appropriate HEADER, set WIDTH to 1,
   3031      and set ‘:pad-right’ to 0.  ‘+’ is substituted for numbers higher
   3032      than 9.
   3033 
   3034    The following functions can be added to the above option:
   3035 
   3036  -- Function: magit-repolist-column-ident
   3037 
   3038      This function inserts the identification of the repository.
   3039      Usually this is just its basename.
   3040 
   3041  -- Function: magit-repolist-column-path
   3042 
   3043      This function inserts the absolute path of the repository.
   3044 
   3045  -- Function: magit-repolist-column-version
   3046 
   3047      This function inserts a description of the repository’s ‘HEAD’
   3048      revision.
   3049 
   3050  -- Function: magit-repolist-column-branch
   3051 
   3052      This function inserts the name of the current branch.
   3053 
   3054  -- Function: magit-repolist-column-upstream
   3055 
   3056      This function inserts the name of the upstream branch of the
   3057      current branch.
   3058 
   3059  -- Function: magit-repolist-column-branches
   3060 
   3061      This function inserts the number of branches.
   3062 
   3063  -- Function: magit-repolist-column-stashes
   3064 
   3065      This function inserts the number of stashes.
   3066 
   3067  -- Function: magit-repolist-column-flag
   3068 
   3069      This function inserts a flag as specified by
   3070      ‘magit-repolist-column-flag-alist’.
   3071 
   3072      By default this indicates whether there are uncommitted changes.
   3073 
   3074         • ‘N’ if there is at least one untracked file.
   3075 
   3076         • ‘U’ if there is at least one unstaged file.
   3077 
   3078         • ‘S’ if there is at least one staged file.
   3079 
   3080      Only the first one of these that applies is shown.
   3081 
   3082  -- Function: magit-repolist-column-unpulled-from-upstream
   3083 
   3084      This function inserts the number of upstream commits not in the
   3085      current branch.
   3086 
   3087  -- Function: magit-repolist-column-unpulled-from-pushremote
   3088 
   3089      This function inserts the number of commits in the push branch but
   3090      not the current branch.
   3091 
   3092  -- Function: magit-repolist-column-unpushed-to-upstream
   3093 
   3094      This function inserts the number of commits in the current branch
   3095      but not its upstream.
   3096 
   3097  -- Function: magit-repolist-column-unpushed-to-pushremote
   3098 
   3099      This function inserts the number of commits in the current branch
   3100      but not its push branch.
   3101 
   3102 
   3103 File: magit.info,  Node: Logging,  Next: Diffing,  Prev: Repository List,  Up: Inspecting
   3104 
   3105 5.3 Logging
   3106 ===========
   3107 
   3108 The status buffer contains logs for the unpushed and unpulled commits,
   3109 but that obviously isn’t enough.  The transient prefix command
   3110 ‘magit-log’, on ‘l’, features several suffix commands, which show a
   3111 specific log in a separate log buffer.
   3112 
   3113    Like other transient prefix commands, ‘magit-log’ also features
   3114 several infix arguments that can be changed before invoking one of the
   3115 suffix commands.  However, in the case of the log transient, these
   3116 arguments may be taken from those currently in use in the current
   3117 repository’s log buffer, depending on the value of
   3118 ‘magit-prefix-use-buffer-arguments’ (see *note Transient Arguments and
   3119 Buffer Variables::).
   3120 
   3121    For information about the various arguments, see *note
   3122 (gitman)git-log::.
   3123 
   3124    The switch ‘++order=VALUE’ is converted to one of
   3125 ‘--author-date-order’, ‘--date-order’, or ‘--topo-order’ before being
   3126 passed to ‘git log’.
   3127 
   3128    The log transient also features several reflog commands.  See *note
   3129 Reflog::.
   3130 
   3131 ‘l’     (‘magit-log’)
   3132 
   3133      This transient prefix command binds the following suffix commands
   3134      along with the appropriate infix arguments and displays them in a
   3135      temporary buffer until a suffix is invoked.
   3136 
   3137 ‘l l’     (‘magit-log-current’)
   3138 
   3139      Show log for the current branch.  When ‘HEAD’ is detached or with a
   3140      prefix argument, show log for one or more revs read from the
   3141      minibuffer.
   3142 
   3143 ‘l o’     (‘magit-log-other’)
   3144 
   3145      Show log for one or more revs read from the minibuffer.  The user
   3146      can input any revision or revisions separated by a space, or even
   3147      ranges, but only branches, tags, and a representation of the commit
   3148      at point are available as completion candidates.
   3149 
   3150 ‘l h’     (‘magit-log-head’)
   3151 
   3152      Show log for ‘HEAD’.
   3153 
   3154 ‘l L’     (‘magit-log-branches’)
   3155 
   3156      Show log for all local branches and ‘HEAD’.
   3157 
   3158 ‘l b’     (‘magit-log-all-branches’)
   3159 
   3160      Show log for all local and remote branches and ‘HEAD’.
   3161 
   3162 ‘l a’     (‘magit-log-all’)
   3163 
   3164      Show log for all references and ‘HEAD’.
   3165 
   3166    Two additional commands that show the log for the file or blob that
   3167 is being visited in the current buffer exists, see *note Commands for
   3168 Buffers Visiting Files::.  The command ‘magit-cherry’ also shows a log,
   3169 see *note Cherries::.
   3170 
   3171 * Menu:
   3172 
   3173 * Refreshing Logs::
   3174 * Log Buffer::
   3175 * Log Margin::
   3176 * Select from Log::
   3177 * Reflog::
   3178 * Cherries::
   3179 
   3180 
   3181 File: magit.info,  Node: Refreshing Logs,  Next: Log Buffer,  Up: Logging
   3182 
   3183 5.3.1 Refreshing Logs
   3184 ---------------------
   3185 
   3186 The transient prefix command ‘magit-log-refresh’, on ‘L’, can be used to
   3187 change the log arguments used in the current buffer, without changing
   3188 which log is shown.  This works in dedicated log buffers, but also in
   3189 the status buffer.
   3190 
   3191 ‘L’     (‘magit-log-refresh’)
   3192 
   3193      This transient prefix command binds the following suffix commands
   3194      along with the appropriate infix arguments and displays them in a
   3195      temporary buffer until a suffix is invoked.
   3196 
   3197 ‘L g’     (‘magit-log-refresh’)
   3198 
   3199      This suffix command sets the local log arguments for the current
   3200      buffer.
   3201 
   3202 ‘L s’     (‘magit-log-set-default-arguments’)
   3203 
   3204      This suffix command sets the default log arguments for buffers of
   3205      the same type as that of the current buffer.  Other existing
   3206      buffers of the same type are not affected because their local
   3207      values have already been initialized.
   3208 
   3209 ‘L w’     (‘magit-log-save-default-arguments’)
   3210 
   3211      This suffix command sets the default log arguments for buffers of
   3212      the same type as that of the current buffer, and saves the value
   3213      for future sessions.  Other existing buffers of the same type are
   3214      not affected because their local values have already been
   3215      initialized.
   3216 
   3217 ‘L t’     (‘magit-toggle-margin’)
   3218 
   3219      Show or hide the margin.
   3220 
   3221 
   3222 File: magit.info,  Node: Log Buffer,  Next: Log Margin,  Prev: Refreshing Logs,  Up: Logging
   3223 
   3224 5.3.2 Log Buffer
   3225 ----------------
   3226 
   3227 ‘L’     (‘magit-log-refresh’)
   3228 
   3229      This transient prefix command binds the following suffix commands
   3230      along with the appropriate infix arguments and displays them in a
   3231      temporary buffer until a suffix is invoked.
   3232 
   3233      See *note Refreshing Logs::.
   3234 
   3235 ‘q’     (‘magit-log-bury-buffer’)
   3236 
   3237      Bury the current buffer or the revision buffer in the same frame.
   3238      Like ‘magit-mode-bury-buffer’ (which see) but with a negative
   3239      prefix argument instead bury the revision buffer, provided it is
   3240      displayed in the current frame.
   3241 
   3242 ‘C-c C-b’     (‘magit-go-backward’)
   3243 
   3244      Move backward in current buffer’s history.
   3245 
   3246 ‘C-c C-f’     (‘magit-go-forward’)
   3247 
   3248      Move forward in current buffer’s history.
   3249 
   3250 ‘C-c C-n’     (‘magit-log-move-to-parent’)
   3251 
   3252      Move to a parent of the current commit.  By default, this is the
   3253      first parent, but a numeric prefix can be used to specify another
   3254      parent.
   3255 
   3256 ‘j’     (‘magit-log-move-to-revision’)
   3257 
   3258      Read a revision and move to it in current log buffer.
   3259 
   3260      If the chosen reference or revision isn’t being displayed in the
   3261      current log buffer, then inform the user about that and do nothing
   3262      else.
   3263 
   3264      If invoked outside any log buffer, then display the log buffer of
   3265      the current repository first; creating it if necessary.
   3266 
   3267 ‘SPC’     (‘magit-diff-show-or-scroll-up’)
   3268 
   3269      Update the commit or diff buffer for the thing at point.
   3270 
   3271      Either show the commit or stash at point in the appropriate buffer,
   3272      or if that buffer is already being displayed in the current frame
   3273      and contains information about that commit or stash, then instead
   3274      scroll the buffer up.  If there is no commit or stash at point,
   3275      then prompt for a commit.
   3276 
   3277 ‘DEL’     (‘magit-diff-show-or-scroll-down’)
   3278 
   3279      Update the commit or diff buffer for the thing at point.
   3280 
   3281      Either show the commit or stash at point in the appropriate buffer,
   3282      or if that buffer is already being displayed in the current frame
   3283      and contains information about that commit or stash, then instead
   3284      scroll the buffer down.  If there is no commit or stash at point,
   3285      then prompt for a commit.
   3286 
   3287 ‘=’     (‘magit-log-toggle-commit-limit’)
   3288 
   3289      Toggle the number of commits the current log buffer is limited to.
   3290      If the number of commits is currently limited, then remove that
   3291      limit.  Otherwise set it to 256.
   3292 
   3293 ‘+’     (‘magit-log-double-commit-limit’)
   3294 
   3295      Double the number of commits the current log buffer is limited to.
   3296 
   3297 ‘-’     (‘magit-log-half-commit-limit’)
   3298 
   3299      Half the number of commits the current log buffer is limited to.
   3300 
   3301  -- User Option: magit-log-auto-more
   3302 
   3303      Insert more log entries automatically when moving past the last
   3304      entry.  Only considered when moving past the last entry with
   3305      ‘magit-goto-*-section’ commands.
   3306 
   3307  -- User Option: magit-log-show-refname-after-summary
   3308 
   3309      Whether to show the refnames after the commit summaries.  This is
   3310      useful if you use really long branch names.
   3311 
   3312    Magit displays references in logs a bit differently from how Git does
   3313 it.
   3314 
   3315    Local branches are blue and remote branches are green.  Of course
   3316 that depends on the used theme, as do the colors used for other types of
   3317 references.  The current branch has a box around it, as do remote
   3318 branches that are their respective remote’s ‘HEAD’ branch.
   3319 
   3320    If a local branch and its push-target point at the same commit, then
   3321 their names are combined to preserve space and to make that relationship
   3322 visible.  For example:
   3323 
   3324      origin/feature
   3325      [green][blue-]
   3326 
   3327      instead of
   3328 
   3329      feature origin/feature
   3330      [blue-] [green-------]
   3331 
   3332    Also note that while the transient features the ‘--show-signature’
   3333 argument, that won’t actually be used when enabled, because Magit
   3334 defaults to use just one line per commit.  Instead the commit colorized
   3335 to indicate the validity of the signed commit object, using the faces
   3336 named ‘magit-signature-*’ (which see).
   3337 
   3338    For a description of ‘magit-log-margin’ see *note Log Margin::.
   3339 
   3340 
   3341 File: magit.info,  Node: Log Margin,  Next: Select from Log,  Prev: Log Buffer,  Up: Logging
   3342 
   3343 5.3.3 Log Margin
   3344 ----------------
   3345 
   3346 In buffers which show one or more logs, it is possible to show
   3347 additional information about each commit in the margin.  The options
   3348 used to configure the margin are named ‘magit-INFIX-margin’, where INFIX
   3349 is the same as in the respective major-mode ‘magit-INFIX-mode’.  In
   3350 regular log buffers that would be ‘magit-log-margin’.
   3351 
   3352  -- User Option: magit-log-margin
   3353 
   3354      This option specifies whether the margin is initially shown in
   3355      Magit-Log mode buffers and how it is formatted.
   3356 
   3357      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   3358 
   3359         • If INIT is non-nil, then the margin is shown initially.
   3360 
   3361         • STYLE controls how to format the author or committer date.  It
   3362           can be one of ‘age’ (to show the age of the commit),
   3363           ‘age-abbreviated’ (to abbreviate the time unit to a
   3364           character), or a string (suitable for ‘format-time-string’) to
   3365           show the actual date.  Option
   3366           ‘magit-log-margin-show-committer-date’ controls which date is
   3367           being displayed.
   3368 
   3369         • WIDTH controls the width of the margin.  This exists for
   3370           forward compatibility and currently the value should not be
   3371           changed.
   3372 
   3373         • AUTHOR controls whether the name of the author is also shown
   3374           by default.
   3375 
   3376         • AUTHOR-WIDTH has to be an integer.  When the name of the
   3377           author is shown, then this specifies how much space is used to
   3378           do so.
   3379 
   3380    You can change the STYLE and AUTHOR-WIDTH of all ‘magit-INFIX-margin’
   3381 options to the same values by customizing ‘magit-log-margin’ *before*
   3382 ‘magit’ is loaded.  If you do that, then the respective values for the
   3383 other options will default to what you have set for that variable.
   3384 Likewise if you set INIT in ‘magit-log-margin’ to ‘nil’, then that is
   3385 used in the default of all other options.  But setting it to ‘t’, i.e.
   3386 re-enforcing the default for that option, does not carry to other
   3387 options.
   3388 
   3389  -- User Option: magit-log-margin-show-committer-date
   3390 
   3391      This option specifies whether to show the committer date in the
   3392      margin.  This option only controls whether the committer date is
   3393      displayed instead of the author date.  Whether some date is
   3394      displayed in the margin and whether the margin is displayed at all
   3395      is controlled by other options.
   3396 
   3397 ‘L’     (‘magit-margin-settings’)
   3398 
   3399      This transient prefix command binds the following suffix commands,
   3400      each of which changes the appearance of the margin in some way.
   3401 
   3402    In some buffers that support the margin, ‘L’ is instead bound to
   3403 ‘magit-log-refresh’, but that transient features the same commands, and
   3404 then some other unrelated commands.
   3405 
   3406 ‘L L’     (‘magit-toggle-margin’)
   3407 
   3408      This command shows or hides the margin.
   3409 
   3410 ‘L l’     (‘magit-cycle-margin-style’)
   3411 
   3412      This command cycles the style used for the margin.
   3413 
   3414 ‘L d’     (‘magit-toggle-margin-details’)
   3415 
   3416      This command shows or hides details in the margin.
   3417 
   3418 
   3419 File: magit.info,  Node: Select from Log,  Next: Reflog,  Prev: Log Margin,  Up: Logging
   3420 
   3421 5.3.4 Select from Log
   3422 ---------------------
   3423 
   3424 When the user has to select a recent commit that is reachable from
   3425 ‘HEAD’, using regular completion would be inconvenient (because most
   3426 humans cannot remember hashes or "HEAD~5", at least not without double
   3427 checking).  Instead a log buffer is used to select the commit, which has
   3428 the advantage that commits are presented in order and with the commit
   3429 message.
   3430 
   3431    Such selection logs are used when selecting the beginning of a rebase
   3432 and when selecting the commit to be squashed into.
   3433 
   3434    In addition to the key bindings available in all log buffers, the
   3435 following additional key bindings are available in selection log
   3436 buffers:
   3437 
   3438 ‘C-c C-c’     (‘magit-log-select-pick’)
   3439 
   3440      Select the commit at point and act on it.  Call
   3441      ‘magit-log-select-pick-function’ with the selected commit as
   3442      argument.
   3443 
   3444 ‘C-c C-k’     (‘magit-log-select-quit’)
   3445 
   3446      Abort selecting a commit, don’t act on any commit.
   3447 
   3448  -- User Option: magit-log-select-margin
   3449 
   3450      This option specifies whether the margin is initially shown in
   3451      Magit-Log-Select mode buffers and how it is formatted.
   3452 
   3453      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   3454 
   3455         • If INIT is non-nil, then the margin is shown initially.
   3456 
   3457         • STYLE controls how to format the author or committer date.  It
   3458           can be one of ‘age’ (to show the age of the commit),
   3459           ‘age-abbreviated’ (to abbreviate the time unit to a
   3460           character), or a string (suitable for ‘format-time-string’) to
   3461           show the actual date.  Option
   3462           ‘magit-log-margin-show-committer-date’ controls which date is
   3463           being displayed.
   3464 
   3465         • WIDTH controls the width of the margin.  This exists for
   3466           forward compatibility and currently the value should not be
   3467           changed.
   3468 
   3469         • AUTHOR controls whether the name of the author is also shown
   3470           by default.
   3471 
   3472         • AUTHOR-WIDTH has to be an integer.  When the name of the
   3473           author is shown, then this specifies how much space is used to
   3474           do so.
   3475 
   3476 
   3477 File: magit.info,  Node: Reflog,  Next: Cherries,  Prev: Select from Log,  Up: Logging
   3478 
   3479 5.3.5 Reflog
   3480 ------------
   3481 
   3482 Also see *note (gitman)git-reflog::.
   3483 
   3484    These reflog commands are available from the log transient.  See
   3485 *note Logging::.
   3486 
   3487 ‘l r’     (‘magit-reflog-current’)
   3488 
   3489      Display the reflog of the current branch.
   3490 
   3491 ‘l O’     (‘magit-reflog-other’)
   3492 
   3493      Display the reflog of a branch or another ref.
   3494 
   3495 ‘l H’     (‘magit-reflog-head’)
   3496 
   3497      Display the ‘HEAD’ reflog.
   3498 
   3499  -- User Option: magit-reflog-margin
   3500 
   3501      This option specifies whether the margin is initially shown in
   3502      Magit-Reflog mode buffers and how it is formatted.
   3503 
   3504      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   3505 
   3506         • If INIT is non-nil, then the margin is shown initially.
   3507 
   3508         • STYLE controls how to format the author or committer date.  It
   3509           can be one of ‘age’ (to show the age of the commit),
   3510           ‘age-abbreviated’ (to abbreviate the time unit to a
   3511           character), or a string (suitable for ‘format-time-string’) to
   3512           show the actual date.  Option
   3513           ‘magit-log-margin-show-committer-date’ controls which date is
   3514           being displayed.
   3515 
   3516         • WIDTH controls the width of the margin.  This exists for
   3517           forward compatibility and currently the value should not be
   3518           changed.
   3519 
   3520         • AUTHOR controls whether the name of the author is also shown
   3521           by default.
   3522 
   3523         • AUTHOR-WIDTH has to be an integer.  When the name of the
   3524           author is shown, then this specifies how much space is used to
   3525           do so.
   3526 
   3527 
   3528 File: magit.info,  Node: Cherries,  Prev: Reflog,  Up: Logging
   3529 
   3530 5.3.6 Cherries
   3531 --------------
   3532 
   3533 Cherries are commits that haven’t been applied upstream (yet), and are
   3534 usually visualized using a log.  Each commit is prefixed with ‘-’ if it
   3535 has an equivalent in the upstream and ‘+’ if it does not, i.e.  if it is
   3536 a cherry.
   3537 
   3538    The command ‘magit-cherry’ shows cherries for a single branch, but
   3539 the references buffer (see *note References Buffer::) can show cherries
   3540 for multiple "upstreams" at once.
   3541 
   3542    Also see *note (gitman)git-reflog::.
   3543 
   3544 ‘Y’     (‘magit-cherry’)
   3545 
   3546      Show commits that are in a certain branch but that have not been
   3547      merged in the upstream branch.
   3548 
   3549  -- User Option: magit-cherry-margin
   3550 
   3551      This option specifies whether the margin is initially shown in
   3552      Magit-Cherry mode buffers and how it is formatted.
   3553 
   3554      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   3555 
   3556         • If INIT is non-nil, then the margin is shown initially.
   3557 
   3558         • STYLE controls how to format the author or committer date.  It
   3559           can be one of ‘age’ (to show the age of the commit),
   3560           ‘age-abbreviated’ (to abbreviate the time unit to a
   3561           character), or a string (suitable for ‘format-time-string’) to
   3562           show the actual date.  Option
   3563           ‘magit-log-margin-show-committer-date’ controls which date is
   3564           being displayed.
   3565 
   3566         • WIDTH controls the width of the margin.  This exists for
   3567           forward compatibility and currently the value should not be
   3568           changed.
   3569 
   3570         • AUTHOR controls whether the name of the author is also shown
   3571           by default.
   3572 
   3573         • AUTHOR-WIDTH has to be an integer.  When the name of the
   3574           author is shown, then this specifies how much space is used to
   3575           do so.
   3576 
   3577 
   3578 File: magit.info,  Node: Diffing,  Next: Ediffing,  Prev: Logging,  Up: Inspecting
   3579 
   3580 5.4 Diffing
   3581 ===========
   3582 
   3583 The status buffer contains diffs for the staged and unstaged commits,
   3584 but that obviously isn’t enough.  The transient prefix command
   3585 ‘magit-diff’, on ‘d’, features several suffix commands, which show a
   3586 specific diff in a separate diff buffer.
   3587 
   3588    Like other transient prefix commands, ‘magit-diff’ also features
   3589 several infix arguments that can be changed before invoking one of the
   3590 suffix commands.  However, in the case of the diff transient, these
   3591 arguments may be taken from those currently in use in the current
   3592 repository’s diff buffer, depending on the value of
   3593 ‘magit-prefix-use-buffer-arguments’ (see *note Transient Arguments and
   3594 Buffer Variables::).
   3595 
   3596    Also see *note (gitman)git-diff::.
   3597 
   3598 ‘d’     (‘magit-diff’)
   3599 
   3600      This transient prefix command binds the following suffix commands
   3601      along with the appropriate infix arguments and displays them in a
   3602      temporary buffer until a suffix is invoked.
   3603 
   3604 ‘d d’     (‘magit-diff-dwim’)
   3605 
   3606      Show changes for the thing at point.
   3607 
   3608 ‘d r’     (‘magit-diff-range’)
   3609 
   3610      Show differences between two commits.
   3611 
   3612      RANGE should be a range (A..B or A...B) but can also be a single
   3613      commit.  If one side of the range is omitted, then it defaults to
   3614      ‘HEAD’.  If just a commit is given, then changes in the working
   3615      tree relative to that commit are shown.
   3616 
   3617      If the region is active, use the revisions on the first and last
   3618      line of the region.  With a prefix argument, instead of diffing the
   3619      revisions, choose a revision to view changes along, starting at the
   3620      common ancestor of both revisions (i.e., use a "..." range).
   3621 
   3622 ‘d w’     (‘magit-diff-working-tree’)
   3623 
   3624      Show changes between the current working tree and the ‘HEAD’
   3625      commit.  With a prefix argument show changes between the working
   3626      tree and a commit read from the minibuffer.
   3627 
   3628 ‘d s’     (‘magit-diff-staged’)
   3629 
   3630      Show changes between the index and the ‘HEAD’ commit.  With a
   3631      prefix argument show changes between the index and a commit read
   3632      from the minibuffer.
   3633 
   3634 ‘d u’     (‘magit-diff-unstaged’)
   3635 
   3636      Show changes between the working tree and the index.
   3637 
   3638 ‘d p’     (‘magit-diff-paths’)
   3639 
   3640      Show changes between any two files on disk.
   3641 
   3642    All of the above suffix commands update the repository’s diff buffer.
   3643 The diff transient also features two commands which show differences in
   3644 another buffer:
   3645 
   3646 ‘d c’     (‘magit-show-commit’)
   3647 
   3648      Show the commit at point.  If there is no commit at point or with a
   3649      prefix argument, prompt for a commit.
   3650 
   3651 ‘d t’     (‘magit-stash-show’)
   3652 
   3653      Show all diffs of a stash in a buffer.
   3654 
   3655    Two additional commands that show the diff for the file or blob that
   3656 is being visited in the current buffer exists, see *note Commands for
   3657 Buffers Visiting Files::.
   3658 
   3659 * Menu:
   3660 
   3661 * Refreshing Diffs::
   3662 * Commands Available in Diffs::
   3663 * Diff Options::
   3664 * Revision Buffer::
   3665 
   3666 
   3667 File: magit.info,  Node: Refreshing Diffs,  Next: Commands Available in Diffs,  Up: Diffing
   3668 
   3669 5.4.1 Refreshing Diffs
   3670 ----------------------
   3671 
   3672 The transient prefix command ‘magit-diff-refresh’, on ‘D’, can be used
   3673 to change the diff arguments used in the current buffer, without
   3674 changing which diff is shown.  This works in dedicated diff buffers, but
   3675 also in the status buffer.
   3676 
   3677 ‘D’     (‘magit-diff-refresh’)
   3678 
   3679      This transient prefix command binds the following suffix commands
   3680      along with the appropriate infix arguments and displays them in a
   3681      temporary buffer until a suffix is invoked.
   3682 
   3683 ‘D g’     (‘magit-diff-refresh’)
   3684 
   3685      This suffix command sets the local diff arguments for the current
   3686      buffer.
   3687 
   3688 ‘D s’     (‘magit-diff-set-default-arguments’)
   3689 
   3690      This suffix command sets the default diff arguments for buffers of
   3691      the same type as that of the current buffer.  Other existing
   3692      buffers of the same type are not affected because their local
   3693      values have already been initialized.
   3694 
   3695 ‘D w’     (‘magit-diff-save-default-arguments’)
   3696 
   3697      This suffix command sets the default diff arguments for buffers of
   3698      the same type as that of the current buffer, and saves the value
   3699      for future sessions.  Other existing buffers of the same type are
   3700      not affected because their local values have already been
   3701      initialized.
   3702 
   3703 ‘D t’     (‘magit-diff-toggle-refine-hunk’)
   3704 
   3705      This command toggles hunk refinement on or off.
   3706 
   3707 ‘D r’     (‘magit-diff-switch-range-type’)
   3708 
   3709      This command converts the diff range type from "revA..revB" to
   3710      "revB...revA", or vice versa.
   3711 
   3712 ‘D f’     (‘magit-diff-flip-revs’)
   3713 
   3714      This command swaps revisions in the diff range from "revA..revB" to
   3715      "revB..revA", or vice versa.
   3716 
   3717 ‘D F’     (‘magit-diff-toggle-file-filter’)
   3718 
   3719      This command toggles the file restriction of the diffs in the
   3720      current buffer, allowing you to quickly switch between viewing all
   3721      the changes in the commit and the restricted subset.  As a special
   3722      case, when this command is called from a log buffer, it toggles the
   3723      file restriction in the repository’s revision buffer, which is
   3724      useful when you display a revision from a log buffer that is
   3725      restricted to a file or files.
   3726 
   3727    In addition to the above transient, which allows changing any of the
   3728 supported arguments, there also exist some commands that change only a
   3729 particular argument.
   3730 
   3731 ‘-’     (‘magit-diff-less-context’)
   3732 
   3733      This command decreases the context for diff hunks by COUNT lines.
   3734 
   3735 ‘+’     (‘magit-diff-more-context’)
   3736 
   3737      This command increases the context for diff hunks by COUNT lines.
   3738 
   3739 ‘0’     (‘magit-diff-default-context’)
   3740 
   3741      This command resets the context for diff hunks to the default
   3742      height.
   3743 
   3744    The following commands quickly change what diff is being displayed
   3745 without having to using one of the diff transient.
   3746 
   3747 ‘C-c C-d’     (‘magit-diff-while-committing’)
   3748 
   3749      While committing, this command shows the changes that are about to
   3750      be committed.  While amending, invoking the command again toggles
   3751      between showing just the new changes or all the changes that will
   3752      be committed.
   3753 
   3754      This binding is available in the diff buffer as well as the commit
   3755      message buffer.
   3756 
   3757 ‘C-c C-b’     (‘magit-go-backward’)
   3758 
   3759      This command moves backward in current buffer’s history.
   3760 
   3761 ‘C-c C-f’     (‘magit-go-forward’)
   3762 
   3763      This command moves forward in current buffer’s history.
   3764 
   3765 
   3766 File: magit.info,  Node: Commands Available in Diffs,  Next: Diff Options,  Prev: Refreshing Diffs,  Up: Diffing
   3767 
   3768 5.4.2 Commands Available in Diffs
   3769 ---------------------------------
   3770 
   3771 Some commands are only available if point is inside a diff.
   3772 
   3773    ‘magit-diff-visit-file’ and related commands visit the appropriate
   3774 version of the file that the diff at point is about.  Likewise
   3775 ‘magit-diff-visit-worktree-file’ and related commands visit the worktree
   3776 version of the file that the diff at point is about.  See *note Visiting
   3777 Files and Blobs from a Diff:: for more information and the key bindings.
   3778 
   3779 ‘C-c C-t’     (‘magit-diff-trace-definition’)
   3780 
   3781      This command shows a log for the definition at point.
   3782 
   3783  -- User Option: magit-log-trace-definition-function
   3784 
   3785      The function specified by this option is used by
   3786      ‘magit-log-trace-definition’ to determine the function at point.
   3787      For major-modes that have special needs, you could set the local
   3788      value using the mode’s hook.
   3789 
   3790 ‘C-c C-e’     (‘magit-diff-edit-hunk-commit’)
   3791 
   3792      From a hunk, this command edits the respective commit and visits
   3793      the file.
   3794 
   3795      First it visits the file being modified by the hunk at the correct
   3796      location using ‘magit-diff-visit-file’.  This actually visits a
   3797      blob.  When point is on a diff header, not within an individual
   3798      hunk, then this visits the blob the first hunk is about.
   3799 
   3800      Then it invokes ‘magit-edit-line-commit’, which uses an interactive
   3801      rebase to make the commit editable, or if that is not possible
   3802      because the commit is not reachable from ‘HEAD’ by checking out
   3803      that commit directly.  This also causes the actual worktree file to
   3804      be visited.
   3805 
   3806      Neither the blob nor the file buffer are killed when finishing the
   3807      rebase.  If that is undesirable, then it might be better to use
   3808      ‘magit-rebase-edit-command’ instead of this command.
   3809 
   3810 ‘j’     (‘magit-jump-to-diffstat-or-diff’)
   3811 
   3812      This command jumps to the diffstat or diff.  When point is on a
   3813      file inside the diffstat section, then jump to the respective diff
   3814      section.  Otherwise, jump to the diffstat section or a child
   3815      thereof.
   3816 
   3817    The next two commands are not specific to Magit-Diff mode (or and
   3818 Magit buffer for that matter), but it might be worth pointing out that
   3819 they are available here too.
   3820 
   3821 ‘SPC’     (‘scroll-up’)
   3822 
   3823      This command scrolls text upward.
   3824 
   3825 ‘DEL’     (‘scroll-down’)
   3826 
   3827      This command scrolls text downward.
   3828 
   3829 
   3830 File: magit.info,  Node: Diff Options,  Next: Revision Buffer,  Prev: Commands Available in Diffs,  Up: Diffing
   3831 
   3832 5.4.3 Diff Options
   3833 ------------------
   3834 
   3835  -- User Option: magit-diff-refine-hunk
   3836 
   3837      Whether to show word-granularity differences within diff hunks.
   3838 
   3839         • ‘nil’ Never show fine differences.
   3840 
   3841         • ‘t’ Show fine differences for the current diff hunk only.
   3842 
   3843         • ‘all’ Show fine differences for all displayed diff hunks.
   3844 
   3845  -- User Option: magit-diff-refine-ignore-whitespace
   3846 
   3847      Whether to ignore whitespace changes in word-granularity
   3848      differences.
   3849 
   3850  -- User Option: magit-diff-adjust-tab-width
   3851 
   3852      Whether to adjust the width of tabs in diffs.
   3853 
   3854      Determining the correct width can be expensive if it requires
   3855      opening large and/or many files, so the widths are cached in the
   3856      variable ‘magit-diff--tab-width-cache’.  Set that to nil to
   3857      invalidate the cache.
   3858 
   3859         • ‘nil’ Never adjust tab width.  Use ‘tab-width’s value from the
   3860           Magit buffer itself instead.
   3861 
   3862         • ‘t’ If the corresponding file-visiting buffer exits, then use
   3863           ‘tab-width’’s value from that buffer.  Doing this is cheap, so
   3864           this value is used even if a corresponding cache entry exists.
   3865 
   3866         • ‘always’ If there is no such buffer, then temporarily visit
   3867           the file to determine the value.
   3868 
   3869         • NUMBER Like ‘always’, but don’t visit files larger than NUMBER
   3870           bytes.
   3871 
   3872  -- User Option: magit-diff-paint-whitespace
   3873 
   3874      Specify where to highlight whitespace errors.
   3875 
   3876      See ‘magit-diff-highlight-trailing’,
   3877      ‘magit-diff-highlight-indentation’.  The symbol ‘t’ means in all
   3878      diffs, ‘status’ means only in the status buffer, and nil means
   3879      nowhere.
   3880 
   3881         • ‘nil’ Never highlight whitespace errors.
   3882 
   3883         • ‘t’ Highlight whitespace errors everywhere.
   3884 
   3885         • ‘uncommitted’ Only highlight whitespace errors in diffs
   3886           showing uncommitted changes.  For backward compatibility
   3887           ‘status’ is treated as a synonym.
   3888 
   3889  -- User Option: magit-diff-paint-whitespace-lines
   3890 
   3891      Specify in what kind of lines to highlight whitespace errors.
   3892 
   3893         • ‘t’ Highlight only in added lines.
   3894 
   3895         • ‘both’ Highlight in added and removed lines.
   3896 
   3897         • ‘all’ Highlight in added, removed and context lines.
   3898 
   3899  -- User Option: magit-diff-highlight-trailing
   3900 
   3901      Whether to highlight whitespace at the end of a line in diffs.
   3902      Used only when ‘magit-diff-paint-whitespace’ is non-nil.
   3903 
   3904  -- User Option: magit-diff-highlight-indentation
   3905 
   3906      This option controls whether to highlight the indentation in case
   3907      it used the "wrong" indentation style.  Indentation is only
   3908      highlighted if ‘magit-diff-paint-whitespace’ is also non-nil.
   3909 
   3910      The value is an alist of the form ‘((REGEXP . INDENT)...)’.  The
   3911      path to the current repository is matched against each element in
   3912      reverse order.  Therefore if a REGEXP matches, then earlier
   3913      elements are not tried.
   3914 
   3915      If the used INDENT is ‘tabs’, highlight indentation with tabs.  If
   3916      INDENT is an integer, highlight indentation with at least that many
   3917      spaces.  Otherwise, highlight neither.
   3918 
   3919  -- User Option: magit-diff-hide-trailing-cr-characters
   3920 
   3921      Whether to hide ^M characters at the end of a line in diffs.
   3922 
   3923  -- User Option: magit-diff-highlight-hunk-region-functions
   3924 
   3925      This option specifies the functions used to highlight the
   3926      hunk-internal region.
   3927 
   3928      ‘magit-diff-highlight-hunk-region-dim-outside’ overlays the outside
   3929      of the hunk internal selection with a face that causes the added
   3930      and removed lines to have the same background color as context
   3931      lines.  This function should not be removed from the value of this
   3932      option.
   3933 
   3934      ‘magit-diff-highlight-hunk-region-using-overlays’ and
   3935      ‘magit-diff-highlight-hunk-region-using-underline’ emphasize the
   3936      region by placing delimiting horizontal lines before and after it.
   3937      Both of these functions have glitches which cannot be fixed due to
   3938      limitations of Emacs’ display engine.  For more information see
   3939      <https://github.com/magit/magit/issues/2758> ff.
   3940 
   3941      Instead of, or in addition to, using delimiting horizontal lines,
   3942      to emphasize the boundaries, you may which to emphasize the text
   3943      itself, using ‘magit-diff-highlight-hunk-region-using-face’.
   3944 
   3945      In terminal frames it’s not possible to draw lines as the overlay
   3946      and underline variants normally do, so there they fall back to
   3947      calling the face function instead.
   3948 
   3949  -- User Option: magit-diff-unmarked-lines-keep-foreground
   3950 
   3951      This option controls whether added and removed lines outside the
   3952      hunk-internal region only lose their distinct background color or
   3953      also the foreground color.  Whether the outside of the region is
   3954      dimmed at all depends on
   3955      ‘magit-diff-highlight-hunk-region-functions’.
   3956 
   3957  -- User Option: magit-diff-extra-stat-arguments
   3958 
   3959      This option specifies additional arguments to be used alongside
   3960      ‘--stat’.
   3961 
   3962      The value is a list of zero or more arguments or a function that
   3963      takes no argument and returns such a list.  These arguments are
   3964      allowed here: ‘--stat-width’, ‘--stat-name-width’,
   3965      ‘--stat-graph-width’ and ‘--compact-summary’.  Also see *note
   3966      (gitman)git-diff::.
   3967 
   3968 
   3969 File: magit.info,  Node: Revision Buffer,  Prev: Diff Options,  Up: Diffing
   3970 
   3971 5.4.4 Revision Buffer
   3972 ---------------------
   3973 
   3974  -- User Option: magit-revision-insert-related-refs
   3975 
   3976      Whether to show related branches in revision buffers.
   3977 
   3978         • ‘nil’ Don’t show any related branches.
   3979 
   3980         • ‘t’ Show related local branches.
   3981 
   3982         • ‘all’ Show related local and remote branches.
   3983 
   3984         • ‘mixed’ Show all containing branches and local merged
   3985           branches.
   3986 
   3987  -- User Option: magit-revision-show-gravatars
   3988 
   3989      Whether to show gravatar images in revision buffers.
   3990 
   3991      If ‘nil’, then don’t insert any gravatar images.  If ‘t’, then
   3992      insert both images.  If ‘author’ or ‘committer’, then insert only
   3993      the respective image.
   3994 
   3995      If you have customized the option ‘magit-revision-headers-format’
   3996      and want to insert the images then you might also have to specify
   3997      where to do so.  In that case the value has to be a cons-cell of
   3998      two regular expressions.  The car specifies where to insert the
   3999      author’s image.  The top half of the image is inserted right after
   4000      the matched text, the bottom half on the next line in the same
   4001      column.  The cdr specifies where to insert the committer’s image,
   4002      accordingly.  Either the car or the cdr may be nil."
   4003 
   4004  -- User Option: magit-revision-use-hash-sections
   4005 
   4006      Whether to turn hashes inside the commit message into sections.
   4007 
   4008      If non-nil, then hashes inside the commit message are turned into
   4009      ‘commit’ sections.  There is a trade off to be made between
   4010      performance and reliability:
   4011 
   4012         • ‘slow’ calls git for every word to be absolutely sure.
   4013 
   4014         • ‘quick’ skips words less than seven characters long.
   4015 
   4016         • ‘quicker’ additionally skips words that don’t contain a
   4017           number.
   4018 
   4019         • ‘quickest’ uses all words that are at least seven characters
   4020           long and which contain at least one number as well as at least
   4021           one letter.
   4022 
   4023      If nil, then no hashes are turned into sections, but you can still
   4024      visit the commit at point using "RET".
   4025 
   4026    The diffs shown in the revision buffer may be automatically
   4027 restricted to a subset of the changed files.  If the revision buffer is
   4028 displayed from a log buffer, the revision buffer will share the same
   4029 file restriction as that log buffer (also see the command
   4030 ‘magit-diff-toggle-file-filter’).
   4031 
   4032  -- User Option: magit-revision-filter-files-on-follow
   4033 
   4034      Whether showing a commit from a log buffer honors the log’s file
   4035      filter when the log arguments include ‘--follow’.
   4036 
   4037      When this option is nil, displaying a commit from a log ignores the
   4038      log’s file filter if the log arguments include ‘--follow’.  Doing
   4039      so avoids showing an empty diff in revision buffers for commits
   4040      before a rename event.  In such cases, the ‘--patch’ argument of
   4041      the log transient can be used to show the file-restricted diffs
   4042      inline.
   4043 
   4044      Set this option to non-nil to keep the log’s file restriction even
   4045      if ‘--follow’ is present in the log arguments.
   4046 
   4047    If the revision buffer is not displayed from a log buffer, the file
   4048 restriction is determined as usual (see *note Transient Arguments and
   4049 Buffer Variables::).
   4050 
   4051 
   4052 File: magit.info,  Node: Ediffing,  Next: References Buffer,  Prev: Diffing,  Up: Inspecting
   4053 
   4054 5.5 Ediffing
   4055 ============
   4056 
   4057 This section describes how to enter Ediff from Magit buffers.  For
   4058 information on how to use Ediff itself, see *note (ediff)Top::.
   4059 
   4060 ‘e’     (‘magit-ediff-dwim’)
   4061 
   4062      Compare, stage, or resolve using Ediff.
   4063 
   4064      This command tries to guess what file, and what commit or range the
   4065      user wants to compare, stage, or resolve using Ediff.  It might
   4066      only be able to guess either the file, or range/commit, in which
   4067      case the user is asked about the other.  It might not always guess
   4068      right, in which case the appropriate ‘magit-ediff-*’ command has to
   4069      be used explicitly.  If it cannot read the user’s mind at all, then
   4070      it asks the user for a command to run.
   4071 
   4072 ‘E’     (‘magit-ediff’)
   4073 
   4074      This transient prefix command binds the following suffix commands
   4075      and displays them in a temporary buffer until a suffix is invoked.
   4076 
   4077 ‘E r’     (‘magit-ediff-compare’)
   4078 
   4079      Compare two revisions of a file using Ediff.
   4080 
   4081      If the region is active, use the revisions on the first and last
   4082      line of the region.  With a prefix argument, instead of diffing the
   4083      revisions, choose a revision to view changes along, starting at the
   4084      common ancestor of both revisions (i.e., use a "..." range).
   4085 
   4086 ‘E m’     (‘magit-ediff-resolve’)
   4087 
   4088      Resolve outstanding conflicts in a file using Ediff, defaulting to
   4089      the file at point.
   4090 
   4091      Provided that the value of ‘merge.conflictstyle’ is ‘diff3’, you
   4092      can view the file’s merge-base revision using ‘/’ in the Ediff
   4093      control buffer.
   4094 
   4095      In the rare event that you want to manually resolve all conflicts,
   4096      including those already resolved by Git, use
   4097      ‘ediff-merge-revisions-with-ancestor’.
   4098 
   4099 ‘E s’     (‘magit-ediff-stage’)
   4100 
   4101      Stage and unstage changes to a file using Ediff, defaulting to the
   4102      file at point.
   4103 
   4104 ‘E u’     (‘magit-ediff-show-unstaged’)
   4105 
   4106      Show unstaged changes to a file using Ediff.
   4107 
   4108 ‘E i’     (‘magit-ediff-show-staged’)
   4109 
   4110      Show staged changes to a file using Ediff.
   4111 
   4112 ‘E w’     (‘magit-ediff-show-working-tree’)
   4113 
   4114      Show changes in a file between ‘HEAD’ and working tree using Ediff.
   4115 
   4116 ‘E c’     (‘magit-ediff-show-commit’)
   4117 
   4118      Show changes to a file introduced by a commit using Ediff.
   4119 
   4120 ‘E z’     (‘magit-ediff-show-stash’)
   4121 
   4122      Show changes to a file introduced by a stash using Ediff.
   4123 
   4124  -- User Option: magit-ediff-dwim-show-on-hunks
   4125 
   4126      This option controls what command ‘magit-ediff-dwim’ calls when
   4127      point is on uncommitted hunks.  When nil, always run
   4128      ‘magit-ediff-stage’.  Otherwise, use ‘magit-ediff-show-staged’ and
   4129      ‘magit-ediff-show-unstaged’ to show staged and unstaged changes,
   4130      respectively.
   4131 
   4132  -- User Option: magit-ediff-show-stash-with-index
   4133 
   4134      This option controls whether ‘magit-ediff-show-stash’ includes a
   4135      buffer containing the file’s state in the index at the time the
   4136      stash was created.  This makes it possible to tell which changes in
   4137      the stash were staged.
   4138 
   4139  -- User Option: magit-ediff-quit-hook
   4140 
   4141      This hook is run after quitting an Ediff session that was created
   4142      using a Magit command.  The hook functions are run inside the Ediff
   4143      control buffer, and should not change the current buffer.
   4144 
   4145      This is similar to ‘ediff-quit-hook’ but takes the needs of Magit
   4146      into account.  The regular ‘ediff-quit-hook’ is ignored by Ediff
   4147      sessions that were created using a Magit command.
   4148 
   4149 
   4150 File: magit.info,  Node: References Buffer,  Next: Bisecting,  Prev: Ediffing,  Up: Inspecting
   4151 
   4152 5.6 References Buffer
   4153 =====================
   4154 
   4155 ‘y’     (‘magit-show-refs’)
   4156 
   4157      This command lists branches and tags in a dedicated buffer.
   4158 
   4159      However if this command is invoked again from this buffer or if it
   4160      is invoked with a prefix argument, then it acts as a transient
   4161      prefix command, which binds the following suffix commands and some
   4162      infix arguments.
   4163 
   4164    All of the following suffix commands list exactly the same branches
   4165 and tags.  The only difference the optional feature that can be enabled
   4166 by changing the value of ‘magit-refs-show-commit-count’ (see below).
   4167 These commands specify a different branch or commit against which all
   4168 the other references are compared.
   4169 
   4170 ‘y y’     (‘magit-show-refs-head’)
   4171 
   4172      This command lists branches and tags in a dedicated buffer.  Each
   4173      reference is being compared with ‘HEAD’.
   4174 
   4175 ‘y c’     (‘magit-show-refs-current’)
   4176 
   4177      This command lists branches and tags in a dedicated buffer.  Each
   4178      reference is being compared with the current branch or ‘HEAD’ if it
   4179      is detached.
   4180 
   4181 ‘y o’     (‘magit-show-refs-other’)
   4182 
   4183      This command lists branches and tags in a dedicated buffer.  Each
   4184      reference is being compared with a branch read from the user.
   4185 
   4186 ‘y r’     (‘magit-refs-set-show-commit-count’)
   4187 
   4188      This command changes for which refs the commit count is shown.
   4189 
   4190  -- User Option: magit-refs-show-commit-count
   4191 
   4192      Whether to show commit counts in Magit-Refs mode buffers.
   4193 
   4194         • ‘all’ Show counts for branches and tags.
   4195 
   4196         • ‘branch’ Show counts for branches only.
   4197 
   4198         • ‘nil’ Never show counts.
   4199 
   4200      The default is ‘nil’ because anything else can be very expensive.
   4201 
   4202  -- User Option: magit-refs-pad-commit-counts
   4203 
   4204      Whether to pad all commit counts on all sides in Magit-Refs mode
   4205      buffers.
   4206 
   4207      If this is nil, then some commit counts are displayed right next to
   4208      one of the branches that appear next to the count, without any
   4209      space in between.  This might look bad if the branch name faces
   4210      look too similar to ‘magit-dimmed’.
   4211 
   4212      If this is non-nil, then spaces are placed on both sides of all
   4213      commit counts.
   4214 
   4215  -- User Option: magit-refs-show-remote-prefix
   4216 
   4217      Whether to show the remote prefix in lists of remote branches.
   4218 
   4219      Showing the prefix is redundant because the name of the remote is
   4220      already shown in the heading preceding the list of its branches.
   4221 
   4222  -- User Option: magit-refs-primary-column-width
   4223 
   4224      Width of the primary column in ‘magit-refs-mode’ buffers.  The
   4225      primary column is the column that contains the name of the branch
   4226      that the current row is about.
   4227 
   4228      If this is an integer, then the column is that many columns wide.
   4229      Otherwise it has to be a cons-cell of two integers.  The first
   4230      specifies the minimal width, the second the maximal width.  In that
   4231      case the actual width is determined using the length of the names
   4232      of the shown local branches.  (Remote branches and tags are not
   4233      taken into account when calculating to optimal width.)
   4234 
   4235  -- User Option: magit-refs-focus-column-width
   4236 
   4237      Width of the focus column in ‘magit-refs-mode’ buffers.
   4238 
   4239      The focus column is the first column, which marks one branch
   4240      (usually the current branch) as the focused branch using ‘*’ or
   4241      ‘@’.  For each other reference, this column optionally shows how
   4242      many commits it is ahead of the focused branch and ‘<’, or if it
   4243      isn’t ahead then the commits it is behind and ‘>’, or if it isn’t
   4244      behind either, then a ‘=’.
   4245 
   4246      This column may also display only ‘*’ or ‘@’ for the focused
   4247      branch, in which case this option is ignored.  Use ‘L v’ to change
   4248      the verbosity of this column.
   4249 
   4250  -- User Option: magit-refs-margin
   4251 
   4252      This option specifies whether the margin is initially shown in
   4253      Magit-Refs mode buffers and how it is formatted.
   4254 
   4255      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   4256 
   4257         • If INIT is non-nil, then the margin is shown initially.
   4258 
   4259         • STYLE controls how to format the author or committer date.  It
   4260           can be one of ‘age’ (to show the age of the commit),
   4261           ‘age-abbreviated’ (to abbreviate the time unit to a
   4262           character), or a string (suitable for ‘format-time-string’) to
   4263           show the actual date.  Option
   4264           ‘magit-log-margin-show-committer-date’ controls which date is
   4265           being displayed.
   4266 
   4267         • WIDTH controls the width of the margin.  This exists for
   4268           forward compatibility and currently the value should not be
   4269           changed.
   4270 
   4271         • AUTHOR controls whether the name of the author is also shown
   4272           by default.
   4273 
   4274         • AUTHOR-WIDTH has to be an integer.  When the name of the
   4275           author is shown, then this specifies how much space is used to
   4276           do so.
   4277 
   4278  -- User Option: magit-refs-margin-for-tags
   4279 
   4280      This option specifies whether to show information about tags in the
   4281      margin.  This is disabled by default because it is slow if there
   4282      are many tags.
   4283 
   4284    The following variables control how individual refs are displayed.
   4285 If you change one of these variables (especially the "%c" part), then
   4286 you should also change the others to keep things aligned.  The following
   4287 %-sequences are supported:
   4288 
   4289    • ‘%a’ Number of commits this ref has over the one we compare to.
   4290 
   4291    • ‘%b’ Number of commits the ref we compare to has over this one.
   4292 
   4293    • ‘%c’ Number of commits this ref has over the one we compare to.
   4294      For the ref which all other refs are compared this is instead "@",
   4295      if it is the current branch, or "#" otherwise.
   4296 
   4297    • ‘%C’ For the ref which all other refs are compared this is "@", if
   4298      it is the current branch, or "#" otherwise.  For all other refs "
   4299      ".
   4300 
   4301    • ‘%h’ Hash of this ref’s tip.
   4302 
   4303    • ‘%m’ Commit summary of the tip of this ref.
   4304 
   4305    • ‘%n’ Name of this ref.
   4306 
   4307    • ‘%u’ Upstream of this local branch.
   4308 
   4309    • ‘%U’ Upstream of this local branch and additional local vs.
   4310      upstream information.
   4311 
   4312  -- User Option: magit-refs-filter-alist
   4313 
   4314      The purpose of this option is to forgo displaying certain refs
   4315      based on their name.  If you want to not display any refs of a
   4316      certain type, then you should remove the appropriate function from
   4317      ‘magit-refs-sections-hook’ instead.
   4318 
   4319      This alist controls which tags and branches are omitted from being
   4320      displayed in ‘magit-refs-mode’ buffers.  If it is ‘nil’, then all
   4321      refs are displayed (subject to ‘magit-refs-sections-hook’).
   4322 
   4323      All keys are tried in order until one matches.  Then its value is
   4324      used and subsequent elements are ignored.  If the value is non-nil,
   4325      then the reference is displayed, otherwise it is not.  If no
   4326      element matches, then the reference is displayed.
   4327 
   4328      A key can either be a regular expression that the refname has to
   4329      match, or a function that takes the refname as only argument and
   4330      returns a boolean.  A remote branch such as "origin/master" is
   4331      displayed as just "master", however for this comparison the former
   4332      is used.
   4333 
   4334 ‘RET’     (‘magit-visit-ref’)
   4335 
   4336      This command visits the reference or revision at point in another
   4337      buffer.  If there is no revision at point or with a prefix argument
   4338      then it prompts for a revision.
   4339 
   4340      This command behaves just like ‘magit-show-commit’ as described
   4341      above, except if point is on a reference in a ‘magit-refs-mode’
   4342      buffer, in which case the behavior may be different, but only if
   4343      you have customized the option ‘magit-visit-ref-behavior’.
   4344 
   4345  -- User Option: magit-visit-ref-behavior
   4346 
   4347      This option controls how ‘magit-visit-ref’ behaves in
   4348      ‘magit-refs-mode’ buffers.
   4349 
   4350      By default ‘magit-visit-ref’ behaves like ‘magit-show-commit’, in
   4351      all buffers, including ‘magit-refs-mode’ buffers.  When the type of
   4352      the section at point is ‘commit’ then "RET" is bound to
   4353      ‘magit-show-commit’, and when the type is either ‘branch’ or ‘tag’
   4354      then it is bound to ‘magit-visit-ref’.
   4355 
   4356      "RET" is one of Magit’s most essential keys and at least by default
   4357      it should behave consistently across all of Magit, especially
   4358      because users quickly learn that it does something very harmless;
   4359      it shows more information about the thing at point in another
   4360      buffer.
   4361 
   4362      However "RET" used to behave differently in ‘magit-refs-mode’
   4363      buffers, doing surprising things, some of which cannot really be
   4364      described as "visit this thing".  If you’ve grown accustomed this
   4365      behavior, you can restore it by adding one or more of the below
   4366      symbols to the value of this option.  But keep in mind that by
   4367      doing so you don’t only introduce inconsistencies, you also lose
   4368      some functionality and might have to resort to ‘M-x
   4369      magit-show-commit’ to get it back.
   4370 
   4371      ‘magit-visit-ref’ looks for these symbols in the order in which
   4372      they are described here.  If the presence of a symbol applies to
   4373      the current situation, then the symbols that follow do not affect
   4374      the outcome.
   4375 
   4376         • ‘focus-on-ref’
   4377 
   4378           With a prefix argument update the buffer to show commit counts
   4379           and lists of cherry commits relative to the reference at point
   4380           instead of relative to the current buffer or ‘HEAD’.
   4381 
   4382           Instead of adding this symbol, consider pressing "C-u y o
   4383           RET".
   4384 
   4385         • ‘create-branch’
   4386 
   4387           If point is on a remote branch, then create a new local branch
   4388           with the same name, use the remote branch as its upstream, and
   4389           then check out the local branch.
   4390 
   4391           Instead of adding this symbol, consider pressing "b c RET
   4392           RET", like you would do in other buffers.
   4393 
   4394         • ‘checkout-any’
   4395 
   4396           Check out the reference at point.  If that reference is a tag
   4397           or a remote branch, then this results in a detached ‘HEAD’.
   4398 
   4399           Instead of adding this symbol, consider pressing "b b RET",
   4400           like you would do in other buffers.
   4401 
   4402         • ‘checkout-branch’
   4403 
   4404           Check out the local branch at point.
   4405 
   4406           Instead of adding this symbol, consider pressing "b b RET",
   4407           like you would do in other buffers.
   4408 
   4409 * Menu:
   4410 
   4411 * References Sections::
   4412 
   4413 
   4414 File: magit.info,  Node: References Sections,  Up: References Buffer
   4415 
   4416 5.6.1 References Sections
   4417 -------------------------
   4418 
   4419 The contents of references buffers is controlled using the hook
   4420 ‘magit-refs-sections-hook’.  See *note Section Hooks:: to learn about
   4421 such hooks and how to customize them.  All of the below functions are
   4422 members of the default value.  Note that it makes much less sense to
   4423 customize this hook than it does for the respective hook used for the
   4424 status buffer.
   4425 
   4426  -- User Option: magit-refs-sections-hook
   4427 
   4428      Hook run to insert sections into a references buffer.
   4429 
   4430  -- Function: magit-insert-local-branches
   4431 
   4432      Insert sections showing all local branches.
   4433 
   4434  -- Function: magit-insert-remote-branches
   4435 
   4436      Insert sections showing all remote-tracking branches.
   4437 
   4438  -- Function: magit-insert-tags
   4439 
   4440      Insert sections showing all tags.
   4441 
   4442 
   4443 File: magit.info,  Node: Bisecting,  Next: Visiting Files and Blobs,  Prev: References Buffer,  Up: Inspecting
   4444 
   4445 5.7 Bisecting
   4446 =============
   4447 
   4448 Also see *note (gitman)git-bisect::.
   4449 
   4450 ‘B’     (‘magit-bisect’)
   4451 
   4452      This transient prefix command binds the following suffix commands
   4453      and displays them in a temporary buffer until a suffix is invoked.
   4454 
   4455    When bisecting is not in progress, then the transient features the
   4456 following suffix commands.
   4457 
   4458 ‘B B’     (‘magit-bisect-start’)
   4459 
   4460      Start a bisect session.
   4461 
   4462      Bisecting a bug means to find the commit that introduced it.  This
   4463      command starts such a bisect session by asking for a known good
   4464      commit and a known bad commit.  If you’re bisecting a change that
   4465      isn’t a regression, you can select alternate terms that are
   4466      conceptually more fitting than "bad" and "good", but the infix
   4467      arguments to do so are disabled by default.
   4468 
   4469 ‘B s’     (‘magit-bisect-run’)
   4470 
   4471      Bisect automatically by running commands after each step.
   4472 
   4473    When bisecting in progress, then the transient instead features the
   4474 following suffix commands.
   4475 
   4476 ‘B b’     (‘magit-bisect-bad’)
   4477 
   4478      Mark the current commit as bad.  Use this after you have asserted
   4479      that the commit does contain the bug in question.
   4480 
   4481 ‘B g’     (‘magit-bisect-good’)
   4482 
   4483      Mark the current commit as good.  Use this after you have asserted
   4484      that the commit does not contain the bug in question.
   4485 
   4486 ‘B m’     (‘magit-bisect-mark’)
   4487 
   4488      Mark the current commit with one of the bisect terms.  This command
   4489      provides an alternative to ‘magit-bisect-bad’ and
   4490      ‘magit-bisect-good’ and is useful when using terms other than "bad"
   4491      and "good".  This suffix is disabled by default.
   4492 
   4493 ‘B k’     (‘magit-bisect-skip’)
   4494 
   4495      Skip the current commit.  Use this if for some reason the current
   4496      commit is not a good one to test.  This command lets Git choose a
   4497      different one.
   4498 
   4499 ‘B r’     (‘magit-bisect-reset’)
   4500 
   4501      After bisecting, cleanup bisection state and return to original
   4502      ‘HEAD’.
   4503 
   4504    By default the status buffer shows information about the ongoing
   4505 bisect session.
   4506 
   4507  -- User Option: magit-bisect-show-graph
   4508 
   4509      This option controls whether a graph is displayed for the log of
   4510      commits that still have to be bisected.
   4511 
   4512 
   4513 File: magit.info,  Node: Visiting Files and Blobs,  Next: Blaming,  Prev: Bisecting,  Up: Inspecting
   4514 
   4515 5.8 Visiting Files and Blobs
   4516 ============================
   4517 
   4518 Magit provides several commands that visit a file or blob (the version
   4519 of a file that is stored in a certain commit).  Actually it provides
   4520 several *groups* of such commands and the several *variants* within each
   4521 group.
   4522 
   4523 * Menu:
   4524 
   4525 * General-Purpose Visit Commands::
   4526 * Visiting Files and Blobs from a Diff::
   4527 
   4528 
   4529 File: magit.info,  Node: General-Purpose Visit Commands,  Next: Visiting Files and Blobs from a Diff,  Up: Visiting Files and Blobs
   4530 
   4531 5.8.1 General-Purpose Visit Commands
   4532 ------------------------------------
   4533 
   4534 These commands can be used anywhere to open any blob.  Currently no keys
   4535 are bound to these commands by default, but that is likely to change.
   4536 
   4537  -- Command: magit-find-file
   4538 
   4539      This command reads a filename and revision from the user and visits
   4540      the respective blob in a buffer.  The buffer is displayed in the
   4541      selected window.
   4542 
   4543  -- Command: magit-find-file-other-window
   4544 
   4545      This command reads a filename and revision from the user and visits
   4546      the respective blob in a buffer.  The buffer is displayed in
   4547      another window.
   4548 
   4549  -- Command: magit-find-file-other-frame
   4550 
   4551      This command reads a filename and revision from the user and visits
   4552      the respective blob in a buffer.  The buffer is displayed in
   4553      another frame.
   4554 
   4555 
   4556 File: magit.info,  Node: Visiting Files and Blobs from a Diff,  Prev: General-Purpose Visit Commands,  Up: Visiting Files and Blobs
   4557 
   4558 5.8.2 Visiting Files and Blobs from a Diff
   4559 ------------------------------------------
   4560 
   4561 These commands can only be used when point is inside a diff.
   4562 
   4563 ‘RET’     (‘magit-diff-visit-file’)
   4564 
   4565      This command visits the appropriate version of the file that the
   4566      diff at point is about.
   4567 
   4568      This commands visits the worktree version of the appropriate file.
   4569      The location of point inside the diff determines which file is
   4570      being visited.  The visited version depends on what changes the
   4571      diff is about.
   4572 
   4573         • If the diff shows uncommitted changes (i.e.  staged or
   4574           unstaged changes), then visit the file in the working tree
   4575           (i.e.  the same "real" file that ‘find-file’ would visit.  In
   4576           all other cases visit a "blob" (i.e.  the version of a file as
   4577           stored in some commit).
   4578 
   4579         • If point is on a removed line, then visit the blob for the
   4580           first parent of the commit that removed that line, i.e.  the
   4581           last commit where that line still exists.
   4582 
   4583         • If point is on an added or context line, then visit the blob
   4584           that adds that line, or if the diff shows from more than a
   4585           single commit, then visit the blob from the last of these
   4586           commits.
   4587 
   4588      In the file-visiting buffer this command goes to the line that
   4589      corresponds to the line that point is on in the diff.
   4590 
   4591      The buffer is displayed in the selected window.  With a prefix
   4592      argument the buffer is displayed in another window instead.
   4593 
   4594  -- User Option: magit-diff-visit-previous-blob
   4595 
   4596      This option controls whether ‘magit-diff-visit-file’ may visit the
   4597      previous blob.  When this is ‘t’ (the default) and point is on a
   4598      removed line in a diff for a committed change, then
   4599      ‘magit-diff-visit-file’ visits the blob from the last revision
   4600      which still had that line.
   4601 
   4602      Currently this is only supported for committed changes, for staged
   4603      and unstaged changes ‘magit-diff-visit-file’ always visits the file
   4604      in the working tree.
   4605 
   4606 ‘C-<return>’     (‘magit-diff-visit-file-worktree’)
   4607 
   4608      This command visits the worktree version of the appropriate file.
   4609      The location of point inside the diff determines which file is
   4610      being visited.  Unlike ‘magit-diff-visit-file’ it always visits the
   4611      "real" file in the working tree, i.e the "current version" of the
   4612      file.
   4613 
   4614      In the file-visiting buffer this command goes to the line that
   4615      corresponds to the line that point is on in the diff.  Lines that
   4616      were added or removed in the working tree, the index and other
   4617      commits in between are automatically accounted for.
   4618 
   4619      The buffer is displayed in the selected window.  With a prefix
   4620      argument the buffer is displayed in another window instead.
   4621 
   4622    Variants of the above two commands exist that instead visit the file
   4623 in another window or in another frame.  If you prefer such behavior,
   4624 then you may want to change the above key bindings, but note that the
   4625 above commands also use another window when invoked with a prefix
   4626 argument.
   4627 
   4628  -- Command: magit-diff-visit-file-other-window
   4629  -- Command: magit-diff-visit-file-other-frame
   4630  -- Command: magit-diff-visit-worktree-file-other-window
   4631  -- Command: magit-diff-visit-worktree-file-other-frame
   4632 
   4633 
   4634 File: magit.info,  Node: Blaming,  Prev: Visiting Files and Blobs,  Up: Inspecting
   4635 
   4636 5.9 Blaming
   4637 ===========
   4638 
   4639 Also see *note (gitman)git-blame::.
   4640 
   4641    To start blaming invoke the ‘magit-file-dispatch’ transient prefix
   4642 command by pressing ‘C-c M-g’.
   4643 
   4644    The blaming suffix commands can be invoked from the dispatch
   4645 transient.  However if you want to set an infix argument, then you have
   4646 to enter the blaming sub-transient first.
   4647 
   4648    The key bindings shown below assume that you enter the dispatch
   4649 transient using the default binding.
   4650 
   4651 ‘C-c M-g B’     (‘magit-blame’)
   4652 
   4653      This transient prefix command binds the following suffix commands
   4654      along with the appropriate infix arguments and displays them in a
   4655      temporary buffer until a suffix is invoked.
   4656 
   4657    Note that not all of the following suffixes are available at all
   4658 times.  For example if ‘magit-blame-mode’ is not enabled, then the
   4659 command whose purpose is to turn off that mode would not be of any use
   4660 and therefore isn’t available.
   4661 
   4662 ‘C-c M-g b’     (‘magit-blame-addition’)
   4663 ‘C-c M-g B b’     (‘magit-blame-addition’)
   4664 
   4665      This command augments each line or chunk of lines in the current
   4666      file-visiting or blob-visiting buffer with information about what
   4667      commits last touched these lines.
   4668 
   4669      If the buffer visits a revision of that file, then history up to
   4670      that revision is considered.  Otherwise, the file’s full history is
   4671      considered, including uncommitted changes.
   4672 
   4673      If Magit-Blame mode is already turned on in the current buffer then
   4674      blaming is done recursively, by visiting REVISION:FILE (using
   4675      ‘magit-find-file’), where REVISION is a parent of the revision that
   4676      added the current line or chunk of lines.
   4677 
   4678 ‘C-c M-g r’     (‘magit-blame-removal’)
   4679 ‘C-c M-g B r’     (‘magit-blame-removal’)
   4680 
   4681      This command augments each line or chunk of lines in the current
   4682      blob-visiting buffer with information about the revision that
   4683      removes it.  It cannot be used in file-visiting buffers.
   4684 
   4685      Like ‘magit-blame-addition’, this command can be used recursively.
   4686 
   4687 ‘C-c M-g f’     (‘magit-blame-reverse’)
   4688 ‘C-c M-g B f’     (‘magit-blame-reverse’)
   4689 
   4690      This command augments each line or chunk of lines in the current
   4691      file-visiting or blob-visiting buffer with information about the
   4692      last revision in which a line still existed.
   4693 
   4694      Like ‘magit-blame-addition’, this command can be used recursively.
   4695 
   4696 ‘C-c M-g e’     (‘magit-blame-echo’)
   4697 ‘C-c M-g B e’     (‘magit-blame-echo’)
   4698 
   4699      This command is like ‘magit-blame-addition’ except that it doesn’t
   4700      turn on ‘read-only-mode’ and that it initially uses the
   4701      visualization style specified by option ‘magit-blame-echo-style’.
   4702 
   4703    The following key bindings are available when Magit-Blame mode is
   4704 enabled and Read-Only mode is not enabled.  These commands are also
   4705 available in other buffers; here only the behavior is described that is
   4706 relevant in file-visiting buffers that are being blamed.
   4707 
   4708 ‘RET’     (‘magit-show-commit’)
   4709 
   4710      This command shows the commit that last touched the line at point.
   4711 
   4712 ‘SPC’     (‘magit-diff-show-or-scroll-up’)
   4713 
   4714      This command updates the commit buffer.
   4715 
   4716      This either shows the commit that last touched the line at point in
   4717      the appropriate buffer, or if that buffer is already being
   4718      displayed in the current frame and if that buffer contains
   4719      information about that commit, then the buffer is scrolled up
   4720      instead.
   4721 
   4722 ‘DEL’     (‘magit-diff-show-or-scroll-down’)
   4723 
   4724      This command updates the commit buffer.
   4725 
   4726      This either shows the commit that last touched the line at point in
   4727      the appropriate buffer, or if that buffer is already being
   4728      displayed in the current frame and if that buffer contains
   4729      information about that commit, then the buffer is scrolled down
   4730      instead.
   4731 
   4732    The following key bindings are available when both Magit-Blame mode
   4733 and Read-Only mode are enabled.
   4734 
   4735 ‘b’     (‘magit-blame’)
   4736 
   4737      See above.
   4738 
   4739 ‘n’     (‘magit-blame-next-chunk’)
   4740 
   4741      This command moves to the next chunk.
   4742 
   4743 ‘N’     (‘magit-blame-next-chunk-same-commit’)
   4744 
   4745      This command moves to the next chunk from the same commit.
   4746 
   4747 ‘p’     (‘magit-blame-previous-chunk’)
   4748 
   4749      This command moves to the previous chunk.
   4750 
   4751 ‘P’     (‘magit-blame-previous-chunk-same-commit’)
   4752 
   4753      This command moves to the previous chunk from the same commit.
   4754 
   4755 ‘q’     (‘magit-blame-quit’)
   4756 
   4757      This command turns off Magit-Blame mode.  If the buffer was created
   4758      during a recursive blame, then it also kills the buffer.
   4759 
   4760 ‘M-w’     (‘magit-blame-copy-hash’)
   4761 
   4762      This command saves the hash of the current chunk’s commit to the
   4763      kill ring.
   4764 
   4765      When the region is active, the command saves the region’s content
   4766      instead of the hash, like ‘kill-ring-save’ would.
   4767 
   4768 ‘c’     (‘magit-blame-cycle-style’)
   4769 
   4770      This command changes how blame information is visualized in the
   4771      current buffer by cycling through the styles specified using the
   4772      option ‘magit-blame-styles’.
   4773 
   4774    Blaming is also controlled using the following options.
   4775 
   4776  -- User Option: magit-blame-styles
   4777 
   4778      This option defines a list of styles used to visualize blame
   4779      information.  For now see its doc-string to learn more.
   4780 
   4781  -- User Option: magit-blame-echo-style
   4782 
   4783      This option specifies the blame visualization style used by the
   4784      command ‘magit-blame-echo’.  This must be a symbol that is used as
   4785      the identifier for one of the styles defined in
   4786      ‘magit-blame-styles’.
   4787 
   4788  -- User Option: magit-blame-time-format
   4789 
   4790      This option specifies the format string used to display times when
   4791      showing blame information.
   4792 
   4793  -- User Option: magit-blame-read-only
   4794 
   4795      This option controls whether blaming a buffer also makes
   4796      temporarily read-only.
   4797 
   4798  -- User Option: magit-blame-disable-modes
   4799 
   4800      This option lists incompatible minor-modes that should be disabled
   4801      temporarily when a buffer contains blame information.  They are
   4802      enabled again when the buffer no longer shows blame information.
   4803 
   4804  -- User Option: magit-blame-goto-chunk-hook
   4805 
   4806      This hook is run when moving between chunks.
   4807 
   4808 
   4809 File: magit.info,  Node: Manipulating,  Next: Transferring,  Prev: Inspecting,  Up: Top
   4810 
   4811 6 Manipulating
   4812 **************
   4813 
   4814 * Menu:
   4815 
   4816 * Creating Repository::
   4817 * Cloning Repository::
   4818 * Staging and Unstaging::
   4819 * Applying::
   4820 * Committing::
   4821 * Branching::
   4822 * Merging::
   4823 * Resolving Conflicts::
   4824 * Rebasing::
   4825 * Cherry Picking::
   4826 * Resetting::
   4827 * Stashing::
   4828 
   4829 
   4830 File: magit.info,  Node: Creating Repository,  Next: Cloning Repository,  Up: Manipulating
   4831 
   4832 6.1 Creating Repository
   4833 =======================
   4834 
   4835 ‘I’     (‘magit-init’)
   4836 
   4837      This command initializes a repository and then shows the status
   4838      buffer for the new repository.
   4839 
   4840      If the directory is below an existing repository, then the user has
   4841      to confirm that a new one should be created inside.  If the
   4842      directory is the root of the existing repository, then the user has
   4843      to confirm that it should be reinitialized.
   4844 
   4845 
   4846 File: magit.info,  Node: Cloning Repository,  Next: Staging and Unstaging,  Prev: Creating Repository,  Up: Manipulating
   4847 
   4848 6.2 Cloning Repository
   4849 ======================
   4850 
   4851 To clone a remote or local repository use ‘C’, which is bound to the
   4852 command ‘magit-clone’.  This command either act as a transient prefix
   4853 command, which binds several infix arguments and suffix commands, or it
   4854 can invoke ‘git clone’ directly, depending on whether a prefix argument
   4855 is used and on the value of ‘magit-clone-always-transient’.
   4856 
   4857  -- User Option: magit-clone-always-transient
   4858 
   4859      This option controls whether the command ‘magit-clone’ always acts
   4860      as a transient prefix command, regardless of whether a prefix
   4861      argument is used or not.  If ‘t’, then that command always acts as
   4862      a transient prefix.  If ‘nil’, then a prefix argument has to be
   4863      used for it to act as a transient.
   4864 
   4865 ‘C’     (‘magit-clone’)
   4866 
   4867      This command either acts as a transient prefix command as described
   4868      above or does the same thing as ‘transient-clone-regular’ as
   4869      described below.
   4870 
   4871      If it acts as a transient prefix, then it binds the following
   4872      suffix commands and several infix arguments.
   4873 
   4874 ‘C C’     (‘magit-clone-regular’)
   4875 
   4876      This command creates a regular clone of an existing repository.
   4877      The repository and the target directory are read from the user.
   4878 
   4879 ‘C s’     (‘magit-clone-shallow’)
   4880 
   4881      This command creates a shallow clone of an existing repository.
   4882      The repository and the target directory are read from the user.  By
   4883      default the depth of the cloned history is a single commit, but
   4884      with a prefix argument the depth is read from the user.
   4885 
   4886 ‘C b’     (‘magit-clone-bare’)
   4887 
   4888      This command creates a bare clone of an existing repository.  The
   4889      repository and the target directory are read from the user.
   4890 
   4891 ‘C m’     (‘magit-clone-mirror’)
   4892 
   4893      This command creates a mirror of an existing repository.  The
   4894      repository and the target directory are read from the user.
   4895 
   4896    The following suffixes are disabled by default.  See *note
   4897 (transient)Enabling and Disabling Suffixes:: for how to enable them.
   4898 
   4899 ‘C d’     (‘magit-clone-shallow-since’)
   4900 
   4901      This command creates a shallow clone of an existing repository.
   4902      Only commits that were committed after a date are cloned, which is
   4903      read from the user.  The repository and the target directory are
   4904      also read from the user.
   4905 
   4906 ‘C e’     (‘magit-clone-shallow-exclude’)
   4907 
   4908      This command creates a shallow clone of an existing repository.
   4909      This reads a branch or tag from the user.  Commits that are
   4910      reachable from that are not cloned.  The repository and the target
   4911      directory are also read from the user.
   4912 
   4913  -- User Option: magit-clone-set-remote-head
   4914 
   4915      This option controls whether cloning causes the reference
   4916      ‘refs/remotes/<remote>/HEAD’ to be created in the clone.  The
   4917      default is to delete the reference after running ‘git clone’, which
   4918      insists on creating it.  This is because the reference has not been
   4919      found to be particularly useful as it is not automatically updated
   4920      when the ‘HEAD’ of the remote changes.  Setting this option to ‘t’
   4921      preserves Git’s default behavior of creating the reference.
   4922 
   4923  -- User Option: magit-clone-set-remote.pushDefault
   4924 
   4925      This option controls whether the value of the Git variable
   4926      ‘remote.pushDefault’ is set after cloning.
   4927 
   4928         • If ‘t’, then it is always set without asking.
   4929 
   4930         • If ‘ask’, then the users are asked every time they clone a
   4931           repository.
   4932 
   4933         • If ‘nil’, then it is never set.
   4934 
   4935  -- User Option: magit-clone-default-directory
   4936 
   4937      This option control the default directory name used when reading
   4938      the destination for a cloning operation.
   4939 
   4940         • If ‘nil’ (the default), then the value of ‘default-directory’
   4941           is used.
   4942 
   4943         • If a directory, then that is used.
   4944 
   4945         • If a function, then that is called with the remote url as the
   4946           only argument and the returned value is used.
   4947 
   4948  -- User Option: magit-clone-name-alist
   4949 
   4950      This option maps regular expressions, which match repository names,
   4951      to repository urls, making it possible for users to enter short
   4952      names instead of urls when cloning repositories.
   4953 
   4954      Each element has the form ‘(REGEXP HOSTNAME USER)’.  When the user
   4955      enters a name when a cloning command asks for a name or url, then
   4956      that is looked up in this list.  The first element whose REGEXP
   4957      matches is used.
   4958 
   4959      The format specified by option ‘magit-clone-url-format’ is used to
   4960      turn the name into an url, using HOSTNAME and the repository name.
   4961      If the provided name contains a slash, then that is used.
   4962      Otherwise if the name omits the owner of the repository, then the
   4963      default user specified in the matched entry is used.
   4964 
   4965      If USER contains a dot, then it is treated as a Git variable and
   4966      the value of that is used as the username.  Otherwise it is used as
   4967      the username itself.
   4968 
   4969  -- User Option: magit-clone-url-format
   4970 
   4971      The format specified by this option is used when turning repository
   4972      names into urls.  ‘%h’ is the hostname and ‘%n’ is the repository
   4973      name, including the name of the owner.
   4974 
   4975 
   4976 File: magit.info,  Node: Staging and Unstaging,  Next: Applying,  Prev: Cloning Repository,  Up: Manipulating
   4977 
   4978 6.3 Staging and Unstaging
   4979 =========================
   4980 
   4981 Like Git, Magit can of course stage and unstage complete files.  Unlike
   4982 Git, it also allows users to gracefully un-/stage individual hunks and
   4983 even just part of a hunk.  To stage individual hunks and parts of hunks
   4984 using Git directly, one has to use the very modal and rather clumsy
   4985 interface of a ‘git add --interactive’ session.
   4986 
   4987    With Magit, on the other hand, one can un-/stage individual hunks by
   4988 just moving point into the respective section inside a diff displayed in
   4989 the status buffer or a separate diff buffer and typing ‘s’ or ‘u’.  To
   4990 operate on just parts of a hunk, mark the changes that should be
   4991 un-/staged using the region and then press the same key that would be
   4992 used to un-/stage.  To stage multiple files or hunks at once use a
   4993 region that starts inside the heading of such a section and ends inside
   4994 the heading of a sibling section of the same type.
   4995 
   4996    Besides staging and unstaging, Magit also provides several other
   4997 "apply variants" that can also operate on a file, multiple files at
   4998 once, a hunk, multiple hunks at once, and on parts of a hunk.  These
   4999 apply variants are described in the next section.
   5000 
   5001    You can also use Ediff to stage and unstage.  See *note Ediffing::.
   5002 
   5003 ‘s’     (‘magit-stage’)
   5004 
   5005      Add the change at point to the staging area.
   5006 
   5007      With a prefix argument and an untracked file (or files) at point,
   5008      stage the file but not its content.  This makes it possible to
   5009      stage only a subset of the new file’s changes.
   5010 
   5011 ‘S’     (‘magit-stage-modified’)
   5012 
   5013      Stage all changes to files modified in the worktree.  Stage all new
   5014      content of tracked files and remove tracked files that no longer
   5015      exist in the working tree from the index also.  With a prefix
   5016      argument also stage previously untracked (but not ignored) files.
   5017 
   5018 ‘u’     (‘magit-unstage’)
   5019 
   5020      Remove the change at point from the staging area.
   5021 
   5022      Only staged changes can be unstaged.  But by default this command
   5023      performs an action that is somewhat similar to unstaging, when it
   5024      is called on a committed change: it reverses the change in the
   5025      index but not in the working tree.
   5026 
   5027 ‘U’     (‘magit-unstage-all’)
   5028 
   5029      Remove all changes from the staging area.
   5030 
   5031  -- User Option: magit-unstage-committed
   5032 
   5033      This option controls whether ‘magit-unstage’ "unstages" committed
   5034      changes by reversing them in the index but not the working tree.
   5035      The alternative is to raise an error.
   5036 
   5037 ‘M-x magit-reverse-in-index’     (‘magit-reverse-in-index’)
   5038 
   5039      This command reverses the committed change at point in the index
   5040      but not the working tree.  By default no key is bound directly to
   5041      this command, but it is indirectly called when ‘u’
   5042      (‘magit-unstage’) is pressed on a committed change.
   5043 
   5044      This allows extracting a change from ‘HEAD’, while leaving it in
   5045      the working tree, so that it can later be committed using a
   5046      separate commit.  A typical workflow would be:
   5047 
   5048         • Optionally make sure that there are no uncommitted changes.
   5049 
   5050         • Visit the ‘HEAD’ commit and navigate to the change that should
   5051           not have been included in that commit.
   5052 
   5053         • Type ‘u’ (‘magit-unstage’) to reverse it in the index.  This
   5054           assumes that ‘magit-unstage-committed-changes’ is non-nil.
   5055 
   5056         • Type ‘c e’ to extend ‘HEAD’ with the staged changes, including
   5057           those that were already staged before.
   5058 
   5059         • Optionally stage the remaining changes using ‘s’ or ‘S’ and
   5060           then type ‘c c’ to create a new commit.
   5061 
   5062 ‘M-x magit-reset-index’     (‘magit-reset-index’)
   5063 
   5064      Reset the index to some commit.  The commit is read from the user
   5065      and defaults to the commit at point.  If there is no commit at
   5066      point, then it defaults to ‘HEAD’.
   5067 
   5068 * Menu:
   5069 
   5070 * Staging from File-Visiting Buffers::
   5071 
   5072 
   5073 File: magit.info,  Node: Staging from File-Visiting Buffers,  Up: Staging and Unstaging
   5074 
   5075 6.3.1 Staging from File-Visiting Buffers
   5076 ----------------------------------------
   5077 
   5078 Fine-grained un-/staging has to be done from the status or a diff
   5079 buffer, but it’s also possible to un-/stage all changes made to the file
   5080 visited in the current buffer right from inside that buffer.
   5081 
   5082 ‘M-x magit-stage-file’     (‘magit-stage-file’)
   5083 
   5084      When invoked inside a file-visiting buffer, then stage all changes
   5085      to that file.  In a Magit buffer, stage the file at point if any.
   5086      Otherwise prompt for a file to be staged.  With a prefix argument
   5087      always prompt the user for a file, even in a file-visiting buffer
   5088      or when there is a file section at point.
   5089 
   5090 ‘M-x magit-unstage-file’     (‘magit-unstage-file’)
   5091 
   5092      When invoked inside a file-visiting buffer, then unstage all
   5093      changes to that file.  In a Magit buffer, unstage the file at point
   5094      if any.  Otherwise prompt for a file to be unstaged.  With a prefix
   5095      argument always prompt the user for a file, even in a file-visiting
   5096      buffer or when there is a file section at point.
   5097 
   5098 
   5099 File: magit.info,  Node: Applying,  Next: Committing,  Prev: Staging and Unstaging,  Up: Manipulating
   5100 
   5101 6.4 Applying
   5102 ============
   5103 
   5104 Magit provides several "apply variants": stage, unstage, discard,
   5105 reverse, and "regular apply".  At least when operating on a hunk they
   5106 are all implemented using ‘git apply’, which is why they are called
   5107 "apply variants".
   5108 
   5109    • Stage.  Apply a change from the working tree to the index.  The
   5110      change also remains in the working tree.
   5111 
   5112    • Unstage.  Remove a change from the index.  The change remains in
   5113      the working tree.
   5114 
   5115    • Discard.  On a staged change, remove it from the working tree and
   5116      the index.  On an unstaged change, remove it from the working tree
   5117      only.
   5118 
   5119    • Reverse.  Reverse a change in the working tree.  Both committed and
   5120      staged changes can be reversed.  Unstaged changes cannot be
   5121      reversed.  Discard them instead.
   5122 
   5123    • Apply.  Apply a change to the working tree.  Both committed and
   5124      staged changes can be applied.  Unstaged changes cannot be applied
   5125      - as they already have been applied.
   5126 
   5127    The previous section described the staging and unstaging commands.
   5128 What follows are the commands which implement the remaining apply
   5129 variants.
   5130 
   5131 ‘a’     (‘magit-apply’)
   5132 
   5133      Apply the change at point to the working tree.
   5134 
   5135      With a prefix argument fallback to a 3-way merge.  Doing so causes
   5136      the change to be applied to the index as well.
   5137 
   5138 ‘k’     (‘magit-discard’)
   5139 
   5140      Remove the change at point from the working tree.
   5141 
   5142      On a hunk or file with unresolved conflicts prompt which side to
   5143      keep (while discarding the other).  If point is within the text of
   5144      a side, then keep that side without prompting.
   5145 
   5146 ‘v’     (‘magit-reverse’)
   5147 
   5148      Reverse the change at point in the working tree.
   5149 
   5150      With a prefix argument fallback to a 3-way merge.  Doing so causes
   5151      the change to be applied to the index as well.
   5152 
   5153    With a prefix argument all apply variants attempt a 3-way merge when
   5154 appropriate (i.e.  when ‘git apply’ is used internally).
   5155 
   5156 
   5157 File: magit.info,  Node: Committing,  Next: Branching,  Prev: Applying,  Up: Manipulating
   5158 
   5159 6.5 Committing
   5160 ==============
   5161 
   5162 When the user initiates a commit, Magit calls ‘git commit’ without any
   5163 arguments, so Git has to get it from the user.  It creates the file
   5164 ‘.git/COMMIT_EDITMSG’ and then opens that file in an editor.  Magit
   5165 arranges for that editor to be the Emacsclient.  Once the user finishes
   5166 the editing session, the Emacsclient exits and Git creates the commit
   5167 using the file’s content as message.
   5168 
   5169 * Menu:
   5170 
   5171 * Initiating a Commit::
   5172 * Editing Commit Messages::
   5173 
   5174 
   5175 File: magit.info,  Node: Initiating a Commit,  Next: Editing Commit Messages,  Up: Committing
   5176 
   5177 6.5.1 Initiating a Commit
   5178 -------------------------
   5179 
   5180 Also see *note (gitman)git-commit::.
   5181 
   5182 ‘c’     (‘magit-commit’)
   5183 
   5184      This transient prefix command binds the following suffix commands
   5185      along with the appropriate infix arguments and displays them in a
   5186      temporary buffer until a suffix is invoked.
   5187 
   5188 ‘c c’     (‘magit-commit-create’)
   5189 
   5190      Create a new commit on ‘HEAD’.  With a prefix argument amend to the
   5191      commit at ‘HEAD’ instead.
   5192 
   5193 ‘c a’     (‘magit-commit-amend’)
   5194 
   5195      Amend the last commit.
   5196 
   5197 ‘c e’     (‘magit-commit-extend’)
   5198 
   5199      Amend the last commit, without editing the message.  With a prefix
   5200      argument keep the committer date, otherwise change it.  The option
   5201      ‘magit-commit-extend-override-date’ can be used to inverse the
   5202      meaning of the prefix argument.
   5203 
   5204      Non-interactively respect the optional OVERRIDE-DATE argument and
   5205      ignore the option.
   5206 
   5207 ‘c w’     (‘magit-commit-reword’)
   5208 
   5209      Reword the last commit, ignoring staged changes.  With a prefix
   5210      argument keep the committer date, otherwise change it.  The option
   5211      ‘magit-commit-reword-override-date’ can be used to inverse the
   5212      meaning of the prefix argument.
   5213 
   5214      Non-interactively respect the optional OVERRIDE-DATE argument and
   5215      ignore the option.
   5216 
   5217 ‘c f’     (‘magit-commit-fixup’)
   5218 
   5219      Create a fixup commit.
   5220 
   5221      With a prefix argument the target commit has to be confirmed.
   5222      Otherwise the commit at point may be used without confirmation
   5223      depending on the value of option ‘magit-commit-squash-confirm’.
   5224 
   5225 ‘c F’     (‘magit-commit-instant-fixup’)
   5226 
   5227      Create a fixup commit and instantly rebase.
   5228 
   5229 ‘c s’     (‘magit-commit-squash’)
   5230 
   5231      Create a squash commit, without editing the squash message.
   5232 
   5233      With a prefix argument the target commit has to be confirmed.
   5234      Otherwise the commit at point may be used without confirmation
   5235      depending on the value of option ‘magit-commit-squash-confirm’.
   5236 
   5237 ‘c S’     (‘magit-commit-instant-squash’)
   5238 
   5239      Create a squash commit and instantly rebase.
   5240 
   5241 ‘c A’     (‘magit-commit-augment’)
   5242 
   5243      Create a squash commit, editing the squash message.
   5244 
   5245      With a prefix argument the target commit has to be confirmed.
   5246      Otherwise the commit at point may be used without confirmation
   5247      depending on the value of option ‘magit-commit-squash-confirm’.
   5248 
   5249  -- User Option: magit-commit-ask-to-stage
   5250 
   5251      Whether to ask to stage all unstaged changes when committing and
   5252      nothing is staged.
   5253 
   5254  -- User Option: magit-commit-show-diff
   5255 
   5256      Whether the relevant diff is automatically shown when committing.
   5257 
   5258  -- User Option: magit-commit-extend-override-date
   5259 
   5260      Whether using ‘magit-commit-extend’ changes the committer date.
   5261 
   5262  -- User Option: magit-commit-reword-override-date
   5263 
   5264      Whether using ‘magit-commit-reword’ changes the committer date.
   5265 
   5266  -- User Option: magit-commit-squash-confirm
   5267 
   5268      Whether the commit targeted by squash and fixup has to be
   5269      confirmed.  When non-nil then the commit at point (if any) is used
   5270      as default choice.  Otherwise it has to be confirmed.  This option
   5271      only affects ‘magit-commit-squash’ and ‘magit-commit-fixup’.  The
   5272      "instant" variants always require confirmation because making an
   5273      error while using those is harder to recover from.
   5274 
   5275  -- User Option: magit-post-commit-hook
   5276 
   5277      Hook run after creating a commit without the user editing a
   5278      message.
   5279 
   5280      This hook is run by ‘magit-refresh’ if ‘this-command’ is a member
   5281      of ‘magit-post-stage-hook-commands’.  This only includes commands
   5282      named ‘magit-commit-*’ that do *not* require that the user edits
   5283      the commit message in a buffer.
   5284 
   5285      Also see ‘git-commit-post-finish-hook’.
   5286 
   5287  -- User Option: magit-commit-diff-inhibit-same-window
   5288 
   5289      Whether to inhibit use of same window when showing diff while
   5290      committing.
   5291 
   5292      When writing a commit, then a diff of the changes to be committed
   5293      is automatically shown.  The idea is that the diff is shown in a
   5294      different window of the same frame and for most users that just
   5295      works.  In other words most users can completely ignore this option
   5296      because its value doesn’t make a difference for them.
   5297 
   5298      However for users who configured Emacs to never create a new window
   5299      even when the package explicitly tries to do so, then displaying
   5300      two new buffers necessarily means that the first is immediately
   5301      replaced by the second.  In our case the message buffer is
   5302      immediately replaced by the diff buffer, which is of course highly
   5303      undesirable.
   5304 
   5305      A workaround is to suppress this user configuration in this
   5306      particular case.  Users have to explicitly opt-in by toggling this
   5307      option.  We cannot enable the workaround unconditionally because
   5308      that again causes issues for other users: if the frame is too tiny
   5309      or the relevant settings too aggressive, then the diff buffer would
   5310      end up being displayed in a new frame.
   5311 
   5312      Also see <https://github.com/magit/magit/issues/4132>.
   5313 
   5314 
   5315 File: magit.info,  Node: Editing Commit Messages,  Prev: Initiating a Commit,  Up: Committing
   5316 
   5317 6.5.2 Editing Commit Messages
   5318 -----------------------------
   5319 
   5320 After initiating a commit as described in the previous section, two new
   5321 buffers appear.  One shows the changes that are about to be committed,
   5322 while the other is used to write the message.
   5323 
   5324    Commit messages are edited in an edit session - in the background
   5325 ‘git’ is waiting for the editor, in our case ‘emacsclient’, to save the
   5326 commit message in a file (in most cases ‘.git/COMMIT_EDITMSG’) and then
   5327 return.  If the editor returns with a non-zero exit status then ‘git’
   5328 does not create the commit.  So the most important commands are those
   5329 for finishing and aborting the commit.
   5330 
   5331 ‘C-c C-c’     (‘with-editor-finish’)
   5332 
   5333      Finish the current editing session by returning with exit code 0.
   5334      Git then creates the commit using the message it finds in the file.
   5335 
   5336 ‘C-c C-k’     (‘with-editor-cancel’)
   5337 
   5338      Cancel the current editing session by returning with exit code 1.
   5339      Git then cancels the commit, but leaves the file untouched.
   5340 
   5341    In addition to being used by ‘git commit’, messages may also be
   5342 stored in a ring that persists until Emacs is closed.  By default the
   5343 message is stored at the beginning and the end of an edit session
   5344 (regardless of whether the session is finished successfully or was
   5345 canceled).  It is sometimes useful to bring back messages from that
   5346 ring.
   5347 
   5348 ‘C-c M-s’     (‘git-commit-save-message’)
   5349 
   5350      Save the current buffer content to the commit message ring.
   5351 
   5352 ‘M-p’     (‘git-commit-prev-message’)
   5353 
   5354      Cycle backward through the commit message ring, after saving the
   5355      current message to the ring.  With a numeric prefix ARG, go back
   5356      ARG comments.
   5357 
   5358 ‘M-n’     (‘git-commit-next-message’)
   5359 
   5360      Cycle forward through the commit message ring, after saving the
   5361      current message to the ring.  With a numeric prefix ARG, go back
   5362      ARG comments.
   5363 
   5364    By default the diff for the changes that are about to be committed
   5365 are automatically shown when invoking the commit.  To prevent that,
   5366 remove ‘magit-commit-diff’ from ‘server-switch-hook’.
   5367 
   5368    When amending to an existing commit it may be useful to show either
   5369 the changes that are about to be added to that commit or to show those
   5370 changes alongside those that have already been committed.
   5371 
   5372 ‘C-c C-d’     (‘magit-diff-while-committing’)
   5373 
   5374      While committing, show the changes that are about to be committed.
   5375      While amending, invoking the command again toggles between showing
   5376      just the new changes or all the changes that will be committed.
   5377 
   5378 * Menu:
   5379 
   5380 * Using the Revision Stack::
   5381 * Commit Pseudo Headers::
   5382 * Commit Mode and Hooks::
   5383 * Commit Message Conventions::
   5384 
   5385 
   5386 File: magit.info,  Node: Using the Revision Stack,  Next: Commit Pseudo Headers,  Up: Editing Commit Messages
   5387 
   5388 Using the Revision Stack
   5389 ........................
   5390 
   5391 ‘C-c C-w’     (‘magit-pop-revision-stack’)
   5392 
   5393      This command inserts a representation of a revision into the
   5394      current buffer.  It can be used inside buffers used to write commit
   5395      messages but also in other buffers such as buffers used to edit
   5396      emails or ChangeLog files.
   5397 
   5398      By default this command pops the revision which was last added to
   5399      the ‘magit-revision-stack’ and inserts it into the current buffer
   5400      according to ‘magit-pop-revision-stack-format’.  Revisions can be
   5401      put on the stack using ‘magit-copy-section-value’ and
   5402      ‘magit-copy-buffer-revision’.
   5403 
   5404      If the stack is empty or with a prefix argument it instead reads a
   5405      revision in the minibuffer.  By using the minibuffer history this
   5406      allows selecting an item which was popped earlier or to insert an
   5407      arbitrary reference or revision without first pushing it onto the
   5408      stack.
   5409 
   5410      When reading the revision from the minibuffer, then it might not be
   5411      possible to guess the correct repository.  When this command is
   5412      called inside a repository (e.g.  while composing a commit
   5413      message), then that repository is used.  Otherwise (e.g.  while
   5414      composing an email) then the repository recorded for the top
   5415      element of the stack is used (even though we insert another
   5416      revision).  If not called inside a repository and with an empty
   5417      stack, or with two prefix arguments, then read the repository in
   5418      the minibuffer too.
   5419 
   5420  -- User Option: magit-pop-revision-stack-format
   5421 
   5422      This option controls how the command ‘magit-pop-revision-stack’
   5423      inserts a revision into the current buffer.
   5424 
   5425      The entries on the stack have the format ‘(HASH TOPLEVEL)’ and this
   5426      option has the format ‘(POINT-FORMAT EOB-FORMAT INDEX-REGEXP)’, all
   5427      of which may be nil or a string (though either one of EOB-FORMAT or
   5428      POINT-FORMAT should be a string, and if INDEX-REGEXP is non-nil,
   5429      then the two formats should be too).
   5430 
   5431      First INDEX-REGEXP is used to find the previously inserted entry,
   5432      by searching backward from point.  The first submatch must match
   5433      the index number.  That number is incremented by one, and becomes
   5434      the index number of the entry to be inserted.  If you don’t want to
   5435      number the inserted revisions, then use nil for INDEX-REGEXP.
   5436 
   5437      If INDEX-REGEXP is non-nil then both POINT-FORMAT and EOB-FORMAT
   5438      should contain \"%N\", which is replaced with the number that was
   5439      determined in the previous step.
   5440 
   5441      Both formats, if non-nil and after removing %N, are then expanded
   5442      using ‘git show --format=FORMAT ...’ inside TOPLEVEL.
   5443 
   5444      The expansion of POINT-FORMAT is inserted at point, and the
   5445      expansion of EOB-FORMAT is inserted at the end of the buffer (if
   5446      the buffer ends with a comment, then it is inserted right before
   5447      that).
   5448 
   5449 
   5450 File: magit.info,  Node: Commit Pseudo Headers,  Next: Commit Mode and Hooks,  Prev: Using the Revision Stack,  Up: Editing Commit Messages
   5451 
   5452 Commit Pseudo Headers
   5453 .....................
   5454 
   5455 Some projects use pseudo headers in commit messages.  Magit colorizes
   5456 such headers and provides some commands to insert such headers.
   5457 
   5458  -- User Option: git-commit-known-pseudo-headers
   5459 
   5460      A list of Git pseudo headers to be highlighted.
   5461 
   5462 ‘C-c C-i’     (‘git-commit-insert-pseudo-header’)
   5463 
   5464      Insert a commit message pseudo header.
   5465 
   5466 ‘C-c C-a’     (‘git-commit-ack’)
   5467 
   5468      Insert a header acknowledging that you have looked at the commit.
   5469 
   5470 ‘C-c C-r’     (‘git-commit-review’)
   5471 
   5472      Insert a header acknowledging that you have reviewed the commit.
   5473 
   5474 ‘C-c C-s’     (‘git-commit-signoff’)
   5475 
   5476      Insert a header to sign off the commit.
   5477 
   5478 ‘C-c C-t’     (‘git-commit-test’)
   5479 
   5480      Insert a header acknowledging that you have tested the commit.
   5481 
   5482 ‘C-c C-o’     (‘git-commit-cc’)
   5483 
   5484      Insert a header mentioning someone who might be interested.
   5485 
   5486 ‘C-c C-p’     (‘git-commit-reported’)
   5487 
   5488      Insert a header mentioning the person who reported the issue being
   5489      fixed by the commit.
   5490 
   5491 ‘C-c M-i’     (‘git-commit-suggested’)
   5492 
   5493      Insert a header mentioning the person who suggested the change.
   5494 
   5495 
   5496 File: magit.info,  Node: Commit Mode and Hooks,  Next: Commit Message Conventions,  Prev: Commit Pseudo Headers,  Up: Editing Commit Messages
   5497 
   5498 Commit Mode and Hooks
   5499 .....................
   5500 
   5501 ‘git-commit-mode’ is a minor mode that is only used to establish certain
   5502 key bindings.  This makes it possible to use an arbitrary major mode in
   5503 buffers used to edit commit messages.  It is even possible to use
   5504 different major modes in different repositories, which is useful when
   5505 different projects impose different commit message conventions.
   5506 
   5507  -- User Option: git-commit-major-mode
   5508 
   5509      The value of this option is the major mode used to edit Git commit
   5510      messages.
   5511 
   5512    Because ‘git-commit-mode’ is a minor mode, we don’t use its mode hook
   5513 to setup the buffer, except for the key bindings.  All other setup
   5514 happens in the function ‘git-commit-setup’, which among other things
   5515 runs the hook ‘git-commit-setup-hook’.
   5516 
   5517  -- User Option: git-commit-setup-hook
   5518 
   5519      Hook run at the end of ‘git-commit-setup’.
   5520 
   5521 The following functions are suitable for this hook:
   5522 
   5523  -- Function: git-commit-save-message
   5524 
   5525      Save the current buffer content to the commit message ring.
   5526 
   5527  -- Function: git-commit-setup-changelog-support
   5528 
   5529      After this function is called, ChangeLog entries are treated as
   5530      paragraphs.
   5531 
   5532  -- Function: git-commit-turn-on-auto-fill
   5533 
   5534      Turn on ‘auto-fill-mode’ and set ‘fill-column’ to the value of
   5535      ‘git-commit-fill-column’.
   5536 
   5537  -- Function: git-commit-turn-on-flyspell
   5538 
   5539      Turn on Flyspell mode.  Also prevent comments from being checked
   5540      and finally check current non-comment text.
   5541 
   5542  -- Function: git-commit-propertize-diff
   5543 
   5544      Propertize the diff shown inside the commit message buffer.  Git
   5545      inserts such diffs into the commit message template when the
   5546      ‘--verbose’ argument is used.  ‘magit-commit’ by default does not
   5547      offer that argument because the diff that is shown in a separate
   5548      buffer is more useful.  But some users disagree, which is why this
   5549      function exists.
   5550 
   5551  -- Function: bug-reference-mode
   5552 
   5553      Hyperlink bug references in the buffer.
   5554 
   5555  -- Function: with-editor-usage-message
   5556 
   5557      Show usage information in the echo area.
   5558 
   5559  -- User Option: git-commit-setup-hook
   5560 
   5561      Hook run after the user finished writing a commit message.
   5562 
   5563      This hook is only run after pressing ‘C-c C-c’ in a buffer used to
   5564      edit a commit message.  If a commit is created without the user
   5565      typing a message into a buffer, then this hook is not run.
   5566 
   5567      This hook is not run until the new commit has been created.  If
   5568      doing so takes Git longer than one second, then this hook isn’t run
   5569      at all.  For certain commands such as ‘magit-rebase-continue’ this
   5570      hook is never run because doing so would lead to a race condition.
   5571 
   5572      This hook is only run if ‘magit’ is available.
   5573 
   5574      Also see ‘magit-post-commit-hook’.
   5575 
   5576 
   5577 File: magit.info,  Node: Commit Message Conventions,  Prev: Commit Mode and Hooks,  Up: Editing Commit Messages
   5578 
   5579 Commit Message Conventions
   5580 ..........................
   5581 
   5582 Git-Commit highlights certain violations of commonly accepted commit
   5583 message conventions.  Certain violations even cause Git-Commit to ask
   5584 you to confirm that you really want to do that.  This nagging can of
   5585 course be turned off, but the result of doing that usually is that
   5586 instead of some code it’s now the human who is reviewing your commits
   5587 who has to waste some time telling you to fix your commits.
   5588 
   5589  -- User Option: git-commit-summary-max-length
   5590 
   5591      The intended maximal length of the summary line of commit messages.
   5592      Characters beyond this column are colorized to indicate that this
   5593      preference has been violated.
   5594 
   5595  -- User Option: git-commit-fill-column
   5596 
   5597      Column beyond which automatic line-wrapping should happen in commit
   5598      message buffers.
   5599 
   5600  -- User Option: git-commit-finish-query-functions
   5601 
   5602      List of functions called to query before performing commit.
   5603 
   5604      The commit message buffer is current while the functions are
   5605      called.  If any of them returns nil, then the commit is not
   5606      performed and the buffer is not killed.  The user should then fix
   5607      the issue and try again.
   5608 
   5609      The functions are called with one argument.  If it is non-nil then
   5610      that indicates that the user used a prefix argument to force
   5611      finishing the session despite issues.  Functions should usually
   5612      honor this wish and return non-nil.
   5613 
   5614      By default the only member is ‘git-commit-check-style-conventions’.
   5615 
   5616  -- Function: git-commit-check-style-conventions
   5617 
   5618      This function checks for violations of certain basic style
   5619      conventions.  For each violation it asks users if they want to
   5620      proceed anyway.
   5621 
   5622  -- User Option: git-commit-style-convention-checks
   5623 
   5624      This option controls what conventions the function by the same name
   5625      tries to enforce.  The value is a list of self-explanatory symbols
   5626      identifying certain conventions; ‘non-empty-second-line’ and
   5627      ‘overlong-summary-line’.
   5628 
   5629 
   5630 File: magit.info,  Node: Branching,  Next: Merging,  Prev: Committing,  Up: Manipulating
   5631 
   5632 6.6 Branching
   5633 =============
   5634 
   5635 * Menu:
   5636 
   5637 * The Two Remotes::
   5638 * Branch Commands::
   5639 * Branch Git Variables::
   5640 * Auxiliary Branch Commands::
   5641 
   5642 
   5643 File: magit.info,  Node: The Two Remotes,  Next: Branch Commands,  Up: Branching
   5644 
   5645 6.6.1 The Two Remotes
   5646 ---------------------
   5647 
   5648 The upstream branch of some local branch is the branch into which the
   5649 commits on that local branch should eventually be merged, usually
   5650 something like ‘origin/master’.  For the ‘master’ branch itself the
   5651 upstream branch and the branch it is being pushed to, are usually the
   5652 same remote branch.  But for a feature branch the upstream branch and
   5653 the branch it is being pushed to should differ.
   5654 
   5655    The commits on feature branches too should _eventually_ end up in a
   5656 remote branch such as ‘origin/master’ or ‘origin/maint’.  Such a branch
   5657 should therefore be used as the upstream.  But feature branches
   5658 shouldn’t be pushed directly to such branches.  Instead a feature branch
   5659 ‘my-feature’ is usually pushed to ‘my-fork/my-feature’ or if you are a
   5660 contributor ‘origin/my-feature’.  After the new feature has been
   5661 reviewed, the maintainer merges the feature into ‘master’.  And finally
   5662 ‘master’ (not ‘my-feature’ itself) is pushed to ‘origin/master’.
   5663 
   5664    But new features seldom are perfect on the first try, and so feature
   5665 branches usually have to be reviewed, improved, and re-pushed several
   5666 times.  Pushing should therefore be easy to do, and for that reason many
   5667 Git users have concluded that it is best to use the remote branch to
   5668 which the local feature branch is being pushed as its upstream.
   5669 
   5670    But luckily Git has long ago gained support for a push-remote which
   5671 can be configured separately from the upstream branch, using the
   5672 variables ‘branch.<name>.pushRemote’ and ‘remote.pushDefault’.  So we no
   5673 longer have to choose which of the two remotes should be used as "the
   5674 remote".
   5675 
   5676    Each of the fetching, pulling, and pushing transient commands
   5677 features three suffix commands that act on the current branch and some
   5678 other branch.  Of these, ‘p’ is bound to a command which acts on the
   5679 push-remote, ‘u’ is bound to a command which acts on the upstream, and
   5680 ‘e’ is bound to a command which acts on any other branch.  The status
   5681 buffer shows unpushed and unpulled commits for both the push-remote and
   5682 the upstream.
   5683 
   5684    It’s fairly simple to configure these two remotes.  The values of all
   5685 the variables that are related to fetching, pulling, and pushing (as
   5686 well as some other branch-related variables) can be inspected and
   5687 changed using the command ‘magit-branch-configure’, which is available
   5688 from many transient prefix commands that deal with branches.  It is also
   5689 possible to set the push-remote or upstream while pushing (see *note
   5690 Pushing::).
   5691 
   5692 
   5693 File: magit.info,  Node: Branch Commands,  Next: Branch Git Variables,  Prev: The Two Remotes,  Up: Branching
   5694 
   5695 6.6.2 Branch Commands
   5696 ---------------------
   5697 
   5698 The transient prefix command ‘magit-branch’ is used to create and
   5699 checkout branches, and to make changes to existing branches.  It is not
   5700 used to fetch, pull, merge, rebase, or push branches, i.e.  this command
   5701 deals with branches themselves, not with the commits reachable from
   5702 them.  Those features are available from separate transient command.
   5703 
   5704 ‘b’     (‘magit-branch’)
   5705 
   5706      This transient prefix command binds the following suffix commands
   5707      and displays them in a temporary buffer until a suffix is invoked.
   5708 
   5709      By default it also binds and displays the values of some
   5710      branch-related Git variables and allows changing their values.
   5711 
   5712  -- User Option: magit-branch-direct-configure
   5713 
   5714      This option controls whether the transient command ‘magit-branch’
   5715      can be used to directly change the values of Git variables.  This
   5716      defaults to ‘t’ (to avoid changing key bindings).  When set to
   5717      ‘nil’, then no variables are displayed by that transient command,
   5718      and its suffix command ‘magit-branch-configure’ has to be used
   5719      instead to view and change branch related variables.
   5720 
   5721 ‘b C’     (‘magit-branch-configure’)
   5722 ‘f C’     (‘magit-branch-configure’)
   5723 ‘F C’     (‘magit-branch-configure’)
   5724 ‘P C’     (‘magit-branch-configure’)
   5725 
   5726      This transient prefix command binds commands that set the value of
   5727      branch-related variables and displays them in a temporary buffer
   5728      until the transient is exited.
   5729 
   5730      With a prefix argument, this command always prompts for a branch.
   5731 
   5732      Without a prefix argument this depends on whether it was invoked as
   5733      a suffix of ‘magit-branch’ and on the
   5734      ‘magit-branch-direct-configure’ option.  If ‘magit-branch’ already
   5735      displays the variables for the current branch, then it isn’t useful
   5736      to invoke another transient that displays them for the same branch.
   5737      In that case this command prompts for a branch.
   5738 
   5739    The variables are described in *note Branch Git Variables::.
   5740 
   5741 ‘b b’     (‘magit-checkout’)
   5742 
   5743      Checkout a revision read in the minibuffer and defaulting to the
   5744      branch or arbitrary revision at point.  If the revision is a local
   5745      branch then that becomes the current branch.  If it is something
   5746      else then ‘HEAD’ becomes detached.  Checkout fails if the working
   5747      tree or the staging area contain changes.
   5748 
   5749 ‘b n’     (‘magit-branch-create’)
   5750 
   5751      Create a new branch.  The user is asked for a branch or arbitrary
   5752      revision to use as the starting point of the new branch.  When a
   5753      branch name is provided, then that becomes the upstream branch of
   5754      the new branch.  The name of the new branch is also read in the
   5755      minibuffer.
   5756 
   5757      Also see option ‘magit-branch-prefer-remote-upstream’.
   5758 
   5759 ‘b c’     (‘magit-branch-and-checkout’)
   5760 
   5761      This command creates a new branch like ‘magit-branch-create’, but
   5762      then also checks it out.
   5763 
   5764      Also see option ‘magit-branch-prefer-remote-upstream’.
   5765 
   5766 ‘b l’     (‘magit-branch-checkout’)
   5767 
   5768      This command checks out an existing or new local branch.  It reads
   5769      a branch name from the user offering all local branches and a
   5770      subset of remote branches as candidates.  Remote branches for which
   5771      a local branch by the same name exists are omitted from the list of
   5772      candidates.  The user can also enter a completely new branch name.
   5773 
   5774         • If the user selects an existing local branch, then that is
   5775           checked out.
   5776 
   5777         • If the user selects a remote branch, then it creates and
   5778           checks out a new local branch with the same name, and
   5779           configures the selected remote branch as the push target.
   5780 
   5781         • If the user enters a new branch name, then it creates and
   5782           checks that out, after also reading the starting-point from
   5783           the user.
   5784 
   5785      In the latter two cases the upstream is also set.  Whether it is
   5786      set to the chosen starting point or something else depends on the
   5787      value of ‘magit-branch-adjust-remote-upstream-alist’.
   5788 
   5789 ‘b s’     (‘magit-branch-spinoff’)
   5790 
   5791      This command creates and checks out a new branch starting at and
   5792      tracking the current branch.  That branch in turn is reset to the
   5793      last commit it shares with its upstream.  If the current branch has
   5794      no upstream or no unpushed commits, then the new branch is created
   5795      anyway and the previously current branch is not touched.
   5796 
   5797      This is useful to create a feature branch after work has already
   5798      began on the old branch (likely but not necessarily "master").
   5799 
   5800      If the current branch is a member of the value of option
   5801      ‘magit-branch-prefer-remote-upstream’ (which see), then the current
   5802      branch will be used as the starting point as usual, but the
   5803      upstream of the starting-point may be used as the upstream of the
   5804      new branch, instead of the starting-point itself.
   5805 
   5806      If optional FROM is non-nil, then the source branch is reset to
   5807      ‘FROM~’, instead of to the last commit it shares with its upstream.
   5808      Interactively, FROM is only ever non-nil, if the region selects
   5809      some commits, and among those commits, FROM is the commit that is
   5810      the fewest commits ahead of the source branch.
   5811 
   5812      The commit at the other end of the selection actually does not
   5813      matter, all commits between FROM and ‘HEAD’ are moved to the new
   5814      branch.  If FROM is not reachable from ‘HEAD’ or is reachable from
   5815      the source branch’s upstream, then an error is raised.
   5816 
   5817 ‘b S’     (‘magit-branch-spinout’)
   5818 
   5819      This command behaves like ‘magit-branch-spinoff’, except that it
   5820      does not change the current branch.  If there are any uncommitted
   5821      changes, then it behaves exactly like ‘magit-branch-spinoff’.
   5822 
   5823 ‘b x’     (‘magit-branch-reset’)
   5824 
   5825      This command resets a branch, defaulting to the branch at point, to
   5826      the tip of another branch or any other commit.
   5827 
   5828      When the branch being reset is the current branch, then a hard
   5829      reset is performed.  If there are any uncommitted changes, then the
   5830      user has to confirm the reset because those changes would be lost.
   5831 
   5832      This is useful when you have started work on a feature branch but
   5833      realize it’s all crap and want to start over.
   5834 
   5835      When resetting to another branch and a prefix argument is used,
   5836      then the target branch is set as the upstream of the branch that is
   5837      being reset.
   5838 
   5839 ‘b k’     (‘magit-branch-delete’)
   5840 
   5841      Delete one or multiple branches.  If the region marks multiple
   5842      branches, then offer to delete those.  Otherwise, prompt for a
   5843      single branch to be deleted, defaulting to the branch at point.
   5844 
   5845 ‘b r’     (‘magit-branch-rename’)
   5846 
   5847      Rename a branch.  The branch and the new name are read in the
   5848      minibuffer.  With prefix argument the branch is renamed even if
   5849      that name conflicts with an existing branch.
   5850 
   5851  -- User Option: magit-branch-read-upstream-first
   5852 
   5853      When creating a branch, whether to read the upstream branch before
   5854      the name of the branch that is to be created.  The default is ‘t’,
   5855      and I recommend you leave it at that.
   5856 
   5857  -- User Option: magit-branch-prefer-remote-upstream
   5858 
   5859      This option specifies whether remote upstreams are favored over
   5860      local upstreams when creating new branches.
   5861 
   5862      When a new branch is created, then the branch, commit, or stash at
   5863      point is suggested as the starting point of the new branch, or if
   5864      there is no such revision at point the current branch.  In either
   5865      case the user may choose another starting point.
   5866 
   5867      If the chosen starting point is a branch, then it may also be set
   5868      as the upstream of the new branch, depending on the value of the
   5869      Git variable ‘branch.autoSetupMerge’.  By default this is done for
   5870      remote branches, but not for local branches.
   5871 
   5872      You might prefer to always use some remote branch as upstream.  If
   5873      the chosen starting point is (1) a local branch, (2) whose name
   5874      matches a member of the value of this option, (3) the upstream of
   5875      that local branch is a remote branch with the same name, and (4)
   5876      that remote branch can be fast-forwarded to the local branch, then
   5877      the chosen branch is used as starting point, but its own upstream
   5878      is used as the upstream of the new branch.
   5879 
   5880      Members of this option’s value are treated as branch names that
   5881      have to match exactly unless they contain a character that makes
   5882      them invalid as a branch name.  Recommended characters to use to
   5883      trigger interpretation as a regexp are "*" and "^".  Some other
   5884      characters which you might expect to be invalid, actually are not,
   5885      e.g.  ".+$" are all perfectly valid.  More precisely, if ‘git
   5886      check-ref-format --branch STRING’ exits with a non-zero status,
   5887      then treat STRING as a regexp.
   5888 
   5889      Assuming the chosen branch matches these conditions you would end
   5890      up with with e.g.:
   5891 
   5892           feature --upstream--> origin/master
   5893 
   5894      instead of
   5895 
   5896           feature --upstream--> master --upstream--> origin/master
   5897 
   5898      Which you prefer is a matter of personal preference.  If you do
   5899      prefer the former, then you should add branches such as ‘master’,
   5900      ‘next’, and ‘maint’ to the value of this options.
   5901 
   5902  -- User Option: magit-branch-adjust-remote-upstream-alist
   5903 
   5904      The value of this option is an alist of branches to be used as the
   5905      upstream when branching a remote branch.
   5906 
   5907      When creating a local branch from an ephemeral branch located on a
   5908      remote, e.g.  a feature or hotfix branch, then that remote branch
   5909      should usually not be used as the upstream branch, since the
   5910      push-remote already allows accessing it and having both the
   5911      upstream and the push-remote reference the same related branch
   5912      would be wasteful.  Instead a branch like "maint" or "master"
   5913      should be used as the upstream.
   5914 
   5915      This option allows specifying the branch that should be used as the
   5916      upstream when branching certain remote branches.  The value is an
   5917      alist of the form ‘((UPSTREAM . RULE)...)’.  The first matching
   5918      element is used, the following elements are ignored.
   5919 
   5920      UPSTREAM is the branch to be used as the upstream for branches
   5921      specified by RULE.  It can be a local or a remote branch.
   5922 
   5923      RULE can either be a regular expression, matching branches whose
   5924      upstream should be the one specified by UPSTREAM.  Or it can be a
   5925      list of the only branches that should *not* use UPSTREAM; all other
   5926      branches will.  Matching is done after stripping the remote part of
   5927      the name of the branch that is being branched from.
   5928 
   5929      If you use a finite set of non-ephemeral branches across all your
   5930      repositories, then you might use something like:
   5931 
   5932           (("origin/master" . ("master" "next" "maint")))
   5933 
   5934      Or if the names of all your ephemeral branches contain a slash, at
   5935      least in some repositories, then a good value could be:
   5936 
   5937           (("origin/master" . "/"))
   5938 
   5939      Of course you can also fine-tune:
   5940 
   5941           (("origin/maint" . "\\`hotfix/")
   5942            ("origin/master" . "\\`feature/"))
   5943 
   5944      UPSTREAM can be a local branch:
   5945 
   5946           (("master" . ("master" "next" "maint")))
   5947 
   5948    Because the main branch is no longer almost always named "master" you
   5949 should also account for other common names:
   5950 
   5951      (("main"  . ("main" "master" "next" "maint"))
   5952       ("master" . ("main" "master" "next" "maint")))
   5953 
   5954  -- Command: magit-branch-orphan
   5955 
   5956      This command creates and checks out a new orphan branch with
   5957      contents from a given revision.
   5958 
   5959  -- Command: magit-branch-or-checkout
   5960 
   5961      This command is a hybrid between ‘magit-checkout’ and
   5962      ‘magit-branch-and-checkout’ and is intended as a replacement for
   5963      the former in ‘magit-branch’.
   5964 
   5965      It first asks the user for an existing branch or revision.  If the
   5966      user input actually can be resolved as a branch or revision, then
   5967      it checks that out, just like ‘magit-checkout’ would.
   5968 
   5969      Otherwise it creates and checks out a new branch using the input as
   5970      its name.  Before doing so it reads the starting-point for the new
   5971      branch.  This is similar to what ‘magit-branch-and-checkout’ does.
   5972 
   5973      To use this command instead of ‘magit-checkout’ add this to your
   5974      init file:
   5975 
   5976           (transient-replace-suffix 'magit-branch 'magit-checkout
   5977             '("b" "dwim" magit-branch-or-checkout))
   5978 
   5979 
   5980 File: magit.info,  Node: Branch Git Variables,  Next: Auxiliary Branch Commands,  Prev: Branch Commands,  Up: Branching
   5981 
   5982 6.6.3 Branch Git Variables
   5983 --------------------------
   5984 
   5985 These variables can be set from the transient prefix command
   5986 ‘magit-branch-configure’.  By default they can also be set from
   5987 ‘magit-branch’.  See *note Branch Commands::.
   5988 
   5989  -- Variable: branch.NAME.merge
   5990 
   5991      Together with ‘branch.NAME.remote’ this variable defines the
   5992      upstream branch of the local branch named NAME.  The value of this
   5993      variable is the full reference of the upstream _branch_.
   5994 
   5995  -- Variable: branch.NAME.remote
   5996 
   5997      Together with ‘branch.NAME.merge’ this variable defines the
   5998      upstream branch of the local branch named NAME.  The value of this
   5999      variable is the name of the upstream _remote_.
   6000 
   6001  -- Variable: branch.NAME.rebase
   6002 
   6003      This variable controls whether pulling into the branch named NAME
   6004      is done by rebasing or by merging the fetched branch.
   6005 
   6006         • When ‘true’ then pulling is done by rebasing.
   6007 
   6008         • When ‘false’ then pulling is done by merging.
   6009 
   6010         • When undefined then the value of ‘pull.rebase’ is used.  The
   6011           default of that variable is ‘false’.
   6012 
   6013  -- Variable: branch.NAME.pushRemote
   6014 
   6015      This variable specifies the remote that the branch named NAME is
   6016      usually pushed to.  The value has to be the name of an existing
   6017      remote.
   6018 
   6019      It is not possible to specify the name of _branch_ to push the
   6020      local branch to.  The name of the remote branch is always the same
   6021      as the name of the local branch.
   6022 
   6023      If this variable is undefined but ‘remote.pushDefault’ is defined,
   6024      then the value of the latter is used.  By default
   6025      ‘remote.pushDefault’ is undefined.
   6026 
   6027  -- Variable: branch.NAME.description
   6028 
   6029      This variable can be used to describe the branch named NAME.  That
   6030      description is used e.g.  when turning the branch into a series of
   6031      patches.
   6032 
   6033    The following variables specify defaults which are used if the above
   6034 branch-specific variables are not set.
   6035 
   6036  -- Variable: pull.rebase
   6037 
   6038      This variable specifies whether pulling is done by rebasing or by
   6039      merging.  It can be overwritten using ‘branch.NAME.rebase’.
   6040 
   6041         • When ‘true’ then pulling is done by rebasing.
   6042 
   6043         • When ‘false’ (the default) then pulling is done by merging.
   6044 
   6045      Since it is never a good idea to merge the upstream branch into a
   6046      feature or hotfix branch and most branches are such branches, you
   6047      should consider setting this to ‘true’, and ‘branch.master.rebase’
   6048      to ‘false’.
   6049 
   6050  -- Variable: remote.pushDefault
   6051 
   6052      This variable specifies what remote the local branches are usually
   6053      pushed to.  This can be overwritten per branch using
   6054      ‘branch.NAME.pushRemote’.
   6055 
   6056    The following variables are used during the creation of a branch and
   6057 control whether the various branch-specific variables are automatically
   6058 set at this time.
   6059 
   6060  -- Variable: branch.autoSetupMerge
   6061 
   6062      This variable specifies under what circumstances creating a branch
   6063      NAME should result in the variables ‘branch.NAME.merge’ and
   6064      ‘branch.NAME.remote’ being set according to the starting point used
   6065      to create the branch.  If the starting point isn’t a branch, then
   6066      these variables are never set.
   6067 
   6068         • When ‘always’ then the variables are set regardless of whether
   6069           the starting point is a local or a remote branch.
   6070 
   6071         • When ‘true’ (the default) then the variables are set when the
   6072           starting point is a remote branch, but not when it is a local
   6073           branch.
   6074 
   6075         • When ‘false’ then the variables are never set.
   6076 
   6077  -- Variable: branch.autoSetupRebase
   6078 
   6079      This variable specifies whether creating a branch NAME should
   6080      result in the variable ‘branch.NAME.rebase’ being set to ‘true’.
   6081 
   6082         • When ‘always’ then the variable is set regardless of whether
   6083           the starting point is a local or a remote branch.
   6084 
   6085         • When ‘local’ then the variable are set when the starting point
   6086           is a local branch, but not when it is a remote branch.
   6087 
   6088         • When ‘remote’ then the variable are set when the starting
   6089           point is a remote branch, but not when it is a local branch.
   6090 
   6091         • When ‘never’ (the default) then the variable is never set.
   6092 
   6093    Note that the respective commands always change the repository-local
   6094 values.  If you want to change the global value, which is used when the
   6095 local value is undefined, then you have to do so on the command line,
   6096 e.g.:
   6097 
   6098      git config --global remote.autoSetupMerge always
   6099 
   6100    For more information about these variables you should also see
   6101 
   6102    *note (gitman)git-config::.  Also see *note (gitman)git-branch::.  ,
   6103 *note (gitman)git-checkout::.  and *note Pushing::.
   6104 
   6105  -- User Option: magit-prefer-remote-upstream
   6106 
   6107      This option controls whether commands that read a branch from the
   6108      user and then set it as the upstream branch, offer a local or a
   6109      remote branch as default completion candidate, when they have the
   6110      choice.
   6111 
   6112      This affects all commands that use ‘magit-read-upstream-branch’ or
   6113      ‘magit-read-starting-point’, which includes all commands that
   6114      change the upstream and many which create new branches.
   6115 
   6116 
   6117 File: magit.info,  Node: Auxiliary Branch Commands,  Prev: Branch Git Variables,  Up: Branching
   6118 
   6119 6.6.4 Auxiliary Branch Commands
   6120 -------------------------------
   6121 
   6122 These commands are not available from the transient ‘magit-branch’ by
   6123 default.
   6124 
   6125  -- Command: magit-branch-shelve
   6126 
   6127      This command shelves a branch.  This is done by deleting the
   6128      branch, and creating a new reference "refs/shelved/BRANCH-NAME"
   6129      pointing at the same commit as the branch pointed at.  If the
   6130      deleted branch had a reflog, then that is preserved as the reflog
   6131      of the new reference.
   6132 
   6133      This is useful if you want to move a branch out of sight, but are
   6134      not ready to completely discard it yet.
   6135 
   6136  -- Command: magit-branch-unshelve
   6137 
   6138      This command unshelves a branch that was previously shelved using
   6139      ‘magit-branch-shelve’.  This is done by deleting the reference
   6140      "refs/shelved/BRANCH-NAME" and creating a branch "BRANCH-NAME"
   6141      pointing at the same commit as the deleted reference pointed at.
   6142      If the deleted reference had a reflog, then that is restored as the
   6143      reflog of the branch.
   6144 
   6145 
   6146 File: magit.info,  Node: Merging,  Next: Resolving Conflicts,  Prev: Branching,  Up: Manipulating
   6147 
   6148 6.7 Merging
   6149 ===========
   6150 
   6151 Also see *note (gitman)git-merge::.  For information on how to resolve
   6152 merge conflicts see the next section.
   6153 
   6154 ‘m’     (‘magit-merge’)
   6155 
   6156      This transient prefix command binds the following suffix commands
   6157      along with the appropriate infix arguments and displays them in a
   6158      temporary buffer until a suffix is invoked.
   6159 
   6160    When no merge is in progress, then the transient features the
   6161 following suffix commands.
   6162 
   6163 ‘m m’     (‘magit-merge-plain’)
   6164 
   6165      This command merges another branch or an arbitrary revision into
   6166      the current branch.  The branch or revision to be merged is read in
   6167      the minibuffer and defaults to the branch at point.
   6168 
   6169      Unless there are conflicts or a prefix argument is used, then the
   6170      resulting merge commit uses a generic commit message, and the user
   6171      does not get a chance to inspect or change it before the commit is
   6172      created.  With a prefix argument this does not actually create the
   6173      merge commit, which makes it possible to inspect how conflicts were
   6174      resolved and to adjust the commit message.
   6175 
   6176 ‘m e’     (‘magit-merge-editmsg’)
   6177 
   6178      This command merges another branch or an arbitrary revision into
   6179      the current branch and opens a commit message buffer, so that the
   6180      user can make adjustments.  The commit is not actually created
   6181      until the user finishes with ‘C-c C-c’.
   6182 
   6183 ‘m n’     (‘magit-merge-nocommit’)
   6184 
   6185      This command merges another branch or an arbitrary revision into
   6186      the current branch, but does not actually create the merge commit.
   6187      The user can then further adjust the merge, even when automatic
   6188      conflict resolution succeeded and/or adjust the commit message.
   6189 
   6190 ‘m a’     (‘magit-merge-absorb’)
   6191 
   6192      This command merges another local branch into the current branch
   6193      and then removes the former.
   6194 
   6195      Before the source branch is merged, it is first force pushed to its
   6196      push-remote, provided the respective remote branch already exists.
   6197      This ensures that the respective pull-request (if any) won’t get
   6198      stuck on some obsolete version of the commits that are being
   6199      merged.  Finally, if ‘magit-branch-pull-request’ was used to create
   6200      the merged branch, then the respective remote branch is also
   6201      removed.
   6202 
   6203 ‘m i’     (‘magit-merge-into’)
   6204 
   6205      This command merges the current branch into another local branch
   6206      and then removes the former.  The latter becomes the new current
   6207      branch.
   6208 
   6209      Before the source branch is merged, it is first force pushed to its
   6210      push-remote, provided the respective remote branch already exists.
   6211      This ensures that the respective pull-request (if any) won’t get
   6212      stuck on some obsolete version of the commits that are being
   6213      merged.  Finally, if ‘magit-branch-pull-request’ was used to create
   6214      the merged branch, then the respective remote branch is also
   6215      removed.
   6216 
   6217 ‘m s’     (‘magit-merge-squash’)
   6218 
   6219      This command squashes the changes introduced by another branch or
   6220      an arbitrary revision into the current branch.  This only applies
   6221      the changes made by the squashed commits.  No information is
   6222      preserved that would allow creating an actual merge commit.
   6223      Instead of this command you should probably use a command from the
   6224      apply transient.
   6225 
   6226 ‘m p’     (‘magit-merge-preview’)
   6227 
   6228      This command shows a preview of merging another branch or an
   6229      arbitrary revision into the current branch.
   6230 
   6231    When a merge is in progress, then the transient instead features the
   6232 following suffix commands.
   6233 
   6234 ‘m m’     (‘magit-merge’)
   6235 
   6236      After the user resolved conflicts, this command proceeds with the
   6237      merge.  If some conflicts weren’t resolved, then this command
   6238      fails.
   6239 
   6240 ‘m a’     (‘magit-merge-abort’)
   6241 
   6242      This command aborts the current merge operation.
   6243 
   6244 
   6245 File: magit.info,  Node: Resolving Conflicts,  Next: Rebasing,  Prev: Merging,  Up: Manipulating
   6246 
   6247 6.8 Resolving Conflicts
   6248 =======================
   6249 
   6250 When merging branches (or otherwise combining or changing history)
   6251 conflicts can occur.  If you edited two completely different parts of
   6252 the same file in two branches and then merge one of these branches into
   6253 the other, then Git can resolve that on its own, but if you edit the
   6254 same area of a file, then a human is required to decide how the two
   6255 versions, or "sides of the conflict", are to be combined into one.
   6256 
   6257    Here we can only provide a brief introduction to the subject and
   6258 point you toward some tools that can help.  If you are new to this, then
   6259 please also consult Git’s own documentation as well as other resources.
   6260 
   6261    If a file has conflicts and Git cannot resolve them by itself, then
   6262 it puts both versions into the affected file along with special markers
   6263 whose purpose is to denote the boundaries of the unresolved part of the
   6264 file and between the different versions.  These boundary lines begin
   6265 with the strings consisting of six times the same character, one of ‘<’,
   6266 ‘|’, ‘=’ and ‘>’ and are followed by information about the source of the
   6267 respective versions, e.g.:
   6268 
   6269      <<<<<<< HEAD
   6270      Take the blue pill.
   6271      =======
   6272      Take the red pill.
   6273      >>>>>>> feature
   6274 
   6275    In this case you have chosen to take the red pill on one branch and
   6276 on another you picked the blue pill.  Now that you are merging these two
   6277 diverging branches, Git cannot possibly know which pill you want to
   6278 take.
   6279 
   6280    To resolve that conflict you have to create a version of the affected
   6281 area of the file by keeping only one of the sides, possibly by editing
   6282 it in order to bring in the changes from the other side, remove the
   6283 other versions as well as the markers, and then stage the result.  A
   6284 possible resolution might be:
   6285 
   6286      Take both pills.
   6287 
   6288    Often it is useful to see not only the two sides of the conflict but
   6289 also the "original" version from before the same area of the file was
   6290 modified twice on different branches.  Instruct Git to insert that
   6291 version as well by running this command once:
   6292 
   6293      git config --global merge.conflictStyle diff3
   6294 
   6295    The above conflict might then have looked like this:
   6296 
   6297      <<<<<<< HEAD
   6298      Take the blue pill.
   6299      ||||||| merged common ancestors
   6300      Take either the blue or the red pill, but not both.
   6301      =======
   6302      Take the red pill.
   6303      >>>>>>> feature
   6304 
   6305    If that were the case, then the above conflict resolution would not
   6306 have been correct, which demonstrates why seeing the original version
   6307 alongside the conflicting versions can be useful.
   6308 
   6309    You can perform the conflict resolution completely by hand, but Emacs
   6310 also provides some packages that help in the process: Smerge, Ediff
   6311 (*note (ediff)Top::), and Emerge (*note (emacs)Emerge::).  Magit does
   6312 not provide its own tools for conflict resolution, but it does make
   6313 using Smerge and Ediff more convenient.  (Ediff supersedes Emerge, so
   6314 you probably don’t want to use the latter anyway.)
   6315 
   6316    In the Magit status buffer, files with unresolved conflicts are
   6317 listed in the "Unstaged changes" and/or "Staged changes" sections.  They
   6318 are prefixed with the word "unmerged", which in this context essentially
   6319 is a synonym for "unresolved".
   6320 
   6321    Pressing ‘RET’ while point is on such a file section shows a buffer
   6322 visiting that file, turns on ‘smerge-mode’ in that buffer, and places
   6323 point inside the first area with conflicts.  You should then resolve
   6324 that conflict using regular edit commands and/or Smerge commands.
   6325 
   6326    Unfortunately Smerge does not have a manual, but you can get a list
   6327 of commands and binding ‘C-c ^ C-h’ and press ‘RET’ while point is on a
   6328 command name to read its documentation.
   6329 
   6330    Normally you would edit one version and then tell Smerge to keep only
   6331 that version.  Use ‘C-c ^ m’ (‘smerge-keep-mine’) to keep the ‘HEAD’
   6332 version or ‘C-c ^ o’ (‘smerge-keep-other’) to keep the version that
   6333 follows "|||||||".  Then use ‘C-c ^ n’ to move to the next conflicting
   6334 area in the same file.  Once you are done resolving conflicts, return to
   6335 the Magit status buffer.  The file should now be shown as "modified", no
   6336 longer as "unmerged", because Smerge automatically stages the file when
   6337 you save the buffer after resolving the last conflict.
   6338 
   6339    Magit now wraps the mentioned Smerge commands, allowing you to use
   6340 these key bindings without having to go to the file-visiting buffer.
   6341 Additionally ‘k’ (‘magit-discard’) on a hunk with unresolved conflicts
   6342 asks which side to keep or, if point is on a side, then it keeps it
   6343 without prompting.  Similarly ‘k’ on a unresolved file ask which side to
   6344 keep.
   6345 
   6346    Alternatively you could use Ediff, which uses separate buffers for
   6347 the different versions of the file.  To resolve conflicts in a file
   6348 using Ediff press ‘e’ while point is on such a file in the status
   6349 buffer.
   6350 
   6351    Ediff can be used for other purposes as well.  For more information
   6352 on how to enter Ediff from Magit, see *note Ediffing::.  Explaining how
   6353 to use Ediff is beyond the scope of this manual, instead see *note
   6354 (ediff)Top::.
   6355 
   6356    If you are unsure whether you should Smerge or Ediff, then use the
   6357 former.  It is much easier to understand and use, and except for truly
   6358 complex conflicts, the latter is usually overkill.
   6359 
   6360 
   6361 File: magit.info,  Node: Rebasing,  Next: Cherry Picking,  Prev: Resolving Conflicts,  Up: Manipulating
   6362 
   6363 6.9 Rebasing
   6364 ============
   6365 
   6366 Also see *note (gitman)git-rebase::.  For information on how to resolve
   6367 conflicts that occur during rebases see the preceding section.
   6368 
   6369 ‘r’     (‘magit-rebase’)
   6370 
   6371      This transient prefix command binds the following suffix commands
   6372      along with the appropriate infix arguments and displays them in a
   6373      temporary buffer until a suffix is invoked.
   6374 
   6375    When no rebase is in progress, then the transient features the
   6376 following suffix commands.
   6377 
   6378    Using one of these commands _starts_ a rebase sequence.  Git might
   6379 then stop somewhere along the way, either because you told it to do so,
   6380 or because applying a commit failed due to a conflict.  When that
   6381 happens, then the status buffer shows information about the rebase
   6382 sequence which is in progress in a section similar to a log section.
   6383 See *note Information About In-Progress Rebase::.
   6384 
   6385    For information about the upstream and the push-remote, see *note The
   6386 Two Remotes::.
   6387 
   6388 ‘r p’     (‘magit-rebase-onto-pushremote’)
   6389 
   6390      This command rebases the current branch onto its push-remote.
   6391 
   6392      With a prefix argument or when the push-remote is either not
   6393      configured or unusable, then let the user first configure the
   6394      push-remote.
   6395 
   6396 ‘r u’     (‘magit-rebase-onto-upstream’)
   6397 
   6398      This command rebases the current branch onto its upstream branch.
   6399 
   6400      With a prefix argument or when the upstream is either not
   6401      configured or unusable, then let the user first configure the
   6402      upstream.
   6403 
   6404 ‘r e’     (‘magit-rebase-branch’)
   6405 
   6406      This command rebases the current branch onto a branch read in the
   6407      minibuffer.  All commits that are reachable from head but not from
   6408      the selected branch TARGET are being rebased.
   6409 
   6410 ‘r s’     (‘magit-rebase-subset’)
   6411 
   6412      This command starts a non-interactive rebase sequence to transfer
   6413      commits from START to ‘HEAD’ onto NEWBASE.  START has to be
   6414      selected from a list of recent commits.
   6415 
   6416    By default Magit uses the ‘--autostash’ argument, which causes
   6417 uncommitted changes to be stored in a stash before the rebase begins.
   6418 These changes are restored after the rebase completes and if possible
   6419 the stash is removed.  If the stash does not apply cleanly, then the
   6420 stash is not removed.  In case something goes wrong when resolving the
   6421 conflicts, this allows you to start over.
   6422 
   6423    Even though one of the actions is dedicated to interactive rebases,
   6424 the transient also features the infix argument ‘--interactive’.  This
   6425 can be used to turn one of the other, non-interactive rebase variants
   6426 into an interactive rebase.
   6427 
   6428    For example if you want to clean up a feature branch and at the same
   6429 time rebase it onto ‘master’, then you could use ‘r-iu’.  But we
   6430 recommend that you instead do that in two steps.  First use ‘ri’ to
   6431 cleanup the feature branch, and then in a second step ‘ru’ to rebase it
   6432 onto ‘master’.  That way if things turn out to be more complicated than
   6433 you thought and/or you make a mistake and have to start over, then you
   6434 only have to redo half the work.
   6435 
   6436    Explicitly enabling ‘--interactive’ won’t have an effect on the
   6437 following commands as they always use that argument anyway, even if it
   6438 is not enabled in the transient.
   6439 
   6440 ‘r i’     (‘magit-rebase-interactive’)
   6441 
   6442      This command starts an interactive rebase sequence.
   6443 
   6444 ‘r f’     (‘magit-rebase-autosquash’)
   6445 
   6446      This command combines squash and fixup commits with their intended
   6447      targets.
   6448 
   6449 ‘r m’     (‘magit-rebase-edit-commit’)
   6450 
   6451      This command starts an interactive rebase sequence that lets the
   6452      user edit a single older commit.
   6453 
   6454 ‘r w’     (‘magit-rebase-reword-commit’)
   6455 
   6456      This command starts an interactive rebase sequence that lets the
   6457      user reword a single older commit.
   6458 
   6459 ‘r k’     (‘magit-rebase-remove-commit’)
   6460 
   6461      This command removes a single older commit using rebase.
   6462 
   6463    When a rebase is in progress, then the transient instead features the
   6464 following suffix commands.
   6465 
   6466 ‘r r’     (‘magit-rebase-continue’)
   6467 
   6468      This command restart the current rebasing operation.
   6469 
   6470      In some cases this pops up a commit message buffer for you do edit.
   6471      With a prefix argument the old message is reused as-is.
   6472 
   6473 ‘r s’     (‘magit-rebase-skip’)
   6474 
   6475      This command skips the current commit and restarts the current
   6476      rebase operation.
   6477 
   6478 ‘r e’     (‘magit-rebase-edit’)
   6479 
   6480      This command lets the user edit the todo list of the current rebase
   6481      operation.
   6482 
   6483 ‘r a’     (‘magit-rebase-abort’)
   6484 
   6485      This command aborts the current rebase operation, restoring the
   6486      original branch.
   6487 
   6488 * Menu:
   6489 
   6490 * Editing Rebase Sequences::
   6491 * Information About In-Progress Rebase::
   6492 
   6493 
   6494 File: magit.info,  Node: Editing Rebase Sequences,  Next: Information About In-Progress Rebase,  Up: Rebasing
   6495 
   6496 6.9.1 Editing Rebase Sequences
   6497 ------------------------------
   6498 
   6499 ‘C-c C-c’     (‘with-editor-finish’)
   6500 
   6501      Finish the current editing session by returning with exit code 0.
   6502      Git then uses the rebase instructions it finds in the file.
   6503 
   6504 ‘C-c C-k’     (‘with-editor-cancel’)
   6505 
   6506      Cancel the current editing session by returning with exit code 1.
   6507      Git then forgoes starting the rebase sequence.
   6508 
   6509 ‘RET’     (‘git-rebase-show-commit’)
   6510 
   6511      Show the commit on the current line in another buffer and select
   6512      that buffer.
   6513 
   6514 ‘SPC’     (‘git-rebase-show-or-scroll-up’)
   6515 
   6516      Show the commit on the current line in another buffer without
   6517      selecting that buffer.  If the revision buffer is already visible
   6518      in another window of the current frame, then instead scroll that
   6519      window up.
   6520 
   6521 ‘DEL’     (‘git-rebase-show-or-scroll-down’)
   6522 
   6523      Show the commit on the current line in another buffer without
   6524      selecting that buffer.  If the revision buffer is already visible
   6525      in another window of the current frame, then instead scroll that
   6526      window down.
   6527 
   6528 ‘p’     (‘git-rebase-backward-line’)
   6529 
   6530      Move to previous line.
   6531 
   6532 ‘n’     (‘forward-line’)
   6533 
   6534      Move to next line.
   6535 
   6536 ‘M-p’     (‘git-rebase-move-line-up’)
   6537 
   6538      Move the current commit (or command) up.
   6539 
   6540 ‘M-n’     (‘git-rebase-move-line-down’)
   6541 
   6542      Move the current commit (or command) down.
   6543 
   6544 ‘r’     (‘git-rebase-reword’)
   6545 
   6546      Edit message of commit on current line.
   6547 
   6548 ‘e’     (‘git-rebase-edit’)
   6549 
   6550      Stop at the commit on the current line.
   6551 
   6552 ‘s’     (‘git-rebase-squash’)
   6553 
   6554      Meld commit on current line into previous commit, and edit message.
   6555 
   6556 ‘f’     (‘git-rebase-fixup’)
   6557 
   6558      Meld commit on current line into previous commit, discarding the
   6559      current commit’s message.
   6560 
   6561 ‘k’     (‘git-rebase-kill-line’)
   6562 
   6563      Kill the current action line.
   6564 
   6565 ‘c’     (‘git-rebase-pick’)
   6566 
   6567      Use commit on current line.
   6568 
   6569 ‘x’     (‘git-rebase-exec’)
   6570 
   6571      Insert a shell command to be run after the proceeding commit.
   6572 
   6573      If there already is such a command on the current line, then edit
   6574      that instead.  With a prefix argument insert a new command even
   6575      when there already is one on the current line.  With empty input
   6576      remove the command on the current line, if any.
   6577 
   6578 ‘b’     (‘git-rebase-break’)
   6579 
   6580      Insert a break action before the current line, instructing Git to
   6581      return control to the user.
   6582 
   6583 ‘y’     (‘git-rebase-insert’)
   6584 
   6585      Read an arbitrary commit and insert it below current line.
   6586 
   6587 ‘C-x u’     (‘git-rebase-undo’)
   6588 
   6589      Undo some previous changes.  Like ‘undo’ but works in read-only
   6590      buffers.
   6591 
   6592  -- User Option: git-rebase-auto-advance
   6593 
   6594      Whether to move to next line after changing a line.
   6595 
   6596  -- User Option: git-rebase-show-instructions
   6597 
   6598      Whether to show usage instructions inside the rebase buffer.
   6599 
   6600  -- User Option: git-rebase-confirm-cancel
   6601 
   6602      Whether confirmation is required to cancel.
   6603 
   6604    When a rebase is performed with the ‘--rebase-merges’ option, the
   6605 sequence will include a few other types of actions and the following
   6606 commands become relevant.
   6607 
   6608 ‘l’     (‘git-rebase-label’)
   6609 
   6610      This commands inserts a label action or edits the one at point.
   6611 
   6612 ‘t’     (‘git-rebase-reset’)
   6613 
   6614      This command inserts a reset action or edits the one at point.  The
   6615      prompt will offer the labels that are currently present in the
   6616      buffer.
   6617 
   6618 ‘MM’     (‘git-rebase-merge’)
   6619 
   6620      The command inserts a merge action or edits the one at point.  The
   6621      prompt will offer the labels that are currently present in the
   6622      buffer.  Specifying a message to reuse via ‘-c’ or ‘-C’ is not
   6623      supported; an editor will always be invoked for the merge.
   6624 
   6625 ‘Mt’     (‘git-rebase-merge-toggle-editmsg’)
   6626 
   6627      This command toggles between the ‘-C’ and ‘-c’ options of the merge
   6628      action at point.  These options both specify a commit whose message
   6629      should be reused.  The lower-case variant instructs Git to invoke
   6630      the editor when creating the merge, allowing the user to edit the
   6631      message.
   6632 
   6633 
   6634 File: magit.info,  Node: Information About In-Progress Rebase,  Prev: Editing Rebase Sequences,  Up: Rebasing
   6635 
   6636 6.9.2 Information About In-Progress Rebase
   6637 ------------------------------------------
   6638 
   6639 While a rebase sequence is in progress, the status buffer features a
   6640 section that lists the commits that have already been applied as well as
   6641 the commits that still have to be applied.
   6642 
   6643    The commits are split in two halves.  When rebase stops at a commit,
   6644 either because the user has to deal with a conflict or because s/he
   6645 explicitly requested that rebase stops at that commit, then point is
   6646 placed on the commit that separates the two groups, i.e.  on ‘HEAD’.
   6647 The commits above it have not been applied yet, while the ‘HEAD’ and the
   6648 commits below it have already been applied.  In between these two groups
   6649 of applied and yet-to-be applied commits, there sometimes is a commit
   6650 which has been dropped.
   6651 
   6652    Each commit is prefixed with a word and these words are additionally
   6653 shown in different colors to indicate the status of the commits.
   6654 
   6655    The following colors are used:
   6656 
   6657    • Yellow commits have not been applied yet.
   6658 
   6659    • Gray commits have already been applied.
   6660 
   6661    • The blue commit is the ‘HEAD’ commit.
   6662 
   6663    • The green commit is the commit the rebase sequence stopped at.  If
   6664      this is the same commit as ‘HEAD’ (e.g.  because you haven’t done
   6665      anything yet after rebase stopped at the commit, then this commit
   6666      is shown in blue, not green).  There can only be a green *and* a
   6667      blue commit at the same time, if you create one or more new commits
   6668      after rebase stops at a commit.
   6669 
   6670    • Red commits have been dropped.  They are shown for reference only,
   6671      e.g.  to make it easier to diff.
   6672 
   6673    Of course these colors are subject to the color-theme in use.
   6674 
   6675    The following words are used:
   6676 
   6677    • Commits prefixed with ‘pick’, ‘reword’, ‘edit’, ‘squash’, and
   6678      ‘fixup’ have not been applied yet.  These words have the same
   6679      meaning here as they do in the buffer used to edit the rebase
   6680      sequence.  See *note Editing Rebase Sequences::.  When the
   6681      ‘--rebase-merges’ option was specified, ‘reset’, ‘label’, and
   6682      ‘merge’ lines may also be present.
   6683 
   6684    • Commits prefixed with ‘done’ and ‘onto’ have already been applied.
   6685      It is possible for such a commit to be the ‘HEAD’, in which case it
   6686      is blue.  Otherwise it is grey.
   6687 
   6688         • The commit prefixed with ‘onto’ is the commit on top of which
   6689           all the other commits are being re-applied.  This commit
   6690           itself did not have to be re-applied, it is the commit rebase
   6691           did rewind to before starting to re-apply other commits.
   6692 
   6693         • Commits prefixed with ‘done’ have already been re-applied.
   6694           This includes commits that have been re-applied but also new
   6695           commits that you have created during the rebase.
   6696 
   6697    • All other commits, those not prefixed with any of the above words,
   6698      are in some way related to the commit at which rebase stopped.
   6699 
   6700      To determine whether a commit is related to the stopped-at commit
   6701      their hashes, trees and patch-ids (1) are being compared.  The
   6702      commit message is not used for this purpose.
   6703 
   6704      Generally speaking commits that are related to the stopped-at
   6705      commit can have any of the used colors, though not all color/word
   6706      combinations are possible.
   6707 
   6708      Words used for stopped-at commits are:
   6709 
   6710         • When a commit is prefixed with ‘void’, then that indicates
   6711           that Magit knows for sure that all the changes in that commit
   6712           have been applied using several new commits.  This commit is
   6713           no longer reachable from ‘HEAD’, and it also isn’t one of the
   6714           commits that will be applied when resuming the session.
   6715 
   6716         • When a commit is prefixed with ‘join’, then that indicates
   6717           that the rebase sequence stopped at that commit due to a
   6718           conflict - you now have to join (merge) the changes with what
   6719           has already been applied.  In a sense this is the commit
   6720           rebase stopped at, but while its effect is already in the
   6721           index and in the worktree (with conflict markers), the commit
   6722           itself has not actually been applied yet (it isn’t the
   6723           ‘HEAD’).  So it is shown in yellow, like the other commits
   6724           that still have to be applied.
   6725 
   6726         • When a commit is prefixed with ‘stop’ or a _blue_ or _green_
   6727           ‘same’, then that indicates that rebase stopped at this
   6728           commit, that it is still applied or has been applied again,
   6729           and that at least its patch-id is unchanged.
   6730 
   6731              • When a commit is prefixed with ‘stop’, then that
   6732                indicates that rebase stopped at that commit because you
   6733                requested that earlier, and its patch-id is unchanged.
   6734                It might even still be the exact same commit.
   6735 
   6736              • When a commit is prefixed with a _blue_ or _green_
   6737                ‘same’, then that indicates that while its tree or hash
   6738                changed, its patch-id did not.  If it is blue, then it is
   6739                the ‘HEAD’ commit (as always for blue).  When it is
   6740                green, then it no longer is ‘HEAD’ because other commit
   6741                have been created since (but before continuing the
   6742                rebase).
   6743 
   6744         • When a commit is prefixed with ‘goal’, a _yellow_ ‘same,’ or
   6745           ‘work’, then that indicates that rebase applied that commit
   6746           but that you then reset ‘HEAD’ to an earlier commit (likely to
   6747           split it up into multiple commits), and that there are some
   6748           uncommitted changes remaining which likely (but not
   6749           necessarily) originate from that commit.
   6750 
   6751              • When a commit is prefixed with ‘goal’, then that
   6752                indicates that it is still possible to create a new
   6753                commit with the exact same tree (the "goal") without
   6754                manually editing any files, by committing the index, or
   6755                by staging all changes and then committing that.  This is
   6756                the case when the original tree still exists in the index
   6757                or worktree in untainted form.
   6758 
   6759              • When a commit is prefixed with a yellow ‘same’, then that
   6760                indicates that it is no longer possible to create a
   6761                commit with the exact same tree, but that it is still
   6762                possible to create a commit with the same patch-id.  This
   6763                would be the case if you created a new commit with other
   6764                changes, but the changes from the original commit still
   6765                exist in the index or working tree in untainted form.
   6766 
   6767              • When a commit is prefixed with ‘work’, then that
   6768                indicates that you reset ‘HEAD’ to an earlier commit, and
   6769                that there are some staged and/or unstaged changes
   6770                (likely, but not necessarily) originating from that
   6771                commit.  However it is no longer possible to create a new
   6772                commit with the same tree or at least the same patch-id
   6773                because you have already made other changes.
   6774 
   6775         • When a commit is prefixed with ‘poof’ or ‘gone’, then that
   6776           indicates that rebase applied that commit but that you then
   6777           reset ‘HEAD’ to an earlier commit (likely to split it up into
   6778           multiple commits), and that there are no uncommitted changes.
   6779 
   6780              • When a commit is prefixed with ‘poof’, then that
   6781                indicates that it is no longer reachable from ‘HEAD’, but
   6782                that it has been replaced with one or more commits, which
   6783                together have the exact same effect.
   6784 
   6785              • When a commit is prefixed with ‘gone’, then that
   6786                indicates that it is no longer reachable from ‘HEAD’ and
   6787                that we also cannot determine whether its changes are
   6788                still in effect in one or more new commits.  They might
   6789                be, but if so, then there must also be other changes
   6790                which makes it impossible to know for sure.
   6791 
   6792    Do not worry if you do not fully understand the above.  That’s okay,
   6793 you will acquire a good enough understanding through practice.
   6794 
   6795    For other sequence operations such as cherry-picking, a similar
   6796 section is displayed, but they lack some of the features described
   6797 above, due to limitations in the git commands used to implement them.
   6798 Most importantly these sequences only support "picking" a commit but not
   6799 other actions such as "rewording", and they do not keep track of the
   6800 commits which have already been applied.
   6801 
   6802    ---------- Footnotes ----------
   6803 
   6804    (1) The patch-id is a hash of the _changes_ introduced by a commit.
   6805 It differs from the hash of the commit itself, which is a hash of the
   6806 result of applying that change (i.e.  the resulting trees and blobs) as
   6807 well as author and committer information, the commit message, and the
   6808 hashes of the parents of the commit.  The patch-id hash on the other
   6809 hand is created only from the added and removed lines, even line numbers
   6810 and whitespace changes are ignored when calculating this hash.  The
   6811 patch-ids of two commits can be used to answer the question "Do these
   6812 commits make the same change?".
   6813 
   6814 
   6815 File: magit.info,  Node: Cherry Picking,  Next: Resetting,  Prev: Rebasing,  Up: Manipulating
   6816 
   6817 6.10 Cherry Picking
   6818 ===================
   6819 
   6820 Also see *note (gitman)git-cherry-pick::.
   6821 
   6822 ‘A’     (‘magit-cherry-pick’)
   6823 
   6824      This transient prefix command binds the following suffix commands
   6825      along with the appropriate infix arguments and displays them in a
   6826      temporary buffer until a suffix is invoked.
   6827 
   6828    When no cherry-pick or revert is in progress, then the transient
   6829 features the following suffix commands.
   6830 
   6831 ‘A A’     (‘magit-cherry-copy’)
   6832 
   6833      This command copies COMMITS from another branch onto the current
   6834      branch.  If the region selects multiple commits, then those are
   6835      copied, without prompting.  Otherwise the user is prompted for a
   6836      commit or range, defaulting to the commit at point.
   6837 
   6838 ‘A a’     (‘magit-cherry-apply’)
   6839 
   6840      This command applies the changes in COMMITS from another branch
   6841      onto the current branch.  If the region selects multiple commits,
   6842      then those are used, without prompting.  Otherwise the user is
   6843      prompted for a commit or range, defaulting to the commit at point.
   6844 
   6845      This command also has a top-level binding, which can be invoked
   6846      without using the transient by typing ‘a’ at the top-level.
   6847 
   6848    The following commands not only apply some commits to some branch,
   6849 but also remove them from some other branch.  The removal is performed
   6850 using either ‘git-update-ref’ or if necessary ‘git-rebase’.  Both
   6851 applying commits as well as removing them using ‘git-rebase’ can lead to
   6852 conflicts.  If that happens, then these commands abort and you not only
   6853 have to resolve the conflicts but also finish the process the same way
   6854 you would have to if these commands didn’t exist at all.
   6855 
   6856 ‘A h’     (‘magit-cherry-harvest’)
   6857 
   6858      This command moves the selected COMMITS that must be located on
   6859      another BRANCH onto the current branch instead, removing them from
   6860      the former.  When this command succeeds, then the same branch is
   6861      current as before.
   6862 
   6863      Applying the commits on the current branch or removing them from
   6864      the other branch can lead to conflicts.  When that happens, then
   6865      this command stops and you have to resolve the conflicts and then
   6866      finish the process manually.
   6867 
   6868 ‘A d’     (‘magit-cherry-donate’)
   6869 
   6870      This command moves the selected COMMITS from the current branch
   6871      onto another existing BRANCH, removing them from the former.  When
   6872      this command succeeds, then the same branch is current as before.
   6873 
   6874      Applying the commits on the other branch or removing them from the
   6875      current branch can lead to conflicts.  When that happens, then this
   6876      command stops and you have to resolve the conflicts and then finish
   6877      the process manually.
   6878 
   6879 ‘A n’     (‘magit-cherry-spinout’)
   6880 
   6881      This command moves the selected COMMITS from the current branch
   6882      onto a new branch BRANCH, removing them from the former.  When this
   6883      command succeeds, then the same branch is current as before.
   6884 
   6885      Applying the commits on the other branch or removing them from the
   6886      current branch can lead to conflicts.  When that happens, then this
   6887      command stops and you have to resolve the conflicts and then finish
   6888      the process manually.
   6889 
   6890 ‘A s’     (‘magit-cherry-spinoff’)
   6891 
   6892      This command moves the selected COMMITS from the current branch
   6893      onto a new branch BRANCH, removing them from the former.  When this
   6894      command succeeds, then the new branch is checked out.
   6895 
   6896      Applying the commits on the other branch or removing them from the
   6897      current branch can lead to conflicts.  When that happens, then this
   6898      command stops and you have to resolve the conflicts and then finish
   6899      the process manually.
   6900 
   6901    When a cherry-pick or revert is in progress, then the transient
   6902 instead features the following suffix commands.
   6903 
   6904 ‘A A’     (‘magit-sequence-continue’)
   6905 
   6906      Resume the current cherry-pick or revert sequence.
   6907 
   6908 ‘A s’     (‘magit-sequence-skip’)
   6909 
   6910      Skip the stopped at commit during a cherry-pick or revert sequence.
   6911 
   6912 ‘A a’     (‘magit-sequence-abort’)
   6913 
   6914      Abort the current cherry-pick or revert sequence.  This discards
   6915      all changes made since the sequence started.
   6916 
   6917 * Menu:
   6918 
   6919 * Reverting::
   6920 
   6921 
   6922 File: magit.info,  Node: Reverting,  Up: Cherry Picking
   6923 
   6924 6.10.1 Reverting
   6925 ----------------
   6926 
   6927 ‘V’     (‘magit-revert’)
   6928 
   6929      This transient prefix command binds the following suffix commands
   6930      along with the appropriate infix arguments and displays them in a
   6931      temporary buffer until a suffix is invoked.
   6932 
   6933    When no cherry-pick or revert is in progress, then the transient
   6934 features the following suffix commands.
   6935 
   6936 ‘V V’     (‘magit-revert-and-commit’)
   6937 
   6938      Revert a commit by creating a new commit.  Prompt for a commit,
   6939      defaulting to the commit at point.  If the region selects multiple
   6940      commits, then revert all of them, without prompting.
   6941 
   6942 ‘V v’     (‘magit-revert-no-commit’)
   6943 
   6944      Revert a commit by applying it in reverse to the working tree.
   6945      Prompt for a commit, defaulting to the commit at point.  If the
   6946      region selects multiple commits, then revert all of them, without
   6947      prompting.
   6948 
   6949    When a cherry-pick or revert is in progress, then the transient
   6950 instead features the following suffix commands.
   6951 
   6952 ‘V A’     (‘magit-sequence-continue’)
   6953 
   6954      Resume the current cherry-pick or revert sequence.
   6955 
   6956 ‘V s’     (‘magit-sequence-skip’)
   6957 
   6958      Skip the stopped at commit during a cherry-pick or revert sequence.
   6959 
   6960 ‘V a’     (‘magit-sequence-abort’)
   6961 
   6962      Abort the current cherry-pick or revert sequence.  This discards
   6963      all changes made since the sequence started.
   6964 
   6965 
   6966 File: magit.info,  Node: Resetting,  Next: Stashing,  Prev: Cherry Picking,  Up: Manipulating
   6967 
   6968 6.11 Resetting
   6969 ==============
   6970 
   6971 Also see *note (gitman)git-reset::.
   6972 
   6973 ‘x’     (‘magit-reset-quickly’)
   6974 
   6975      Reset the ‘HEAD’ and index to some commit read from the user and
   6976      defaulting to the commit at point, and possibly also reset the
   6977      working tree.  With a prefix argument reset the working tree
   6978      otherwise don’t.
   6979 
   6980 ‘X m’     (‘magit-reset-mixed’)
   6981 
   6982      Reset the ‘HEAD’ and index to some commit read from the user and
   6983      defaulting to the commit at point.  The working tree is kept as-is.
   6984 
   6985 ‘X s’     (‘magit-reset-soft’)
   6986 
   6987      Reset the ‘HEAD’ to some commit read from the user and defaulting
   6988      to the commit at point.  The index and the working tree are kept
   6989      as-is.
   6990 
   6991 ‘X h’     (‘magit-reset-hard’)
   6992 
   6993      Reset the ‘HEAD’, index, and working tree to some commit read from
   6994      the user and defaulting to the commit at point.
   6995 
   6996 ‘X k’     (‘magit-reset-keep’)
   6997 
   6998      Reset the ‘HEAD’, index, and working tree to some commit read from
   6999      the user and defaulting to the commit at point.  Uncommitted
   7000      changes are kept as-is.
   7001 
   7002 ‘X i’     (‘magit-reset-index’)
   7003 
   7004      Reset the index to some commit read from the user and defaulting to
   7005      the commit at point.  Keep the ‘HEAD’ and working tree as-is, so if
   7006      the commit refers to the ‘HEAD’, then this effectively unstages all
   7007      changes.
   7008 
   7009 ‘X w’     (‘magit-reset-worktree’)
   7010 
   7011      Reset the working tree to some commit read from the user and
   7012      defaulting to the commit at point.  Keep the ‘HEAD’ and index
   7013      as-is.
   7014 
   7015 ‘X f’     (‘magit-file-checkout’)
   7016 
   7017      Update file in the working tree and index to the contents from a
   7018      revision.  Both the revision and file are read from the user.
   7019 
   7020 
   7021 File: magit.info,  Node: Stashing,  Prev: Resetting,  Up: Manipulating
   7022 
   7023 6.12 Stashing
   7024 =============
   7025 
   7026 Also see *note (gitman)git-stash::.
   7027 
   7028 ‘z’     (‘magit-stash’)
   7029 
   7030      This transient prefix command binds the following suffix commands
   7031      along with the appropriate infix arguments and displays them in a
   7032      temporary buffer until a suffix is invoked.
   7033 
   7034 ‘z z’     (‘magit-stash-both’)
   7035 
   7036      Create a stash of the index and working tree.  Untracked files are
   7037      included according to infix arguments.  One prefix argument is
   7038      equivalent to ‘--include-untracked’ while two prefix arguments are
   7039      equivalent to ‘--all’.
   7040 
   7041 ‘z i’     (‘magit-stash-index’)
   7042 
   7043      Create a stash of the index only.  Unstaged and untracked changes
   7044      are not stashed.
   7045 
   7046 ‘z w’     (‘magit-stash-worktree’)
   7047 
   7048      Create a stash of unstaged changes in the working tree.  Untracked
   7049      files are included according to infix arguments.  One prefix
   7050      argument is equivalent to ‘--include-untracked’ while two prefix
   7051      arguments are equivalent to ‘--all’.
   7052 
   7053 ‘z x’     (‘magit-stash-keep-index’)
   7054 
   7055      Create a stash of the index and working tree, keeping index intact.
   7056      Untracked files are included according to infix arguments.  One
   7057      prefix argument is equivalent to ‘--include-untracked’ while two
   7058      prefix arguments are equivalent to ‘--all’.
   7059 
   7060 ‘z Z’     (‘magit-snapshot-both’)
   7061 
   7062      Create a snapshot of the index and working tree.  Untracked files
   7063      are included according to infix arguments.  One prefix argument is
   7064      equivalent to ‘--include-untracked’ while two prefix arguments are
   7065      equivalent to ‘--all’.
   7066 
   7067 ‘z I’     (‘magit-snapshot-index’)
   7068 
   7069      Create a snapshot of the index only.  Unstaged and untracked
   7070      changes are not stashed.
   7071 
   7072 ‘z W’     (‘magit-snapshot-worktree’)
   7073 
   7074      Create a snapshot of unstaged changes in the working tree.
   7075      Untracked files are included according to infix arguments.  One
   7076      prefix argument is equivalent to ‘--include-untracked’ while two
   7077      prefix arguments are equivalent to ‘--all’-.
   7078 
   7079 ‘z a’     (‘magit-stash-apply’)
   7080 
   7081      Apply a stash to the working tree.  Try to preserve the stash
   7082      index.  If that fails because there are staged changes, apply
   7083      without preserving the stash index.
   7084 
   7085 ‘z p’     (‘magit-stash-pop’)
   7086 
   7087      Apply a stash to the working tree and remove it from stash list.
   7088      Try to preserve the stash index.  If that fails because there are
   7089      staged changes, apply without preserving the stash index and forgo
   7090      removing the stash.
   7091 
   7092 ‘z k’     (‘magit-stash-drop’)
   7093 
   7094      Remove a stash from the stash list.  When the region is active,
   7095      offer to drop all contained stashes.
   7096 
   7097 ‘z v’     (‘magit-stash-show’)
   7098 
   7099      Show all diffs of a stash in a buffer.
   7100 
   7101 ‘z b’     (‘magit-stash-branch’)
   7102 
   7103      Create and checkout a new BRANCH from STASH.  The branch starts at
   7104      the commit that was current when the stash was created.
   7105 
   7106 ‘z B’     (‘magit-stash-branch-here’)
   7107 
   7108      Create and checkout a new BRANCH using ‘magit-branch’ with the
   7109      current branch or ‘HEAD’ as the starting-point.  Then apply STASH,
   7110      dropping it if it applies cleanly.
   7111 
   7112 ‘z f’     (‘magit-stash-format-patch’)
   7113 
   7114      Create a patch from STASH.
   7115 
   7116 ‘k’     (‘magit-stash-clear’)
   7117 
   7118      Remove all stashes saved in REF’s reflog by deleting REF.
   7119 
   7120 ‘z l’     (‘magit-stash-list’)
   7121 
   7122      List all stashes in a buffer.
   7123 
   7124  -- User Option: magit-stashes-margin
   7125 
   7126      This option specifies whether the margin is initially shown in
   7127      stashes buffers and how it is formatted.
   7128 
   7129      The value has the form ‘(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)’.
   7130 
   7131         • If INIT is non-nil, then the margin is shown initially.
   7132 
   7133         • STYLE controls how to format the author or committer date.  It
   7134           can be one of ‘age’ (to show the age of the commit),
   7135           ‘age-abbreviated’ (to abbreviate the time unit to a
   7136           character), or a string (suitable for ‘format-time-string’) to
   7137           show the actual date.  Option
   7138           ‘magit-log-margin-show-committer-date’ controls which date is
   7139           being displayed.
   7140 
   7141         • WIDTH controls the width of the margin.  This exists for
   7142           forward compatibility and currently the value should not be
   7143           changed.
   7144 
   7145         • AUTHOR controls whether the name of the author is also shown
   7146           by default.
   7147 
   7148         • AUTHOR-WIDTH has to be an integer.  When the name of the
   7149           author is shown, then this specifies how much space is used to
   7150           do so.
   7151 
   7152 
   7153 File: magit.info,  Node: Transferring,  Next: Miscellaneous,  Prev: Manipulating,  Up: Top
   7154 
   7155 7 Transferring
   7156 **************
   7157 
   7158 * Menu:
   7159 
   7160 * Remotes::
   7161 * Fetching::
   7162 * Pulling::
   7163 * Pushing::
   7164 * Plain Patches::
   7165 * Maildir Patches::
   7166 
   7167 
   7168 File: magit.info,  Node: Remotes,  Next: Fetching,  Up: Transferring
   7169 
   7170 7.1 Remotes
   7171 ===========
   7172 
   7173 * Menu:
   7174 
   7175 * Remote Commands::
   7176 * Remote Git Variables::
   7177 
   7178 
   7179 File: magit.info,  Node: Remote Commands,  Next: Remote Git Variables,  Up: Remotes
   7180 
   7181 7.1.1 Remote Commands
   7182 ---------------------
   7183 
   7184 The transient prefix command ‘magit-remote’ is used to add remotes and
   7185 to make changes to existing remotes.  This command only deals with
   7186 remotes themselves, not with branches or the transfer of commits.  Those
   7187 features are available from separate transient commands.
   7188 
   7189    Also see *note (gitman)git-remote::.
   7190 
   7191 ‘M’     (‘magit-remote’)
   7192 
   7193      This transient prefix command binds the following suffix commands
   7194      and displays them in a temporary buffer until a suffix is invoked.
   7195 
   7196      By default it also binds and displays the values of some
   7197      remote-related Git variables and allows changing their values.
   7198 
   7199  -- User Option: magit-remote-direct-configure
   7200 
   7201      This option controls whether remote-related Git variables are
   7202      accessible directly from the transient ‘magit-remote’.
   7203 
   7204      If ‘t’ (the default) and a local branch is checked out, then
   7205      ‘magit-remote’ features the variables for the upstream remote of
   7206      that branch, or if ‘HEAD’ is detached, for ‘origin’, provided that
   7207      exists.
   7208 
   7209      If ‘nil’, then ‘magit-remote-configure’ has to be used to do so.
   7210 
   7211 ‘M C’     (‘magit-remote-configure’)
   7212 
   7213      This transient prefix command binds commands that set the value of
   7214      remote-related variables and displays them in a temporary buffer
   7215      until the transient is exited.
   7216 
   7217      With a prefix argument, this command always prompts for a remote.
   7218 
   7219      Without a prefix argument this depends on whether it was invoked as
   7220      a suffix of ‘magit-remote’ and on the
   7221      ‘magit-remote-direct-configure’ option.  If ‘magit-remote’ already
   7222      displays the variables for the upstream, then it does not make
   7223      sense to invoke another transient that displays them for the same
   7224      remote.  In that case this command prompts for a remote.
   7225 
   7226    The variables are described in *note Remote Git Variables::.
   7227 
   7228 ‘M a’     (‘magit-remote-add’)
   7229 
   7230      This command add a remote and fetches it.  The remote name and url
   7231      are read in the minibuffer.
   7232 
   7233 ‘M r’     (‘magit-remote-rename’)
   7234 
   7235      This command renames a remote.  Both the old and the new names are
   7236      read in the minibuffer.
   7237 
   7238 ‘M u’     (‘magit-remote-set-url’)
   7239 
   7240      This command changes the url of a remote.  Both the remote and the
   7241      new url are read in the minibuffer.
   7242 
   7243 ‘M k’     (‘magit-remote-remove’)
   7244 
   7245      This command deletes a remote, read in the minibuffer.
   7246 
   7247 ‘M p’     (‘magit-remote-prune’)
   7248 
   7249      This command removes stale remote-tracking branches for a remote
   7250      read in the minibuffer.
   7251 
   7252 ‘M P’     (‘magit-remote-prune-refspecs’)
   7253 
   7254      This command removes stale refspecs for a remote read in the
   7255      minibuffer.
   7256 
   7257      A refspec is stale if there no longer exists at least one branch on
   7258      the remote that would be fetched due to that refspec.  A stale
   7259      refspec is problematic because its existence causes Git to refuse
   7260      to fetch according to the remaining non-stale refspecs.
   7261 
   7262      If only stale refspecs remain, then this command offers to either
   7263      delete the remote or to replace the stale refspecs with the default
   7264      refspec ("+refs/heads/*:refs/remotes/REMOTE/*").
   7265 
   7266      This command also removes the remote-tracking branches that were
   7267      created due to the now stale refspecs.  Other stale branches are
   7268      not removed.
   7269 
   7270  -- User Option: magit-remote-add-set-remote.pushDefault
   7271 
   7272      This option controls whether the user is asked whether they want to
   7273      set ‘remote.pushDefault’ after adding a remote.
   7274 
   7275      If ‘ask’, then users is always ask.  If ‘ask-if-unset’, then the
   7276      user is only if the variable isn’t set already.  If ‘nil’, then the
   7277      user isn’t asked and the variable isn’t set.  If the value is a
   7278      string, then the variable is set without the user being asked,
   7279      provided that the name of the added remote is equal to that string
   7280      and the variable isn’t already set.
   7281 
   7282 
   7283 File: magit.info,  Node: Remote Git Variables,  Prev: Remote Commands,  Up: Remotes
   7284 
   7285 7.1.2 Remote Git Variables
   7286 --------------------------
   7287 
   7288 These variables can be set from the transient prefix command
   7289 ‘magit-remote-configure’.  By default they can also be set from
   7290 ‘magit-remote’.  See *note Remote Commands::.
   7291 
   7292  -- Variable: remote.NAME.url
   7293 
   7294      This variable specifies the url of the remote named NAME.  It can
   7295      have multiple values.
   7296 
   7297  -- Variable: remote.NAME.fetch
   7298 
   7299      The refspec used when fetching from the remote named NAME.  It can
   7300      have multiple values.
   7301 
   7302  -- Variable: remote.NAME.pushurl
   7303 
   7304      This variable specifies the url used for fetching from the remote
   7305      named NAME.  If it is not specified, then ‘remote.NAME.url’ is used
   7306      instead.  It can have multiple values.
   7307 
   7308  -- Variable: remote.NAME.push
   7309 
   7310      The refspec used when pushing to the remote named NAME.  It can
   7311      have multiple values.
   7312 
   7313  -- Variable: remote.NAME.tagOpts
   7314 
   7315      This variable specifies what tags are fetched by default.  If the
   7316      value is ‘--no-tags’ then no tags are fetched.  If the value is
   7317      ‘--tags’, then all tags are fetched.  If this variable has no
   7318      value, then only tags are fetched that are reachable from fetched
   7319      branches.
   7320 
   7321 
   7322 File: magit.info,  Node: Fetching,  Next: Pulling,  Prev: Remotes,  Up: Transferring
   7323 
   7324 7.2 Fetching
   7325 ============
   7326 
   7327 Also see *note (gitman)git-fetch::.  For information about the upstream
   7328 and the push-remote, see *note The Two Remotes::.
   7329 
   7330 ‘f’     (‘magit-fetch’)
   7331 
   7332      This transient prefix command binds the following suffix commands
   7333      along with the appropriate infix arguments and displays them in a
   7334      temporary buffer until a suffix is invoked.
   7335 
   7336 ‘f p’     (‘magit-fetch-from-pushremote’)
   7337 
   7338      This command fetches from the current push-remote.
   7339 
   7340      With a prefix argument or when the push-remote is either not
   7341      configured or unusable, then let the user first configure the
   7342      push-remote.
   7343 
   7344 ‘f u’     (‘magit-fetch-from-upstream’)
   7345 
   7346      This command fetch from the upstream of the current branch.
   7347 
   7348      If the upstream is configured for the current branch and names an
   7349      existing remote, then use that.  Otherwise try to use another
   7350      remote: If only a single remote is configured, then use that.
   7351      Otherwise if a remote named "origin" exists, then use that.
   7352 
   7353      If no remote can be determined, then this command is not available
   7354      from the ‘magit-fetch’ transient prefix and invoking it directly
   7355      results in an error.
   7356 
   7357 ‘f e’     (‘magit-fetch-other’)
   7358 
   7359      This command fetch from a repository read from the minibuffer.
   7360 
   7361 ‘f o’     (‘magit-fetch-branch’)
   7362 
   7363      This command fetches a branch from a remote, both of which are read
   7364      from the minibuffer.
   7365 
   7366 ‘f r’     (‘magit-fetch-refspec’)
   7367 
   7368      This command fetches from a remote using an explicit refspec, both
   7369      of which are read from the minibuffer.
   7370 
   7371 ‘f a’     (‘magit-fetch-all’)
   7372 
   7373      This command fetches from all remotes.
   7374 
   7375 ‘f m’     (‘magit-submodule-fetch’)
   7376 
   7377      This command fetches all submodules.  With a prefix argument it
   7378      fetches all remotes of all submodules.
   7379 
   7380  -- User Option: magit-pull-or-fetch
   7381 
   7382      By default fetch and pull commands are available from separate
   7383      transient prefix command.  Setting this to ‘t’ adds some (but not
   7384      all) of the above suffix commands to the ‘magit-pull’ transient.
   7385 
   7386      If you do that, then you might also want to change the key binding
   7387      for these prefix commands, e.g.:
   7388 
   7389           (setq magit-pull-or-fetch t)
   7390           (define-key magit-mode-map "f" 'magit-pull) ; was magit-fetch
   7391           (define-key magit-mode-map "F" nil)         ; was magit-pull
   7392 
   7393 
   7394 File: magit.info,  Node: Pulling,  Next: Pushing,  Prev: Fetching,  Up: Transferring
   7395 
   7396 7.3 Pulling
   7397 ===========
   7398 
   7399 Also see *note (gitman)git-pull::.  For information about the upstream
   7400 and the push-remote, see *note The Two Remotes::.
   7401 
   7402 ‘F’     (‘magit-pull’)
   7403 
   7404      This transient prefix command binds the following suffix commands
   7405      and displays them in a temporary buffer until a suffix is invoked.
   7406 
   7407 ‘F p’     (‘magit-pull-from-pushremote’)
   7408 
   7409      This command pulls from the push-remote of the current branch.
   7410 
   7411      With a prefix argument or when the push-remote is either not
   7412      configured or unusable, then let the user first configure the
   7413      push-remote.
   7414 
   7415 ‘F u’     (‘magit-pull-from-upstream’)
   7416 
   7417      This command pulls from the upstream of the current branch.
   7418 
   7419      With a prefix argument or when the upstream is either not
   7420      configured or unusable, then let the user first configure the
   7421      upstream.
   7422 
   7423 ‘F e’     (‘magit-pull-branch’)
   7424 
   7425      This command pulls from a branch read in the minibuffer.
   7426 
   7427 
   7428 File: magit.info,  Node: Pushing,  Next: Plain Patches,  Prev: Pulling,  Up: Transferring
   7429 
   7430 7.4 Pushing
   7431 ===========
   7432 
   7433 Also see *note (gitman)git-push::.  For information about the upstream
   7434 and the push-remote, see *note The Two Remotes::.
   7435 
   7436 ‘P’     (‘magit-push’)
   7437 
   7438      This transient prefix command binds the following suffix commands
   7439      along with the appropriate infix arguments and displays them in a
   7440      temporary buffer until a suffix is invoked.
   7441 
   7442 ‘P p’     (‘magit-push-current-to-pushremote’)
   7443 
   7444      This command pushes the current branch to its push-remote.
   7445 
   7446      With a prefix argument or when the push-remote is either not
   7447      configured or unusable, then let the user first configure the
   7448      push-remote.
   7449 
   7450 ‘P u’     (‘magit-push-current-to-upstream’)
   7451 
   7452      This command pushes the current branch to its upstream branch.
   7453 
   7454      With a prefix argument or when the upstream is either not
   7455      configured or unusable, then let the user first configure the
   7456      upstream.
   7457 
   7458 ‘P e’     (‘magit-push-current’)
   7459 
   7460      This command pushes the current branch to a branch read in the
   7461      minibuffer.
   7462 
   7463 ‘P o’     (‘magit-push-other’)
   7464 
   7465      This command pushes an arbitrary branch or commit somewhere.  Both
   7466      the source and the target are read in the minibuffer.
   7467 
   7468 ‘P r’     (‘magit-push-refspecs’)
   7469 
   7470      This command pushes one or multiple refspecs to a remote, both of
   7471      which are read in the minibuffer.
   7472 
   7473      To use multiple refspecs, separate them with commas.  Completion is
   7474      only available for the part before the colon, or when no colon is
   7475      used.
   7476 
   7477 ‘P m’     (‘magit-push-matching’)
   7478 
   7479      This command pushes all matching branches to another repository.
   7480 
   7481      If only one remote exists, then push to that.  Otherwise prompt for
   7482      a remote, offering the remote configured for the current branch as
   7483      default.
   7484 
   7485 ‘P t’     (‘magit-push-tags’)
   7486 
   7487      This command pushes all tags to another repository.
   7488 
   7489      If only one remote exists, then push to that.  Otherwise prompt for
   7490      a remote, offering the remote configured for the current branch as
   7491      default.
   7492 
   7493 ‘P T’     (‘magit-push-tag’)
   7494 
   7495      This command pushes a tag to another repository.
   7496 
   7497    One of the infix arguments, ‘--force-with-lease’, deserves a word of
   7498 caution.  It is passed without a value, which means "permit a force push
   7499 as long as the remote-tracking branches match their counterparts on the
   7500 remote end".  If you’ve set up a tool to do automatic fetches (Magit
   7501 itself does not provide such functionality), using ‘--force-with-lease’
   7502 can be dangerous because you don’t actually control or know the state of
   7503 the remote-tracking refs.  In that case, you should consider setting
   7504 ‘push.useForceIfIncludes’ to ‘true’ (available since Git 2.30).
   7505 
   7506    Two more push commands exist, which by default are not available from
   7507 the push transient.  See their doc-strings for instructions on how to
   7508 add them to the transient.
   7509 
   7510  -- Command: magit-push-implicitly args
   7511 
   7512      This command pushes somewhere without using an explicit refspec.
   7513 
   7514      This command simply runs ‘git push -v [ARGS]’.  ARGS are the infix
   7515      arguments.  No explicit refspec arguments are used.  Instead the
   7516      behavior depends on at least these Git variables: ‘push.default’,
   7517      ‘remote.pushDefault’, ‘branch.<branch>.pushRemote’,
   7518      ‘branch.<branch>.remote’, ‘branch.<branch>.merge’, and
   7519      ‘remote.<remote>.push’.
   7520 
   7521      If you add this suffix to a transient prefix without explicitly
   7522      specifying the description, then an attempt is made to predict what
   7523      this command will do.  For example:
   7524 
   7525           (transient-insert-suffix 'magit-push \"p\"
   7526             '(\"i\" magit-push-implicitly))"
   7527 
   7528  -- Command: magit-push-to-remote remote args
   7529 
   7530      This command pushes to the remote REMOTE without using an explicit
   7531      refspec.  The remote is read in the minibuffer.
   7532 
   7533      This command simply runs ‘git push -v [ARGS] REMOTE’.  ARGS are the
   7534      infix arguments.  No refspec arguments are used.  Instead the
   7535      behavior depends on at least these Git variables: ‘push.default’,
   7536      ‘remote.pushDefault’, ‘branch.<branch>.pushRemote’,
   7537      ‘branch.<branch>.remote’, ‘branch.<branch>.merge’, and
   7538      ‘remote.<remote>.push’.
   7539 
   7540 
   7541 File: magit.info,  Node: Plain Patches,  Next: Maildir Patches,  Prev: Pushing,  Up: Transferring
   7542 
   7543 7.5 Plain Patches
   7544 =================
   7545 
   7546 ‘W’     (‘magit-patch’)
   7547 
   7548      This transient prefix command binds the following suffix commands
   7549      along with the appropriate infix arguments and displays them in a
   7550      temporary buffer until a suffix is invoked.
   7551 
   7552 ‘W c’     (‘magit-patch-create’)
   7553 
   7554      This command creates patches for a set commits.  If the region
   7555      marks several commits, then it creates patches for all of them.
   7556      Otherwise it functions as a transient prefix command, which
   7557      features several infix arguments and binds itself as a suffix
   7558      command.  When this command is invoked as a suffix of itself, then
   7559      it creates a patch using the specified infix arguments.
   7560 
   7561 ‘w a’     (‘magit-patch-apply’)
   7562 
   7563      This command applies a patch.  This is a transient prefix command,
   7564      which features several infix arguments and binds itself as a suffix
   7565      command.  When this command is invoked as a suffix of itself, then
   7566      it applies a patch using the specified infix arguments.
   7567 
   7568 ‘W s’     (‘magit-patch-save’)
   7569 
   7570      This command creates a patch from the current diff.
   7571 
   7572      Inside ‘magit-diff-mode’ or ‘magit-revision-mode’ buffers, ‘C-x
   7573      C-w’ is also bound to this command.
   7574 
   7575    It is also possible to save a plain patch file by using ‘C-x C-w’
   7576 inside a ‘magit-diff-mode’ or ‘magit-revision-mode’ buffer.
   7577 
   7578 
   7579 File: magit.info,  Node: Maildir Patches,  Prev: Plain Patches,  Up: Transferring
   7580 
   7581 7.6 Maildir Patches
   7582 ===================
   7583 
   7584 Also see *note (gitman)git-am::.  and *note (gitman)git-apply::.
   7585 
   7586 ‘w’     (‘magit-am’)
   7587 
   7588      This transient prefix command binds the following suffix commands
   7589      along with the appropriate infix arguments and displays them in a
   7590      temporary buffer until a suffix is invoked.
   7591 
   7592 ‘w w’     (‘magit-am-apply-patches’)
   7593 
   7594      This command applies one or more patches.  If the region marks
   7595      files, then those are applied as patches.  Otherwise this command
   7596      reads a file-name in the minibuffer, defaulting to the file at
   7597      point.
   7598 
   7599 ‘w m’     (‘magit-am-apply-maildir’)
   7600 
   7601      This command applies patches from a maildir.
   7602 
   7603 ‘w a’     (‘magit-patch-apply’)
   7604 
   7605      This command applies a plain patch.  For a longer description see
   7606      *note Plain Patches::.  This command is only available from the
   7607      ‘magit-am’ transient for historic reasons.
   7608 
   7609    When an "am" operation is in progress, then the transient instead
   7610 features the following suffix commands.
   7611 
   7612 ‘w w’     (‘magit-am-continue’)
   7613 
   7614      This command resumes the current patch applying sequence.
   7615 
   7616 ‘w s’     (‘magit-am-skip’)
   7617 
   7618      This command skips the stopped at patch during a patch applying
   7619      sequence.
   7620 
   7621 ‘w a’     (‘magit-am-abort’)
   7622 
   7623      This command aborts the current patch applying sequence.  This
   7624      discards all changes made since the sequence started.
   7625 
   7626 
   7627 File: magit.info,  Node: Miscellaneous,  Next: Customizing,  Prev: Transferring,  Up: Top
   7628 
   7629 8 Miscellaneous
   7630 ***************
   7631 
   7632 * Menu:
   7633 
   7634 * Tagging::
   7635 * Notes::
   7636 * Submodules::
   7637 * Subtree::
   7638 * Worktree::
   7639 * Bundle::
   7640 * Common Commands::
   7641 * Wip Modes::
   7642 * Commands for Buffers Visiting Files::
   7643 * Minor Mode for Buffers Visiting Blobs::
   7644 
   7645 
   7646 File: magit.info,  Node: Tagging,  Next: Notes,  Up: Miscellaneous
   7647 
   7648 8.1 Tagging
   7649 ===========
   7650 
   7651 Also see *note (gitman)git-tag::.
   7652 
   7653 ‘t’     (‘magit-tag’)
   7654 
   7655      This transient prefix command binds the following suffix commands
   7656      along with the appropriate infix arguments and displays them in a
   7657      temporary buffer until a suffix is invoked.
   7658 
   7659 ‘t t’     (‘magit-tag-create’)
   7660 
   7661      This command creates a new tag with the given NAME at REV.  With a
   7662      prefix argument it creates an annotated tag.
   7663 
   7664 ‘t r’     (‘magit-tag-release’)
   7665 
   7666      This commands creates a release tag.  It assumes that release tags
   7667      match ‘magit-release-tag-regexp’.
   7668 
   7669      First it prompts for the name of the new tag using the highest
   7670      existing tag as initial input and leaving it to the user to
   7671      increment the desired part of the version string.  If you use
   7672      unconventional release tags or version numbers (e.g.,
   7673      ‘v1.2.3-custom.1’), you can set the ‘magit-release-tag-regexp’ and
   7674      ‘magit-tag-version-regexp-alist’ variables.
   7675 
   7676      If ‘--annotate’ is enabled then it prompts for the message of the
   7677      new tag.  The proposed tag message is based on the message of the
   7678      highest tag, provided that that contains the corresponding version
   7679      string and substituting the new version string for that.  Otherwise
   7680      it proposes something like "Foo-Bar 1.2.3", given, for example, a
   7681      TAG "v1.2.3" and a repository located at something like
   7682      "/path/to/foo-bar".
   7683 
   7684 ‘t k’     (‘magit-tag-delete’)
   7685 
   7686      This command deletes one or more tags.  If the region marks
   7687      multiple tags (and nothing else), then it offers to delete those.
   7688      Otherwise, it prompts for a single tag to be deleted, defaulting to
   7689      the tag at point.
   7690 
   7691 ‘t p’     (‘magit-tag-prune’)
   7692 
   7693      This command offers to delete tags missing locally from REMOTE, and
   7694      vice versa.
   7695 
   7696 
   7697 File: magit.info,  Node: Notes,  Next: Submodules,  Prev: Tagging,  Up: Miscellaneous
   7698 
   7699 8.2 Notes
   7700 =========
   7701 
   7702 Also see *note (gitman)git-notes::.
   7703 
   7704 ‘T’     (‘magit-notes’)
   7705 
   7706      This transient prefix command binds the following suffix commands
   7707      along with the appropriate infix arguments and displays them in a
   7708      temporary buffer until a suffix is invoked.
   7709 
   7710 ‘T T’     (‘magit-notes-edit’)
   7711 
   7712      Edit the note attached to a commit, defaulting to the commit at
   7713      point.
   7714 
   7715      By default use the value of Git variable ‘core.notesRef’ or
   7716      "refs/notes/commits" if that is undefined.
   7717 
   7718 ‘T r’     (‘magit-notes-remove’)
   7719 
   7720      Remove the note attached to a commit, defaulting to the commit at
   7721      point.
   7722 
   7723      By default use the value of Git variable ‘core.notesRef’ or
   7724      "refs/notes/commits" if that is undefined.
   7725 
   7726 ‘T p’     (‘magit-notes-prune’)
   7727 
   7728      Remove notes about unreachable commits.
   7729 
   7730    It is possible to merge one note ref into another.  That may result
   7731 in conflicts which have to resolved in the temporary worktree
   7732 ".git/NOTES_MERGE_WORKTREE".
   7733 
   7734 ‘T m’     (‘magit-notes-merge’)
   7735 
   7736      Merge the notes of a ref read from the user into the current notes
   7737      ref.  The current notes ref is the value of Git variable
   7738      ‘core.notesRef’ or "refs/notes/commits" if that is undefined.
   7739 
   7740    When a notes merge is in progress then the transient features the
   7741 following suffix commands, instead of those listed above.
   7742 
   7743 ‘T c’     (‘magit-notes-merge-commit’)
   7744 
   7745      Commit the current notes ref merge, after manually resolving
   7746      conflicts.
   7747 
   7748 ‘T a’     (‘magit-notes-merge-abort’)
   7749 
   7750      Abort the current notes ref merge.
   7751 
   7752    The following variables control what notes reference ‘magit-notes-*’,
   7753 ‘git notes’ and ‘git show’ act on and display.  Both the local and
   7754 global values are displayed and can be modified.
   7755 
   7756  -- Variable: core.notesRef
   7757 
   7758      This variable specifies the notes ref that is displayed by default
   7759      and which commands act on by default.
   7760 
   7761  -- Variable: notes.displayRef
   7762 
   7763      This variable specifies additional notes ref to be displayed in
   7764      addition to the ref specified by ‘core.notesRef’.  It can have
   7765      multiple values and may end with ‘*’ to display all refs in the
   7766      ‘refs/notes/’ namespace (or ‘**’ if some names contain slashes).
   7767