Merge pull request #1387 from davvid/remote-dialog
[git-cola.git] / docs / git-cola.rst
blob7320d180c9402db9f737d6b891fe66ebe82d457e
1 ========
2 git-cola
3 ========
5 SYNOPSIS
6 ========
7 ``git cola [options] [sub-command]``
10 DESCRIPTION
11 ===========
12 Git Cola is a sleek and powerful Git GUI.
15 OPTIONS
16 =======
17 ``--amend``
18 -----------
19 Start `git cola` in amend mode.
21 ``--prompt``
22 ------------
23 Prompt for a Git repository.  Defaults to the current directory.
25 ``-r, --repo <path>``
26 ---------------------
27 Open the Git repository at `<path>`.  Defaults to the current directory.
29 ``-s, --status-filter <filter>``
30 --------------------------------
31 Apply the path filter to the status widget.
33 ``--version``
34 -------------
35 Print the `git cola` version and exit.
37 ``-h, --help``
38 --------------
39 Show usage and optional arguments.
41 ``--help-commands``
42 -------------------
43 Show available sub-commands.
46 SUB-COMMANDS
47 ============
50 Apply patches.
52 archive
53 -------
54 Export tarballs from Git.
56 branch
57 ------
58 Create branches.
60 browse
61 ------
62 Browse tracked files.
64 config
65 ------
66 Configure settings.
68 dag
69 ---
70 Start the `git dag` Git history browser.
72 diff
73 ----
74 Diff changed files.
76 fetch
77 -----
78 Fetch history from remote repositories.
80 grep
81 ----
82 Use `git grep` to search for content.
84 merge
85 -----
86 Merge branches.
88 pull
89 ----
90 Fetch and merge remote branches.
92 push
93 ----
94 Push branches to remotes.
96 rebase
97 ------
98 Start an interactive rebase.
100 remote
101 ------
102 Create and edit remotes.
104 search
105 ------
106 Search for commits.
108 stash
109 -----
110 Stash uncommitted modifications.
114 Create tags.
116 version
117 -------
118 Print the `git cola` version.
121 CONFIGURE YOUR EDITOR
122 =====================
123 The editor used by `Ctrl-e` is configured from the Preferences screen.
125 The following environment variables are consulted when no editor is configured.
126 If defined, the first of these variables is used:
128 * `GIT_VISUAL`
129 * `VISUAL`
130 * `GIT_EDITOR`
131 * `EDITOR`
133 The `*VISUAL` variables are consulted before the `*EDITOR` variables so that you can
134 configure a graphical editor independently of the editor used by the Git CLI.
136 *Pro Tip*: Configuring your editor to `gvim -f -p` will open multiple tabs
137 when editing files.  `gvim -f -o` uses splits.
139 `git cola` is {vim, emacs, textpad, notepad++}-aware.
140 When you select a line in the diff or grep screens and press any of
141 `Enter`, `Ctrl-e`, or the `Edit` button, you are taken to that exact line.
143 The editor preference is saved in the `gui.editor` variable using
144 `git config <https://git-scm.com/docs/git-config>`_.
146 The following are some recommend editor configurations.
148 * Neovim + Neovim-Qt
150 .. sourcecode:: sh
152    git config --global core.editor nvim
153    git config --global gui.editor 'nvim-qt --nofork'
155 * Vim + gvim
157 .. sourcecode:: sh
159    git config --global core.editor vim
160    git config --global gui.editor 'gvim -f'
162 * Sublime Text
164 .. sourcecode:: sh
166    git config --global gui.editor 'subl --wait'
169 KEYBOARD SHORTCUTS
170 ==================
171 `git cola` has many useful keyboard shortcuts.
173 Many of `git cola`'s editors understand vim-style hotkeys, e.g. `{h,j,k,l}`
174 for navigating in the diff, status, grep, and file browser widgets.
176 `{d,u}` move down/up one half page at a time (similar to vim's `ctrl-{d,u}`).
177 The `space` and `shift-space` hotkeys are mapped to the same operations.
179 `Shift-{j,k,d,u,f,b,page-up,page-down,left,right,up,down}` can be be used in
180 the diff editor to select lines while navigating.
182 `s` is a useful hotkey in the diff editor.  It stages/unstages the current
183 selection when a selection is present.  When nothing is selected, the
184 diff hunk at the current text cursor position is staged.  This makes it very
185 easy to review changes by selecting good hunks with `s` while navigating down
186 and over hunks that are not going to be staged.
188 `Ctrl-u` in the diff editor reverts unstaged edits, and respects the
189 selection.  This is useful for selectively reverted edits from the worktree.
190 This same hotkey reverts the entire file when used from the status tool.
192 `Ctrl-s` in the diff editor and status tools stages/unstages the entire file.
194 You can see the available shortcuts by pressing pressing the ``?`` key,
195 choosing ``Help -> Keyboard shortcuts`` from the main menu,
196 or by consulting the `git cola keyboard shortcuts reference <https://git-cola.github.io/share/doc/git-cola/hotkeys.html>`_.
199 TOOLS
200 =====
201 The `git cola` interface is composed of various cooperating tools.
202 Double-clicking a tool opens it in its own subwindow.
203 Dragging it around moves and places it within the main window.
205 Tools can be hidden and rearranged however you like.
206 `git cola` carefully remembers your window layout and restores
207 it the next time it is launched.
209 The `Control-{1, 2, 3, ...}` hotkey gives focus to a specific tool.
210 A hidden tool can be re-opened using the `Tools` menu or
211 the `Shift+Control-{1, 2, 3, ...}` shortcut keys.
213 The Diff editor can be focused with `Ctrl-j`.
214 The Status tool can be focused with `Ctrl-k`.
215 The Commit tool can be focused with `Ctrl-l`.
218 .. _status:
220 STATUS
221 ======
222 The `Status` tool provides a visual analog to the
223 `git status <https://git-scm.com/docs/git-status>`_ command.
225 `Status` displays files that are `modified` relative to the staging area,
226 `staged` for the next commit, `unmerged` files from an in-progress merge,
227 and files that are `untracked` to git.
229 These are the same categories one sees when running
230 `git status <https://git-scm.com/docs/git-status>`_
231 on the command line.
233 You can navigate through the list of files using keyboard arrows as well
234 as the ergonomic and vim-like `j` and `k` shortcut keys.
236 There are several convenient ways to interact with files in the `Status` tool.
238 Selecting a file displays its diff in the `Diff` viewer.
239 Double-clicking a file stages its contents, as does the `Ctrl-s` shortcut key.
241 `Ctrl-e` opens selected files in the configured editor, and
242 `Ctrl-d` opens selected files using `git difftool <https://git-scm.com/docs/git-difftool>`_
244 Additional actions can be performed using the right-click context menu.
246 Drag and Drop
247 -------------
248 Files can be dragged from the `Status` tool onto other applications.
250 Some terminals will treat a drag with multiple files by separating them with newlines,
251 which is less amenable for pasting command-line arguments.
253 To avoid this issue, hold down `Alt / Option` when dragging from the `Status` tool.
254 The drag and drop payload will no longer contain local file URLs -- it will contain
255 plain text that is amenable for use on a command-line.
257 Note: if drag and drop is not working and you are on Wayland then you may
258 need to ``export QT_QPA_PLATFORM=wayland`` in your environment.
260 Actions
261 -------
262 Clicking the `Staged` folder shows a diffstat for the index.
264 Clicking the `Modified` folder shows a diffstat for the worktree.
266 Clicking individual files sends diffs to the `Diff Display`.
268 Double-clicking individual files adds and removes their content from the index.
270 Various actions are available through the right-click context menu.
271 Different actions are available depending a file's status.
273 Stage Selected
274 ~~~~~~~~~~~~~~
275 Add to the staging area using `git add <https://git-scm.com/docs/git-add>`_
276 Marks unmerged files as resolved.
278 Launch Editor
279 ~~~~~~~~~~~~~
280 Launches the configured visual text editor
282 Launch Difftool
283 ~~~~~~~~~~~~~~~
284 Visualize changes using `git difftool`.
286 Revert Unstaged Edits
287 ~~~~~~~~~~~~~~~~~~~~~
288 Reverts unstaged content by checking out selected paths
289 from the index/staging area
291 Revert Uncommitted Edits
292 ~~~~~~~~~~~~~~~~~~~~~~~~
293 Throws away uncommitted edits
295 Unstage Selected
296 ~~~~~~~~~~~~~~~~
297 Remove from the index/staging area with
298 `git reset <https://git-scm.com/docs/git-reset>`_
300 Launch Merge Tool
301 ~~~~~~~~~~~~~~~~~
302 Resolve conflicts using `git mergetool <https://git-scm.com/docs/git-mergetool>`_.
304 Delete File(s)
305 ~~~~~~~~~~~~~~
306 Delete untracked files from the filesystem.
308 Add to .gitignore
309 ~~~~~~~~~~~~~~~~~
310 Adds untracked files to to the .gitignore file.
313 .. _diff:
315 DIFF
316 ====
317 The diff viewer/editor displays diffs for selected files.
318 Additions are shown in green and removals are displayed in light red.
319 Extraneous whitespace is shown with a pure-red background.
321 Right-clicking in the diff provides access to additional actions
322 that use either the cursor location or text selection.
324 The "Copy Diff" action at ``Alt + Shift + C`` copies the selected lines to the
325 clipboard. The ``+``, ``-`` and `` `` diff line prefixes are stripped from each line
326 when copying diffs using the "Copy Diff" action.
328 Staging content for commit
329 --------------------------
330 The ``@@`` patterns denote a new diff hunk.  Selecting lines of diff
331 and using the `Stage Selected Lines` command will stage just the selected
332 lines.  Clicking within a diff hunk and selecting `Stage Diff Hunk` stages the
333 entire patch diff hunk.
335 The corresponding opposite commands can be performed on staged files as well,
336 e.g. staged content can be selectively removed from the index when we are
337 viewing diffs for staged content.
339 Diff Against Commit (Diff Mode)
340 -------------------------------
341 *Diff Mode* allows you to selectively unstage and revert edits from arbitrary commits
342 so that you can bring these edits back into your worktree.
344 You can use the diff editor to unstage edits against arbitrary commits by using the
345 ``Diff > Against Commit... (Diff Mode)`` menu action.
347 You can exit *Diff Mode* by clicking on the red circle-slash icon on the Status
348 widget, by using the ``Diff > Exit Diff mode`` menu action, or by clicking in
349 an empty area in the `Status` tool.
352 COMMIT MESSAGE EDITOR
353 =====================
354 The commit message editor is a simple text widget
355 for entering commit messages.
357 You can navigate between the `Subject` and `Extended description...`
358 fields using the keyboard arrow keys.
360 Pressing enter when inside the `Subject` field jumps down to the
361 extended description field.
363 The `Options` button menu to the left of the subject field
364 provides access to the additional actions.
366 The `Ctrl+i` keyboard shortcut adds a standard "Signed-off-by: " line,
367 and `Ctrl+Enter` creates a new commit using the commit message and
368 staged content.
370 Sign Off
371 --------
372 The `Sign Off` button adds a sign-off to the bottom of the commit message::
374     Signed-off-by: A. U. Thor <a.u.thor@example.com>
376 Invoking this action is equivalent to passing the ``-s`` option
377 to `git commit <https://git-scm.com/docs/git-commit>`_.
379 Signing-off on commits is a common practice in projects that use
380 `Developer Certificate of Origin <https://developercertificate.org/>`_
381 attestations in their contribution process.
383 Commit
384 ------
385 The commit button runs
386 `git commit <https://git-scm.com/docs/git-commit>`_.
387 The contents of the commit message editor is provided as the commit message.
389 Only staged files are included in the commit -- this is the same behavior
390 as running ``git commit`` on the command-line.
392 Line and Column Display
393 -----------------------
394 The current line and column number is displayed by the editor.
395 E.g. a ``5,0`` display means that the cursor is located at
396 line five, column zero.
398 The display changes colors when lines get too long.
399 Yellow indicates the safe boundary for sending patches to a mailing list
400 while keeping space for inline reply markers.
402 Orange indicates that the line is starting to run a bit long and should
403 break soon.
405 Red indicates that the line is running up against the standard
406 80-column limit for commit messages.
408 Keeping commit messages less than 76-characters wide is encouraged.
409 `git log <https://git-scm.com/docs/git-log>`_
410 is a great tool but long lines mess up its formatting for everyone else,
411 so please be mindful when writing commit messages.
413 Amend Last Commit
414 -----------------
415 Clicking on `Amend Last Commit` makes `git cola` amend the previous commit
416 instead of creating a new one.  `git cola` loads the previous commit message
417 into the commit message editor when this option is selected.
419 The `Status` tool will display all of the changes for the amended commit.
421 Create Signed Commit
422 --------------------
423 Tell `git commit` and `git merge` to sign commits using GPG.
425 Using this option is equivalent to passing the ``--gpg-sign`` option to
426 `git commit <https://git-scm.com/docs/git-commit>`_ and
427 `git merge <https://git-scm.com/docs/git-merge>`_.
429 This option's default value can be configured using the `cola.signcommits`
430 configuration variable.
432 Prepare Commit Message
433 ----------------------
434 The ``Commit -> Prepare Commit Message`` action or `Ctrl-Shift-Return` keyboard shortcut
435 runs the `cola-prepare-commit-msg` hook if it is available in `.git/hooks/`.
436 This is a `git cola`-specific hook that takes the same parameters
437 as Git's `prepare-commit-msg hook <https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks>`_
439 The hook is passed the path to `.git/GIT_COLA_MSG` as the first argument and the hook is expected to write
440 an updated commit message to specified path.  After running this action, the
441 commit message editor is updated with the new commit message.
443 To override the default path to this hook set the
444 `cola.prepareCommitMessageHook` `git config` variable to the path to the
445 hook script.  This is useful if you would like to use a common hook
446 across all repositories.
449 BRANCHES
450 ========
451 The `Branches` tool provides a visual tree to navigate branches.
452 The tree has three main sections: `Local Branches`, `Remote Branches` and `Tags`.
453 Branches are grouped by their name divided by the character ``/``.
454 For example, in a repo with the following list of branches::
456     branch/feature/foo
457     branch/feature/bar
458     branch/doe
460 The branches widget will display the following hierarchy::
462     branch
463         - doe
464         + feature
465             - bar
466             - foo
468 The current branch is decorated with a star icon.
469 If the current branch has commits ahead or behind the remote then an up or down
470 arrow will be displayed alongside a number showing the number of commits.
472 Actions
473 -------
474 Various actions are available through the right-click context menu.
475 Different actions are available depending on the selected branch's status.
477 Checkout
478 ~~~~~~~~
479 The checkout action runs
480 `git checkout [<branchname>] <https://git-scm.com/docs/git-checkout>`_.
482 Merge into current branch
483 ~~~~~~~~~~~~~~~~~~~~~~~~~
484 The merge action runs
485 `git merge --no-commit [<branchname>] <https://git-scm.com/docs/git-merge>`_.
487 Pull
488 ~~~~
489 The pull action runs
490 `git pull --no-ff [<remote>] [<branchname>] <https://git-scm.com/docs/git-pull>`_.
492 Push
493 ~~~~
494 The push action runs
495 `git push [<remote>] [<branchname>] <https://git-scm.com/docs/git-push>`_.
497 Rename Branch
498 ~~~~~~~~~~~~~
499 The rename branch action runs
500 `git branch -M [<branchname>] <https://git-scm.com/docs/git-push>`_.
502 Delete Branch
503 ~~~~~~~~~~~~~
504 The delete branch branch action runs
505 `git branch -D [<branchname>] <https://git-scm.com/docs/git-branch>`_.
507 Delete Remote Branch
508 ~~~~~~~~~~~~~~~~~~~~
509 The remote branch action runs
510 `git push --delete [<remote>] [<branchname>] <https://git-scm.com/docs/git-push>`_.
513 APPLY PATCHES
514 =============
515 Use the ``File -> Apply Patches`` menu item to begin applying patches.
517 Dragging and dropping patches onto the `git cola` interface
518 adds the patches to the list of patches to apply using
519 `git am <https://git-scm.com/docs/git-am>`_.
521 You can drag either a set of patches or a directory containing patches.
522 Patches can be sorted using in the interface and are applied in the
523 same order as is listed in the list.
525 When a directory is dropped `git cola` walks the directory
526 tree in search of patches.  `git cola` sorts the list of
527 patches after they have all been found.  This allows you
528 to control the order in which patches are applied by placing
529 patch sets into alphanumerically-sorted directories.
532 CUSTOM WINDOW SETTINGS
533 ======================
534 `git cola` remembers modifications to the layout and arrangement
535 of tools within the `git cola` interface.  Changes are saved
536 and restored at application shutdown/startup.
538 `git cola` can be configured to not save custom layouts by disabling
539 the `Save Window Settings` option in the `git cola` preferences.
542 DARK MODE AND WINDOW MANAGER THEMES
543 ===================================
544 Git Cola contains a ``default`` theme which follows the current Qt style and a
545 handful of built-in color themes.  See :ref:`cola_theme` for more details.
547 To use icons appropriate for a dark application theme, configure
548 ``git config --global cola.icontheme dark`` to use the dark icon theme.
549 See :ref:`cola_icontheme` for more details.
551 On macOS, using the ``default`` theme will automatically inherit "Dark Mode"
552 color themes when configured via System Preferences.  You will need to
553 configure the dark icon theme as noted above when dark mode is enabled.
555 On Linux, you may want Qt to follow the Window manager theme by configuring it
556 to do so using the ``qt5ct`` Qt5 configuration tool.  Install ``qt5ct`` on
557 Debian/Ubuntu systems to make this work.::
559     sudo apt install qt5ct
561 Once installed, update your `~/.bash_profile` to activate ``qt5ct``::
563     # Use the style configured using the qt5ct tool
564     export QT_QPA_PLATFORMTHEME=qt5ct
566 This only work with the `default` theme.  The other themes replace the color
567 palette with theme-specific colors.
569 Some systems may require that you override `QT_STYLE_OVERRIDE` in order to
570 use a dark theme or to better interact with the Desktop environment.
571 Some systems provide a theme that you can install::
573     sudo apt-get install adwaita-qt
575 You can activate the theme using the following environment variable::
577     # Override the default theme to adwaita-dark
578     export QT_STYLE_OVERRIDE=adwaita-dark
580 `QT_STYLE_OVERRIDE` may already be set in your Desktop Environment, so check that
581 variable for reference if you get unexpected hangs when launching `git-cola` or
582 when the default theme does not follow the desktop's theme on Linux.
584 If you don't want to set this variable globally then you can set it when launching
585 cola from the command-line::
587     QT_STYLE_OVERRIDE=adwaita-dark git cola
589 The following is a user-contributed custom `git-cola.desktop` file that can be used to
590 launch Git Cola with these settings preset for you::
592     [Desktop Entry]
593     Name=Git Cola (dark)
594     Comment=The highly caffeinated Git GUI
595     TryExec=git-cola
596     Exec=env QT_STYLE_OVERRIDE=adwaita-dark git-cola --prompt --icon-theme dark
597     Icon=git-cola
598     StartupNotify=true
599     Terminal=false
600     Type=Application
601     Categories=Development;RevisionControl;
602     X-KDE-SubstituteUID=false
604 You may also want to customize the diff colors when using a dark theme::
606     git config --global cola.color.add 86c19f
607     git config --global cola.color.remove c07067
609 Please see `#760 <https://github.com/git-cola/git-cola/issues/760>`_ for more details.
611 Custom Themes
612 -------------
613 To create your own custom theme for Git Cola just create a QSS file and put it in
614 ``~/.config/themes/``. You can add as many files as you want. Each file will become
615 an option in ``Menu -> File -> Preferences -> Appearance -> GUI theme``.
617 Some examples can be found here `Qt Style Sheets Examples <https://doc.qt.io/qt-5/stylesheet-examples.html>`_.
620 CONFIGURATION VARIABLES
621 =======================
622 These variables can be set using `git config` or from the settings.
624 cola.autocompletepaths
625 ----------------------
626 Set to `false` to disable auto-completion of filenames in completion widgets.
627 This can speed up operations when working in large repositories.
628 Defaults to `true`.
630 cola.autoloadCommitTemplate
631 ---------------------------
632 Set to `true` to automatically load the commit template in the commit message
633 editor If the commit.template variable has not been configured, raise the
634 corresponding error.
635 Defaults to `false`.
637 cola.blameviewer
638 ----------------
639 The command used to blame files.  Defaults to `git gui blame`.
641 cola.blockcursor
642 ----------------
643 Whether to use a "block" cursor in diff editors. The block cursor is easier to
644 see compared to a line cursor. Set to `false` to use a thin "line" cursor.
645 Defaults to `true`.
647 cola.browserdockable
648 --------------------
649 Whether to create a dock widget with the `Browser` tool.
650 Defaults to `false` to speedup startup time.
652 cola.checkconflicts
653 -------------------
654 Inspect unmerged files for conflict markers before staging them.
655 This feature helps prevent accidental staging of unresolved merge conflicts.
656 Defaults to `true`.
658 cola.defaultrepo
659 ----------------
660 `git cola`, when run outside of a Git repository, prompts the user for a
661 repository.  Set `cola.defaultrepo` to the path of a Git repository to make
662 `git cola` attempt to use that repository before falling back to prompting
663 the user for a repository.
665 cola.dictionary
666 ---------------
667 Specifies an additional dictionary for `git cola` to use in its spell checker.
668 This should be configured to the path of a newline-separated list of words.
670 By default, `git cola` searches for `dict/words` and `dict/propernames` dictionary
671 files in `~/.local/share` and `$XDG_DATA_DIRS`.
673 If `$XDG_DATA_DIRS` is undefined or set to an empty value then `/usr/local/share` and
674 `/usr/share` are searched for dictionary files.
676 Dictionary files are newline-separated and contain one word per line.
678 cola.expandtab
679 --------------
680 Expand tabs into spaces in the commit message editor.  When set to `true`,
681 `git cola` will insert a configurable number of spaces when tab is pressed.
682 The number of spaces is determined by `cola.tabwidth`.
683 Defaults to `false`.
685 cola.gravatar
686 -------------
687 Use the `gravatar.com` service to lookup icons for author emails.
688 Gravatar icons work by sending an MD5 hash of an author's email to `gravatar.com`
689 when requesting an icon. Warning: this feature can leak information.
690 Network requests to `gravatar.com` are disabled when set to `false`.
691 Defaults to `true`.
693 cola.fileattributes
694 -------------------
695 Enables per-file gitattributes encoding and binary file support.
696 This tells `git cola` to honor the configured encoding when displaying
697 and applying diffs.
699 A `.gitattributes` file can set the ``binary`` attribute in order to force
700 specific untracked paths to be treated as binary files when diffing.
701 Binary files are displayed using a hex-dump display.
703 .. sourcecode:: sh
705    # Treat *.exr files as binary files.
706    *.exr binary
708 cola.fontdiff
709 -------------
710 Specifies the font to use for `git cola`'s diff display.
712 cola.hidpi
713 ----------
714 Specifies the High DPI displays scale factor. Set `0` to automatically scaled.
715 Setting value between 0 and 1 is undefined.
716 This option requires at least Qt 5.6 to work.
717 See `Qt QT_SCALE_FACTOR documentation <https://doc.qt.io/qt-5/highdpi.html>`_
718 for more information.
720 .. _cola_icontheme:
722 cola.icontheme
723 --------------
724 Specifies the icon themes to use throughout `git cola`. The theme specified
725 must be the name of the subdirectory containing the icons, which in turn must
726 be placed in the inside the main "icons" directory in `git cola`'s
727 installation prefix.
729 If unset, or set either "light" or "default", then the default style will be
730 used.  If set to "dark" then the built-in "dark" icon theme, which is
731 suitable for a dark window manager theme, will be used.
733 If set to an absolute directory path then icons in that directory will be used.
734 This value can be set to multiple values using,
735 ``git config --add cola.icontheme $theme``.
737 This setting can be overridden by the `GIT_COLA_ICON_THEME` environment
738 variable, which can specify multiple themes using a colon-separated value.
740 The icon theme can also be specified by passing ``--icon-theme=<theme>`` on the
741 command line, once for each icon theme, in the order that they should be
742 searched.  This can be used to override a subset of the icons, and fallback
743 to the built-in icons for the remainder.
745 cola.imagediff.[extension]
746 --------------------------
747 Enable image diffs for the specified file extension.  For example, configuring
748 `git config --global cola.imagediff.svg false` will disable use of the visual
749 image diff for `.svg` files in all repos until is is explicitly toggled on.
750 Defaults to `true`.
752 cola.inotify
753 ------------
754 Set to `false` to disable file system change monitoring.  Defaults to `true`,
755 but also requires either Linux with inotify support or Windows with `pywin32`
756 installed for file system change monitoring to actually function.
758 cola.refreshonfocus
759 -------------------
760 Set to `true` to automatically refresh when `git cola` gains focus.  Defaults
761 to `false` because this can cause a pause whenever switching to `git cola` from
762 another application.
764 cola.linebreak
765 --------------
766 Whether to automatically break long lines while editing commit messages.
767 Defaults to `true`.  This setting is configured using the `Preferences`
768 dialog, but it can be toggled for one-off usage using the commit message
769 editor's options sub-menu.
771 cola.logdate
772 ------------
773 Set the default date-time mode for the DAG display. This value is
774 passed to `git log --date=<format>`.
775 See `git log(1) <https://git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt>`_
776 for more details.
778 cola.maxrecent
779 --------------
780 `git cola` caps the number of recent repositories to avoid cluttering
781 the start and recent repositories menu.  The maximum number of repositories to
782 remember is controlled by `cola.maxrecent` and defaults to `8`.
784 cola.mousezoom
785 --------------
786 Controls whether zooming text using Ctrl + MouseWheel scroll is enabled.
787 Set to ``false`` to disable scrolling with the mouse wheel.
788 Defaults to ``true``.
790 cola.dragencoding
791 -----------------
792 `git cola` encodes paths dragged from its widgets into `utf-16` when adding
793 them to the drag-and-drop mime data (specifically, the `text/x-moz-url` entry).
794 `utf-16` is used to make `gnome-terminal` see the right paths, but other
795 terminals may expect a different encoding.  If you are using a terminal that
796 expects a modern encoding, e.g. `terminator`, then set this value to `utf-8`.
798 cola.readsize
799 -------------
800 `git cola` avoids reading large binary untracked files.
801 The maximum size to read is controlled by `cola.readsize`
802 and defaults to `2048`.
804 cola.resizebrowsercolumns
805 -------------------------
806 `git cola` will automatically resize the file browser columns as folders are
807 expanded/collapsed when ``cola.resizebrowsercolumns`` is set to `true`.
809 cola.patchesdirectory
810 ---------------------
811 The default directory to use when exporting patches. Relative paths are treated
812 as being relative to the current repository. Absolute paths are used as-is.
813 Defaults to `patches`.
815 cola.safemode
816 -------------
817 The "Stage" button in the `git cola` Actions panel stages all files when it is
818 activated and no files are selected.  This can be problematic if it is
819 accidentally triggered after carefully preparing the index with staged
820 changes.  "Safe Mode" is enabled by setting `cola.safemode` to `true`.
821 When enabled, `git cola` will do nothing when "Stage" is activated without a
822 selection.  Defaults to `false`.
824 cola.savewindowsettings
825 -----------------------
826 `git cola` will remember its window settings when set to `true`.
827 Window settings and X11 sessions are saved in `$HOME/.config/git-cola`.
829 cola.showpath
830 -------------
831 `git cola` displays the absolute path of the repository in the window title.
832 This can be disabled by setting `cola.showpath` to `false`.
833 Defaults to `true`.
835 cola.signcommits
836 ----------------
837 `git cola` will sign commits by default when set `true`. Defaults to `false`.
838 See the section below on setting up GPG for more details.
840 cola.startupmode
841 ----------------
842 Control how the list of repositories is displayed in the startup dialog.
843 Set to `list` to view the list of repositories as a list, or `folder` to view
844 the list of repositories as a collection of folder icons.
845 Defaults to `list`.
847 cola.statusindent
848 -----------------
849 Set to `true` to indent files in the Status widget.  Files in the `Staged`,
850 `Modified`, etc. categories will be grouped in a tree-like structure.
851 Defaults to `false`.
853 cola.statusshowtotals
854 ---------------------
855 Set to `true` to display files counts in the Status widget's category titles.
856 Defaults to `false`.
858 cola.tabwidth
859 -------------
860 The number of columns occupied by a tab character.  Defaults to 8.
862 cola.terminal
863 -------------
864 The command to use when launching commands within a graphical terminal.
866 `cola.terminal` defaults to `xterm -e` when unset.
867 e.g. when opening a shell, `git cola` will run `xterm -e $SHELL`.
869 `git cola` has built-in support for `xterm`, `gnome-terminal`, `konsole`.
870 If either `gnome-terminal`, `xfce4-terminal`, or `konsole` are installed
871 then they will be preferred over `xterm` when `cola.terminal` is unset.
873 The table below shows the built-in values that are used for the respective
874 terminal.  You can force the use of a specific terminal by configuring cola
875 accordingly.
877 cola.terminalshellquote
878 -----------------------
879 Some terminal require that the command string get passed as a string.
880 For example, ``xfce4-terminal -e "git difftool"`` requires shell quoting,
881 whereas ``gnome-terminal -- git difftool`` does not.
883 You should not need to set this variable for the built-in terminals
884 cola knows about -- it will behave correctly without configuration.
885 For example, when not configured, cola already knows that xfce4-terminal
886 requires shell quoting.
888 This configuration variable is for custom terminals outside of the builtin set.
889 The table below shows the builtin configuration.
891 .. code-block:: text
893     Terminal            cola.terminal           cola.terminalshellquote
894     --------            -------------           -----------------------
895     gnome-terminal      "gnome-terminal --"     false
896     konsole             "konsole -e"            false
897     xfce4-terminal      "xfce4-terminal -e"     true
898     xterm               "xterm -e"              false
901 cola.textwidth
902 --------------
903 The number of columns used for line wrapping.
904 Tabs are counted according to `cola.tabwidth`.
906 .. _cola_theme:
908 cola.theme
909 ----------
910 Specifies the GUI theme to use throughout `git cola`. The theme specified
911 must be one of the following values:
913 * `default` â€“ default Qt theme, may appear different on various systems
914 * `flat-dark-blue`
915 * `flat-dark-green`
916 * `flat-dark-grey`
917 * `flat-dark-red`
918 * `flat-light-blue`
919 * `flat-light-green`
920 * `flat-light-grey`
921 * `flat-light-red`
923 If unset, or set to an invalid value, then the default style will be
924 used. The `default` theme is generated by Qt internal engine and should look
925 native but may look noticeably different on different platforms. The flat
926 themes on the other hand should look similar (but not identical) on various
927 systems.
929 The GUI theme can also be specified by passing ``--theme=<name>`` on the
930 command line.
932 cola.turbo
933 ----------
934 Set to `true` to enable "turbo" mode.  "Turbo" mode disables some
935 features that can slow things down when operating on huge repositories.
936 "Turbo" mode will skip loading Git commit messages, author details, status
937 information, and commit date details in the `File Browser` tool.
938 Defaults to `false`.
940 cola.color.text
941 ---------------
942 The default diff text color, in hexadecimal #RRGGBB notation.
943 Defaults to "#030303"::
945     git config cola.color.text '#030303'
947 cola.color.add
948 --------------
949 The default diff "add" background color, in hexadecimal #RRGGBB notation.
950 Defaults to "#d2ffe4"::
952     git config cola.color.add '#d2ffe4'
954 cola.color.remove
955 -----------------
956 The default diff "remove" background color, in hexadecimal #RRGGBB notation.
957 Defaults to "#fee0e4"::
959     git config cola.color.remove '#fee0e4'
961 cola.color.header
962 -----------------
963 The default diff header text color, in hexadecimal #RRGGBB notation.
964 Defaults to "#bbbbbb"::
966     git config cola.color.header '#bbbbbb'
968 commit.cleanup
969 --------------
970 Configure whether commit messages should be stripped of whitespace and comments.
972 Valid values are ``strip``, ``whitespace``, ``verbatim``, ``scissors`` or ``default``.
974 The ``default`` mode uses the ``whitespace`` mode when committing through Git Cola
975 and the ``strip`` mode when committing using the ``git commit`` command-line.
977 * ``strip`` - Strip leading and trailing empty lines, trailing whitespace,
978   commentary and collapse consecutive empty lines.
980 * ``whitespace`` - Same as strip except ``# commentary`` is not removed.
981   This is the ``default`` behavior when committing through `Git Cola`.
983 * ``verbatim`` - Do not change the message at all.
985 * ``scissors`` - Same as whitespace except that everything from (and including)
986   the line found below is truncated, if the message is to be edited.
987   "#" can be customized with ``core.commentChar``::
989     # ------------------------ >8 ------------------------
990     Scissor-lines and all following lines are removed.
992 Changing the mode to ``whitespace`` can be useful when you always want to keep
993 lines that begin with comment character ``#`` in your log message, even when
994 committing using the command-line ``git commit``.
996 On the contrary, if you always want to always strip comments, even when
997 committing through Git Cola, then configure ``commit.cleanup`` to ``strip``.
999 Please see the `git commit cleanup mode documentation
1000 <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---cleanupltmodegt>`_
1001 for more details.
1003 core.commentChar
1004 ----------------
1005 Commit messages can contain comments that start with this character.
1006 Defaults to ``#``.
1008 Please see the `git config documentation
1009 <https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar>`_
1010 for more details.
1012 core.hooksPath
1013 --------------
1014 Hooks are programs you can place in a hooks directory to trigger actions at
1015 certain points in git’s execution. Hooks that don’t have the executable bit
1016 set are ignored.
1018 By default the hooks directory is ``$GIT_DIR/hooks``, but that can
1019 be changed via the ``core.hooksPath`` configuration variable
1021 The ``cola-prepare-commit-msg`` hook functionality and Cola's Git LFS
1022 detection honors this configuration.
1024 Please see the `git hooks documentation <https://git-scm.com/docs/githooks>`_
1025 for more details.
1027 gui.diffcontext
1028 ---------------
1029 The number of diff context lines to display.
1031 gui.displayuntracked
1032 --------------------
1033 `git cola` avoids showing untracked files when set to `false`.
1035 gui.editor
1036 ----------
1037 The default text editor to use is defined in `gui.editor`.
1038 The config variable overrides the VISUAL environment variable.
1039 Defaults to `gvim -f -p`.
1041 gui.historybrowser
1042 ------------------
1043 The history browser to use when visualizing history.
1044 Defaults to `gitk`.
1046 diff.tool
1047 ---------
1048 The default diff tool to use.
1050 merge.tool
1051 ----------
1052 The default merge tool to use.
1054 user.email
1055 ----------
1056 Your email address to be recorded in any newly created commits.
1057 Can be overridden by the 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_EMAIL', and
1058 'EMAIL' environment variables.
1060 user.name
1061 ---------
1062 Your full name to be recorded in any newly created commits.
1063 Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
1064 environment variables.
1067 ENVIRONMENT VARIABLES
1068 =====================
1070 GIT_COLA_ICON_THEME
1071 -------------------
1072 When set in the environment, `GIT_COLA_ICON_THEME` overrides the
1073 theme specified in the `cola.icontheme` configuration.
1074 Read :ref:`cola_icontheme` for more details.
1076 GIT_COLA_SCALE
1077 --------------
1078 .. Important:: `GIT_COLA_SCALE` should not be used with newer versions of Qt.
1080     Set `QT_AUTO_SCREEN_SCALE_FACTOR` to `1` and Qt will automatically
1081     scale the interface to the correct size based on the display DPI.
1082     This option is also available by setting `cola.hidpi` configuration.
1084     See the `Qt High DPI documentation <https://doc.qt.io/qt-5/highdpi.html>`_
1085     for more details.
1087 `git cola` can be made to scale its interface for HiDPI displays.
1088 When defined, `git cola` will scale icons, radio buttons, and checkboxes
1089 according to the scale factor.  The default value is `1`.
1090 A good value is `2` for high-resolution displays.
1092 Fonts are not scaled, as their size can already be set in the settings.
1094 GIT_COLA_TRACE
1095 --------------
1096 When defined, `git cola` logs `git` commands to stdout.
1097 When set to `full`, `git cola` also logs the exit status and output.
1098 When set to `trace`, `git cola` logs to the `Console` widget.
1100 VISUAL
1101 ------
1102 Specifies the default editor to use.
1103 This is ignored when the `gui.editor` configuration variable is defined.
1105 LANGUAGE SETTINGS
1106 =================
1107 `git cola` automatically detects your language and presents some
1108 translations when available.  This may not be desired, or you
1109 may want `git cola` to use a specific language.
1111 You can make `git cola` use an alternative language by creating a
1112 `~/.config/git-cola/language` file containing the standard two-letter
1113 gettext language code, e.g. "en", "de", "ja", "zh", etc.::
1115     mkdir -p ~/.config/git-cola &&
1116     echo en >~/.config/git-cola/language
1118 Alternatively you may also use LANGUAGE environmental variable to temporarily
1119 change `git cola`'s language just like any other gettext-based program.  For
1120 example to temporarily change `git cola`'s language to English::
1122     LANGUAGE=en git cola
1124 To make `git cola` use the zh_TW translation with zh_HK, zh, and en as a
1125 fallback.::
1127     LANGUAGE=zh_TW:zh_HK:zh:en git cola
1130 CUSTOM GUI ACTIONS
1131 ==================
1132 `git cola` allows you to define custom GUI actions by setting `git config`
1133 variables.  The "name" of the command appears in the "Actions" menu.
1135 guitool.<name>.cmd
1136 ------------------
1137 Specifies the shell command line to execute when the corresponding item of the
1138 Tools menu is invoked. This option is mandatory for every tool. The command is
1139 executed from the root of the working directory, and in the environment it
1140 receives the name of the tool as GIT_GUITOOL, the name of the currently
1141 selected file as FILENAME, and the name of the current branch as CUR_BRANCH
1142 (if the head is detached, CUR_BRANCH is empty).
1144 If ``<name>`` contains slashes (``/``) then the leading part of the name,
1145 up until the final slash, is treated like a path of sub-menus under which the
1146 actions will be created.
1148 For example, configuring ``guitool.Commands/Util/echo.cmd`` creates a
1149 ``Commands`` menu inside the top-level ``Actions`` menu, a ``Util`` menu
1150 inside the ``Commands`` menu and an ``echo`` action inside the ``Commands``
1151 sub-menu.
1153 guitool.<name>.background
1154 -------------------------
1155 Run the command in the background (similar to editing and difftool actions).
1156 This avoids blocking the GUI.  Setting `background` to `true` implies
1157 `noconsole` and `norescan`.
1159 guitool.<name>.needsfile
1160 ------------------------
1161 Run the tool only if a diff is selected in the GUI. It guarantees that
1162 FILENAME is not empty.
1164 guitool.<name>.noconsole
1165 ------------------------
1166 Run the command silently, without creating a window to display its output.
1168 guitool.<name>.norescan
1169 -----------------------
1170 Don’t rescan the working directory for changes after the tool finishes
1171 execution.
1173 guitool.<name>.confirm
1174 ----------------------
1175 Show a confirmation dialog before actually running the tool.
1177 guitool.<name>.argprompt
1178 ------------------------
1179 Request a string argument from the user, and pass it to the tool through the
1180 ARGS environment variable. Since requesting an argument implies confirmation,
1181 the confirm option has no effect if this is enabled. If the option is set to
1182 true, yes, or 1, the dialog uses a built-in generic prompt; otherwise the
1183 exact value of the variable is used.
1185 guitool.<name>.revprompt
1186 ------------------------
1187 Request a single valid revision from the user, and set the REVISION
1188 environment variable. In other aspects this option is similar to argprompt,
1189 and can be used together with it.
1191 guitool.<name>.revunmerged
1192 --------------------------
1193 Show only unmerged branches in the revprompt sub-dialog. This is useful for
1194 tools similar to merge or rebase, but not for things like checkout or reset.
1196 guitool.<name>.title
1197 --------------------
1198 Specifies the title to use for the prompt dialog.
1199 Defaults to the tool name.
1201 guitool.<name>.prompt
1202 ---------------------
1203 Specifies the general prompt string to display at the top of the dialog,
1204 before subsections for argprompt and revprompt.
1205 The default value includes the actual command.
1207 guitool.<name>.shortcut
1208 -----------------------
1209 Specifies a keyboard shortcut for the custom tool.
1211 The value must be a valid string understood by the `QAction::setShortcut()` API.
1212 See https://doc.qt.io/qt-6/qkeysequence.html#toString
1213 for more details about the supported values.
1215 Avoid creating shortcuts that conflict with existing built-in `git cola`
1216 shortcuts.  Creating a conflict will result in no action when the shortcut
1217 is used.
1220 SETTING UP CREDENTIAL HELPERS
1221 =============================
1222 Git has robust support for automatically handling credentials.
1224 The recommended approach is to use SSH keys and an SSH agent, but any of the core Git
1225 Credentials helpers will get used automatically by Git Cola.
1227 See https://git-scm.com/doc/credential-helpers for more details.
1230 SETTING UP GPG FOR SIGNED COMMITS
1231 =================================
1232 When creating signed commits, `gpg` will attempt to read your password from the
1233 terminal from which `git cola` was launched.
1234 The way to make this work smoothly is to use a GPG agent so that you can avoid
1235 needing to re-enter your password every time you commit.
1237 This also gets you a graphical passphrase prompt instead of getting prompted
1238 for your password in the terminal.
1240 Install gpg-agent and friends
1241 -----------------------------
1242 On Mac OS X, you may need to `brew install gpg-agent` and install the
1243 `Mac GPG Suite <https://gpgtools.org/macgpg2/>`_.
1245 On Linux use your package manager to install gnupg2,
1246 gnupg-agent and pinentry-qt, e.g.::
1248     sudo apt-get install gnupg2 gnupg-agent pinentry-qt
1250 On Linux, you should also configure Git so that it uses gpg2 (gnupg2),
1251 otherwise you will get errors mentioning, "unable to open /dev/tty".
1252 Set Git's `gpg.program` to `gpg2`::
1254     git config --global gpg.program gpg2
1256 Configure gpg-agent and a pin-entry program
1257 -------------------------------------------
1258 On Mac OS X, edit `~/.gnupg/gpg.conf` to include the line,::
1260     use-agent
1262 This is typically not needed on Linux, where `gpg2` is used, as
1263 this is the default value when using `gpg2`.
1265 Next, edit `~/.gnupg/gpg-agent.conf` to contain a pinentry-program line
1266 pointing to the pinentry program for your platform.
1268 The following example `~/.gnupg/gpg-agent.conf` shows how to use
1269 pinentry-gtk-2 on Linux::
1271     pinentry-program /usr/bin/pinentry-gtk-2
1272     default-cache-ttl 3600
1274 This following example `.gnupg/gpg-agent.conf` shows how to use MacGPG2's
1275 pinentry app on On Mac OS X::
1277     pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
1278     default-cache-ttl 3600
1279     enable-ssh-support
1280     use-standard-socket
1282 Once this has been set up then you will need to reload your gpg-agent config::
1284     echo RELOADAGENT | gpg-connect-agent
1286 If you see the following output::
1288     OK
1290 Then the daemon is already running, and you do not need to start it yourself.
1292 If it is not running, eval the output of ``gpg-agent --daemon`` in your shell
1293 prior to launching `git cola`.::
1295     eval $(gpg-agent --daemon)
1296     git cola
1299 SHELL COMPLETIONS
1300 =================
1302 Git Cola provides shell completions for zsh and bash.
1303 The completion scripts and instructions are included in Git Cola's
1304 `contrib` directory.
1306 * `Shell completion scripts <https://gitlab.com/git-cola/git-cola/-/tree/main/contrib>`_
1308 * `Setup instructions <https://gitlab.com/git-cola/git-cola/-/blob/main/contrib/README.md>`_
1311 WINDOWS NOTES
1312 =============
1314 Git Installation
1315 ----------------
1316 If Git is installed in a custom location, e.g. not installed in `C:/Git` or
1317 Program Files, then the path to Git must be configured by creating a file in
1318 your home directory `~/.config/git-cola/git-bindir` that points to your git
1319 installation, e.g.::
1321     C:/Tools/Git/bin
1323 SSH Agents for Key-based Authentication
1324 ---------------------------------------
1325 You may need to setup ssh-agent in order to use SSH key-based authentication
1326 on Windows. It has been reported that starting OpenSSH agent in
1327 Windows Services and adding the key using Powershell are necessary in order
1328 to get things working.
1330 Please see the following links for more details.
1332 https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows
1335 FIPS SECURITY MODE
1336 ==================
1338 `FIPS Security Mode <https://github.com/python/cpython/issues/53462>`_
1339 is available in newer versions of Python. These include Python 3.9+ and the
1340 patched Python 3.6 used by CentOS8/RHEL8 (and possibly others).
1342 Git Cola uses the ``hashlib.md5`` function and adheres to the FIPS security
1343 mode when available. Git Cola does not use the MD5 value for security purposes.
1344 MD5 is used only for the purposes of implementing the ``cola/gravatar.py``
1345 Gravatar client.
1348 LINKS
1349 =====
1351 Git Cola's Git Repository
1352 -------------------------
1353 * `Primary repository <https://gitlab.com/git-cola/git-cola/>_`.
1354 * `Mirror repository <https://github.com/git-cola/git-cola/>_`.
1357 Git Cola Homepage
1358 -----------------
1359 https://git-cola.gitlab.io/