qtutils: add PyQt6 compatibility for enums
[git-cola.git] / docs / git-cola.rst
blobd32fc53439930c9d3a1f40048f5e9c6d95620d06
1 ===========
2 git-cola(1)
3 ===========
5 SYNOPSIS
6 ========
7 git cola [options] [sub-command]
9 DESCRIPTION
10 ===========
11 Git Cola is a sleek and powerful Git GUI.
13 OPTIONS
14 =======
16 ``--amend``
17 -----------
18 Start `git cola` in amend mode.
20 ``--prompt``
21 ------------
22 Prompt for a Git repository.  Defaults to the current directory.
24 ``-r, --repo <path>``
25 ---------------------
26 Open the Git repository at `<path>`.  Defaults to the current directory.
28 ``-s, --status-filter <filter>``
29 --------------------------------
30 Apply the path filter to the status widget.
32 ``--version``
33 -------------
34 Print the `git cola` version and exit.
36 ``-h, --help``
37 --------------
38 Show usage and optional arguments.
40 ``--help-commands``
41 -------------------
42 Show available sub-commands.
44 SUB-COMMANDS
45 ============
49 Apply patches.
51 archive
52 -------
53 Export tarballs from Git.
55 branch
56 ------
57 Create branches.
59 browse
60 ------
61 Browse tracked files.
63 config
64 ------
65 Configure settings.
67 dag
68 ---
69 Start the `git dag` Git history browser.
71 diff
72 ----
73 Diff changed files.
75 fetch
76 -----
77 Fetch history from remote repositories.
79 grep
80 ----
81 Use `git grep` to search for content.
83 merge
84 -----
85 Merge branches.
87 pull
88 ----
89 Fetch and merge remote branches.
91 push
92 ----
93 Push branches to remotes.
95 rebase
96 ------
97 Start an interactive rebase.
99 remote
100 ------
101 Create and edit remotes.
103 search
104 ------
105 Search for commits.
107 stash
108 -----
109 Stash uncommitted modifications.
113 Create tags.
115 version
116 -------
117 Print the `git cola` version.
119 CONFIGURE YOUR EDITOR
120 =====================
121 The editor used by `Ctrl-e` is configured from the Preferences screen.
123 The following environment variables are consulted when no editor is configured.
124 If defined, the first of these variables is used:
126 * `GIT_VISUAL`
127 * `VISUAL`
128 * `GIT_EDITOR`
129 * `EDITOR`
131 The `*VISUAL` variables are consulted before the `*EDITOR` variables so that you can
132 configure a graphical editor independently of the editor used by the Git CLI.
134 *ProTip*: Configuring your editor to `gvim -f -p` will open multiple tabs
135 when editing files.  `gvim -f -o` uses splits.
137 `git cola` is {vim, emacs, textpad, notepad++}-aware.
138 When you select a line in the diff or grep screens and press any of
139 `Enter`, `Ctrl-e`, or the `Edit` button, you are taken to that exact line.
141 The editor preference is saved in the `gui.editor` variable using
142 `git config <http://git-scm.com/docs/git-config>`_.
144 The following are some recommend editor configurations.
146 * Neovim + Neovim-Qt
148 .. sourcecode:: sh
150    git config --global core.editor nvim
151    git config --global gui.editor 'nvim-qt --nofork'
153 * Vim + gvim
155 .. sourcecode:: sh
157    git config --global core.editor vim
158    git config --global gui.editor 'gvim -f'
160 * Sublime Text
162 .. sourcecode:: sh
164    git config --global gui.editor 'subl --wait'
167 KEYBOARD SHORTCUTS
168 ==================
169 `git cola` has many useful keyboard shortcuts.
171 Many of `git cola`'s editors understand vim-style hotkeys, eg. `{h,j,k,l}`
172 for navigating in the diff, status, grep, and file browser widgets.
174 `{d,u}` move down/up one half page at a time (similar to vim's `ctrl-{d,u}`).
175 The `space` and `shift-space` hotkeys are mapped to the same operations.
177 `Shift-{j,k,d,u,f,b,page-up,page-down,left,right,up,down}` can be be used in
178 the diff editor to select lines while navigating.
180 `s` is a useful hotkey in the diff editor.  It stages/unstages the current
181 selection when a selection is present.  When nothing is selected, the
182 diff hunk at the current text cursor position is staged.  This makes it very
183 easy to review changes by selecting good hunks with `s` while navigating down
184 and over hunks that are not going to be staged.
186 `Ctrl-u` in the diff editor reverts unstaged edits, and respects the
187 selection.  This is useful for selectively reverted edits from the worktree.
188 This same hotkey reverts the entire file when used from the status tool.
190 `Ctrl-s` in the diff editor and status tools stages/unstages the entire file.
192 You can see the available shortcuts by pressing pressing the ``?`` key,
193 choosing ``Help -> Keyboard shortcuts`` from the main menu,
194 or by consulting the `git cola keyboard shortcuts reference <https://git-cola.github.io/share/doc/git-cola/hotkeys.html>`_.
196 TOOLS
197 =====
198 The `git cola` interface is composed of various cooperating tools.
199 Double-clicking a tool opens it in its own subwindow.
200 Dragging it around moves and places it within the main window.
202 Tools can be hidden and rearranged however you like.
203 `git cola` carefully remembers your window layout and restores
204 it the next time it is launched.
206 The `Control-{1, 2, 3, ...}` hotkey gives focus to a specific tool.
207 A hidden tool can be re-opened using the `Tools` menu or
208 the `Shift+Control-{1, 2, 3, ...}` shortcut keys.
210 The Diff editor can be focused with `Ctrl-j`.
211 the Status tool can be focused with `Ctrl-k`.
212 the Commit tool can be focused with `Ctrl-l`.
215 .. _status:
217 STATUS
218 ======
219 The `Status` tool provides a visual analog to the
220 `git status <http://git-scm.com/docs/git-status>`_ command.
222 `Status` displays files that are `modified` relative to the staging area,
223 `staged` for the next commit, `unmerged` files from an in-progress merge,
224 and files that are `untracked` to git.
226 These are the same categories one sees when running
227 `git status <http://git-scm.com/docs/git-status>`_
228 on the command line.
230 You can navigate through the list of files using keyboard arrows as well
231 as the ergonomical and vim-like `j` and `k` shortcut keys.
233 There are several convenient ways to interact with files in the `Status` tool.
235 Selecting a file displays its diff in the `Diff` viewer.
236 Double-clicking a file stages its contents, as does the
237 the `Ctrl-s` shortcut key.
239 `Ctrl-e` opens selected files in the configured editor, and
240 `Ctrl-d` opens selected files using `git difftool <http://git-scm.com/docs/git-difftool>`_
242 Additional actions can be performed using the right-click context menu.
244 Drag and Drop
245 -------------
246 Files can be dragged from the the `Status` tool onto other applications.
248 Some terminals will treat a drag with multiple files by separating them with newlines,
249 which is less amenable for pasting command-line arguments.
251 To avoid this issue, hold down `Alt / Option` when dragging from the `Status` tool.
252 The drag and drop payload will no longer contain local file URLs -- it will contain
253 plain text that is amenable for use on a command-line.
255 Note: if drag and drop is not working and you are on Wayland then you may
256 need to ``export QT_QPA_PLATFORM=wayland`` in your environment.
258 Actions
259 -------
260 Clicking the `Staged` folder shows a diffstat for the index.
262 Clicking the `Modified` folder shows a diffstat for the worktree.
264 Clicking individual files sends diffs to the `Diff Display`.
266 Double-clicking individual files adds and removes their content from the index.
268 Various actions are available through the right-click context menu.
269 Different actions are available depending a file's status.
271 Stage Selected
272 ~~~~~~~~~~~~~~
273 Add to the staging area using `git add <http://git-scm.com/docs/git-add>`_
274 Marks unmerged files as resolved.
276 Launch Editor
277 ~~~~~~~~~~~~~
278 Launches the configured visual text editor
280 Launch Difftool
281 ~~~~~~~~~~~~~~~
282 Visualize changes using `git difftool`.
284 Revert Unstaged Edits
285 ~~~~~~~~~~~~~~~~~~~~~
286 Reverts unstaged content by checking out selected paths
287 from the index/staging area
289 Revert Uncommitted Edits
290 ~~~~~~~~~~~~~~~~~~~~~~~~
291 Throws away uncommitted edits
293 Unstage Selected
294 ~~~~~~~~~~~~~~~~
295 Remove from the index/staging area with
296 `git reset <http://git-scm.com/docs/git-reset>`_
298 Launch Merge Tool
299 ~~~~~~~~~~~~~~~~~
300 Resolve conflicts using `git mergetool <http://git-scm.com/docs/git-mergetool>`_.
302 Delete File(s)
303 ~~~~~~~~~~~~~~
304 Delete untracked files from the filesystem.
306 Add to .gitignore
307 ~~~~~~~~~~~~~~~~~
308 Adds untracked files to to the .gitignore file.
311 .. _diff:
313 DIFF
314 ====
315 The diff viewer/editor displays diffs for selected files.
316 Additions are shown in green and removals are displayed in light red.
317 Extraneous whitespace is shown with a pure-red background.
319 Right-clicking in the diff provides access to additional actions
320 that use either the cursor location or text selection.
322 The "Copy Diff" action at ``Alt + Shift + C`` copies the selected lines to the
323 clipboard. The ``+``, ``-`` and `` `` diff line prefixes are stripped from each line
324 when copying diffs using the "Copy Diff" action.
326 Staging content for commit
327 --------------------------
328 The ``@@`` patterns denote a new diff hunk.  Selecting lines of diff
329 and using the `Stage Selected Lines` command will stage just the selected
330 lines.  Clicking within a diff hunk and selecting `Stage Diff Hunk` stages the
331 entire patch diff hunk.
333 The corresponding opposite commands can be performed on staged files as well,
334 e.g. staged content can be selectively removed from the index when we are
335 viewing diffs for staged content.
337 Diff Against Commit (Diff Mode)
338 -------------------------------
339 *Diff Mode* allows you to selectively unstage and revert edits from arbitrary commits
340 so that you can bring these edits back into your worktree.
342 You can use the diff editor to unstage edits against arbitrary commits by using the
343 ``Diff > Against Commit... (Diff Mode)`` menu action.
345 You can exit *Diff Mode* by clicking on the red circle-slash icon on the Status
346 widget, by using the ``Diff > Exit Diff mode`` menu action, or by clicking in
347 an empty area in the `Status` tool.
350 COMMIT MESSAGE EDITOR
351 =====================
353 The commit message editor is a simple text widget
354 for entering commit messages.
356 You can navigate between the `Subject` and `Extended description...`
357 fields using the keyboard arrow keys.
359 Pressing enter when inside the `Subject` field jumps down to the
360 extended description field.
362 The `Options` button menu to the left of the subject field
363 provides access to the additional actions.
365 The `Ctrl+i` keyboard shortcut adds a standard "Signed-off-by: " line,
366 and `Ctrl+Enter` creates a new commit using the commit message and
367 staged content.
369 Sign Off
370 --------
371 The `Sign Off` button adds a standard::
373     Signed-off-by: A. U. Thor <a.u.thor@example.com>
375 line to the bottom of the commit message.
377 Invoking this action is equivalent to passing the ``-s`` option
378 to `git commit <http://git-scm.com/docs/git-commit>`_.
380 Commit
381 ------
382 The commit button runs
383 `git commit <http://git-scm.com/docs/git-commit>`_.
384 The contents of the commit message editor is provided as the commit message.
386 Only staged files are included in the commit -- this is the same behavior
387 as running ``git commit`` on the command-line.
389 Line and Column Display
390 -----------------------
391 The current line and column number is displayed by the editor.
392 E.g. a ``5,0`` display means that the cursor is located at
393 line five, column zero.
395 The display changes colors when lines get too long.
396 Yellow indicates the safe boundary for sending patches to a mailing list
397 while keeping space for inline reply markers.
399 Orange indicates that the line is starting to run a bit long and should
400 break soon.
402 Red indicates that the line is running up against the standard
403 80-column limit for commit messages.
405 Keeping commit messages less than 76-characters wide is encouraged.
406 `git log <http://git-scm.com/docs/git-log>`_
407 is a great tool but long lines mess up its formatting for everyone else,
408 so please be mindful when writing commit messages.
411 Amend Last Commit
412 -----------------
413 Clicking on `Amend Last Commit` makes `git cola` amend the previous commit
414 instead of creating a new one.  `git cola` loads the previous commit message
415 into the commit message editor when this option is selected.
417 The `Status` tool will display all of the changes for the amended commit.
419 Create Signed Commit
420 --------------------
421 Tell `git commit` and `git merge` to sign commits using GPG.
423 Using this option is equivalent to passing the ``--gpg-sign`` option to
424 `git commit <http://git-scm.com/docs/git-commit>`_ and
425 `git merge <http://git-scm.com/docs/git-merge>`_.
427 This option's default value can be configured using the `cola.signcommits`
428 configuration variable.
430 Prepare Commit Message
431 ----------------------
432 The ``Commit -> Prepare Commit Message`` action or `Ctrl-Shift-Return` keyboard shortcut
433 runs the `cola-prepare-commit-msg` hook if it is available in `.git/hooks/`.
434 This is a `git cola`-specific hook that takes the same parameters
435 as Git's `prepare-commit-msg hook <https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks>`_
437 The hook is passed the path to `.git/GIT_COLA_MSG` as the first argument and the hook is expected to write
438 an updated commit message to specified path.  After running this action, the
439 commit message editor is updated with the new commit message.
441 To override the default path to this hook set the
442 `cola.prepareCommitMessageHook` `git config` variable to the path to the
443 hook script.  This is useful if you would like to use a common hook
444 across all repositories.
446 BRANCHES
447 ========
449 The `Branches` tool provides a visual tree to navigate through the branches.
450 The tree has three main nodes `Local Branch`, `Remote Branch` and `Tags`.
451 Branches are grouped by their name divided by the character '/'.Ex::
453     branch/feature/foo
454     branch/feature/bar
455     branch/doe
457 Will produce::
459     branch
460         - doe
461         + feature
462             - bar
463             - foo
465 Current branch will display a star icon. If current branch has commits
466 ahead/behind it will display an up/down arrow with its number.
468 Actions
469 -------
470 Various actions are available through the right-click context menu.
471 Different actions are available depending of selected branch status.
473 Checkout
474 ~~~~~~~~
475 The checkout action runs
476 `git checkout [<branchname>] <https://git-scm.com/docs/git-checkout>`_.
478 Merge in current branch
479 ~~~~~~~~~~~~~~~~~~~~~~~
480 The merge action runs
481 `git merge --no-commit [<branchname>] <https://git-scm.com/docs/git-merge>`_.
483 Pull
484 ~~~~
485 The pull action runs
486 `git pull --no-ff [<remote>] [<branchname>] <https://git-scm.com/docs/git-pull>`_.
488 Push
489 ~~~~
490 The push action runs
491 `git push [<remote>] [<branchname>] <https://git-scm.com/docs/git-push>`_.
493 Rename Branch
494 ~~~~~~~~~~~~~
495 The rename branch action runs
496 `git branch -M [<branchname>] <https://git-scm.com/docs/git-push>`_.
498 Delete Branch
499 ~~~~~~~~~~~~~
500 The delete branch branch action runs
501 `git branch -D [<branchname>] <https://git-scm.com/docs/git-branch>`_.
503 Delete Remote Branch
504 ~~~~~~~~~~~~~~~~~~~~
505 The remote branch action runs
506 `git push --delete [<remote>] [<branchname>] <https://git-scm.com/docs/git-push>`_.
509 APPLY PATCHES
510 =============
511 Use the ``File -> Apply Patches`` menu item to begin applying patches.
513 Dragging and dropping patches onto the `git cola` interface
514 adds the patches to the list of patches to apply using
515 `git am <http://git-scm.com/docs/git-am>`_.
517 You can drag either a set of patches or a directory containing patches.
518 Patches can be sorted using in the interface and are applied in the
519 same order as is listed in the list.
521 When a directory is dropped `git cola` walks the directory
522 tree in search of patches.  `git cola` sorts the list of
523 patches after they have all been found.  This allows you
524 to control the order in which patches are applied by placing
525 patchsets into alphanumerically-sorted directories.
527 CUSTOM WINDOW SETTINGS
528 ======================
529 `git cola` remembers modifications to the layout and arrangement
530 of tools within the `git cola` interface.  Changes are saved
531 and restored at application shutdown/startup.
533 `git cola` can be configured to not save custom layouts by unsetting
534 the `Save Window Settings` option in the `git cola` preferences.
536 DARK MODE AND WINDOW MANAGER THEMES
537 ===================================
538 Git Cola contains a ``default`` theme which follows the current Qt style and a
539 handful of built-in color themes.  See :ref:`cola_theme` for more details.
541 To use icons appropriate for a dark application theme, configure
542 ``git config --global cola.icontheme dark`` to use the dark icon theme.
543 See :ref:`cola_icontheme` for more details.
545 On macOS, using the ``default`` theme will automatically inherit "Dark Mode"
546 color themes when configured via System Preferences.  You will need to
547 configure the dark icon theme as noted above when dark mode is enabled.
549 On Linux, you may want Qt to follow the Window manager theme by configuring it
550 to do so using the ``qt5ct`` Qt5 configuration tool.  Install ``qt5ct`` on
551 Debian/Ubuntu systems to make this work.::
553     sudo apt install qt5ct
555 Once installed, update your `~/.bash_profile` to activate ``qt5ct``::
557     # Use the style configured using the qt5ct tool
558     export QT_QPA_PLATFORMTHEME=qt5ct
560 This only work with the `default` theme.  The other themes replace the color
561 palette with theme-specific colors.
563 Some systems may require that you override `QT_STYLE_OVERRIDE` in order to
564 use a dark theme or to better interact with the Desktop environment.
565 Some systems provide a theme that you can install::
567     sudo apt-get install adwaita-qt
569 You can activate the theme using the following environment variable::
571     # Override the default theme to adwaita-dark
572     export QT_STYLE_OVERRIDE=adwaita-dark
574 `QT_STYLE_OVERRIDE` may already be set in your Desktop Environment, so check that
575 variable for reference if you get unexpected hangs when launching `git-cola` or
576 when the default theme does not follow the desktop's theme on Linux.
578 If you don't want to set this variable globally then you can set it when launching
579 cola from the command-line::
581     QT_STYLE_OVERRIDE=adwaita-dark git cola
583 The following is a user-contributed custom `git-cola.desktop` file that can be used to
584 launch Git Cola with these settings preset for you::
586     [Desktop Entry]
587     Name=Git Cola (dark)
588     Comment=The highly caffeinated Git GUI
589     TryExec=git-cola
590     Exec=env QT_STYLE_OVERRIDE=adwaita-dark git-cola --prompt --icon-theme dark
591     Icon=git-cola
592     StartupNotify=true
593     Terminal=false
594     Type=Application
595     Categories=Development;RevisionControl;
596     X-KDE-SubstituteUID=false
598 You may also want to customize the diff colors when using a dark theme::
600     git config --global cola.color.add 86c19f
601     git config --global cola.color.remove c07067
603 Please see `#760 <https://github.com/git-cola/git-cola/issues/760>`_ for more details.
605 Custom Themes
606 -------------
607 To create your own custom theme for Git Cola just create a QSS file and put it in
608 ``~/.config/themes/``. You can add as many files as you want. Each file will become
609 an option in ``Menu -> File -> Preferences -> Appearance -> GUI theme``.
611 Some examples can be found here `Qt Style Sheets Examples <https://doc.qt.io/qt-5/stylesheet-examples.html>`_.
614 CONFIGURATION VARIABLES
615 =======================
616 These variables can be set using `git config` or from the settings.
618 cola.autocompletepaths
619 ----------------------
620 Set to `false` to disable auto-completion of filenames in completion widgets.
621 This can speed up operations when working in large repositories.
622 Defaults to `true`.
624 cola.autoloadCommitTemplate
625 ---------------------------
626 Set to `true` to automatically load the commit template in the commit message
627 editor If the commit.template variable has not been configured, raise the
628 corresponding error.
629 Defaults to `false`.
631 cola.blameviewer
632 ----------------
633 The command used to blame files.  Defaults to `git gui blame`.
635 cola.blockcursor
636 ----------------
637 Whether to use a "block" cursor in diff editors. The block cursor is easier to
638 see compared to a line cursor. Set to `false` to use a thin "line" cursor.
639 Defauls to `true`.
641 cola.browserdockable
642 --------------------
643 Whether to create a dock widget with the `Browser` tool.
644 Defaults to `false` to speedup startup time.
646 cola.checkconflicts
647 -------------------
648 Inspect unmerged files for conflict markers before staging them.
649 This feature helps prevent accidental staging of unresolved merge conflicts.
650 Defaults to `true`.
652 cola.defaultrepo
653 ----------------
654 `git cola`, when run outside of a Git repository, prompts the user for a
655 repository.  Set `cola.defaultrepo` to the path of a Git repository to make
656 `git cola` attempt to use that repository before falling back to prompting
657 the user for a repository.
659 cola.dictionary
660 ---------------
661 Specifies an additional dictionary for `git cola` to use in its spell checker.
662 This should be configured to the path of a newline-separated list of words.
664 By default, `git cola` searches for `dict/words` and `dict/propernames` dictionary
665 files in `~/.local/share` and `$XDG_DATA_DIRS`.
667 If `$XDG_DATA_DIRS` is undefined or set to an empty value then `/usr/local/share` and
668 `/usr/share` are searched for dictionary files.
670 Dictionary files are newline-separated and contain one word per line.
672 cola.expandtab
673 --------------
674 Expand tabs into spaces in the commit message editor.  When set to `true`,
675 `git cola` will insert a configurable number of spaces when tab is pressed.
676 The number of spaces is determined by `cola.tabwidth`.
677 Defaults to `false`.
679 cola.gravatar
680 -------------
681 Use the `gravatar.com` service to lookup icons for author emails.
682 Gravatar icons work by sending an MD5 hash of an author's email to `gravatar.com`
683 when requesting an icon. Warning: this feature can leak information.
684 Network requests to `gravatar.com` are disabled when set to `false`.
685 Defaults to `true`.
687 cola.fileattributes
688 -------------------
689 Enables per-file gitattributes encoding and binary file support.
690 This tells `git cola` to honor the configured encoding when displaying
691 and applying diffs.
693 A `.gitattributes` file can set the ``binary`` attribute in order to force
694 specific untracked paths to be treated as binary files when diffing.
695 Binary files are displayed using a hexdump display.
697 .. sourcecode:: sh
699    # Treat *.exr files as binary files.
700    *.exr binary
702 cola.fontdiff
703 -------------
704 Specifies the font to use for `git cola`'s diff display.
706 cola.hidpi
707 ----------
708 Specifies the High DPI displays scale factor. Set `0` to automatically scaled.
709 Setting value between 0 and 1 is undefined.
710 This option requires at least Qt 5.6 to work.
711 See `Qt QT_SCALE_FACTOR documentation <https://doc.qt.io/qt-5/highdpi.html>`_
712 for more information.
714 .. _cola_icontheme:
716 cola.icontheme
717 --------------
718 Specifies the icon themes to use throughout `git cola`. The theme specified
719 must be the name of the subdirectory containing the icons, which in turn must
720 be placed in the inside the main "icons" directory in `git cola`'s
721 installation prefix.
723 If unset, or set either "light" or "default", then the default style will be
724 used.  If set to "dark" then the built-in "dark" icon theme, which is
725 suitable for a dark window manager theme, will be used.
727 If set to an absolute directory path then icons in that directory will be used.
728 This value can be set to multiple values using,
729 ``git config --add cola.icontheme $theme``.
731 This setting can be overridden by the `GIT_COLA_ICON_THEME` environment
732 variable, which can specify multiple themes using a colon-separated value.
734 The icon theme can also be specified by passing ``--icon-theme=<theme>`` on the
735 command line, once for each icon theme, in the order that they should be
736 searched.  This can be used to override a subset of the icons, and fallback
737 to the built-in icons for the remainder.
739 cola.imagediff.[extension]
740 --------------------------
741 Enable image diffs for the specified file extension.  For example, configuring
742 `git config --global cola.imagediff.svg false` will disable use of the visual
743 image diff for `.svg` files in all repos until is is explicitly toggled on.
744 Defaults to `true`.
746 cola.inotify
747 ------------
748 Set to `false` to disable file system change monitoring.  Defaults to `true`,
749 but also requires either Linux with inotify support or Windows with `pywin32`
750 installed for file system change monitoring to actually function.
752 cola.refreshonfocus
753 -------------------
754 Set to `true` to automatically refresh when `git cola` gains focus.  Defaults
755 to `false` because this can cause a pause whenever switching to `git cola` from
756 another application.
758 cola.linebreak
759 --------------
760 Whether to automatically break long lines while editing commit messages.
761 Defaults to `true`.  This setting is configured using the `Preferences`
762 dialog, but it can be toggled for one-off usage using the commit message
763 editor's options sub-menu.
765 cola.logdate
766 ------------
767 Set the default date-time mode for the DAG display. This value is
768 passed to `git log --date=<format>`.
769 See `git log(1) <https://git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt>`_
770 for more details.
772 cola.maxrecent
773 --------------
774 `git cola` caps the number of recent repositories to avoid cluttering
775 the start and recent repositories menu.  The maximum number of repositories to
776 remember is controlled by `cola.maxrecent` and defaults to `8`.
778 cola.mousezoom
779 --------------
780 Controls whether zooming text using Ctrl + MouseWheel scroll is enabled.
781 Set to `false to disable scrolling with the mouse wheel.
782 Defauls to `true`.
784 cola.dragencoding
785 -----------------
786 `git cola` encodes paths dragged from its widgets into `utf-16` when adding
787 them to the drag-and-drop mime data (specifically, the `text/x-moz-url` entry).
788 `utf-16` is used to make `gnome-terminal` see the right paths, but other
789 terminals may expect a different encoding.  If you are using a terminal that
790 expects a modern encoding, e.g. `terminator`, then set this value to `utf-8`.
792 cola.readsize
793 -------------
794 `git cola` avoids reading large binary untracked files.
795 The maximum size to read is controlled by `cola.readsize`
796 and defaults to `2048`.
798 cola.resizebrowsercolumns
799 -------------------------
800 `git cola` will automatically resize the file browser columns as folders are
801 expanded/collapsed when ``cola.resizebrowsercolumns`` is set to `true`.
803 cola.patchesdirectory
804 ---------------------
805 The default directory to use when exporting patches. Relative paths are treated
806 as being relative to the current repository. Absolute paths are used as-is.
807 Defaults to `patches`.
809 cola.safemode
810 -------------
811 The "Stage" button in the `git cola` Actions panel stages all files when it is
812 activated and no files are selected.  This can be problematic if it is
813 accidentally triggered after carefully preparing the index with staged
814 changes.  "Safe Mode" is enabled by setting `cola.safemode` to `true`.
815 When enabled, `git cola` will do nothing when "Stage" is activated without a
816 selection.  Defaults to `false`.
818 cola.savewindowsettings
819 -----------------------
820 `git cola` will remember its window settings when set to `true`.
821 Window settings and X11 sessions are saved in `$HOME/.config/git-cola`.
823 cola.showpath
824 -------------
825 `git cola` displays the absolute path of the repository in the window title.
826 This can be disabled by setting `cola.showpath` to `false`.
827 Defaults to `true`.
829 cola.signcommits
830 ----------------
831 `git cola` will sign commits by default when set `true`. Defaults to `false`.
832 See the section below on setting up GPG for more details.
834 cola.startupmode
835 ----------------
836 Control how the list of repositories is displayed in the startup dialog.
837 Set to `list` to view the list of repositories as a list, or `folder` to view
838 the list of repositories as a collection of folder icons.
839 Defaults to `list`.
841 cola.statusindent
842 -----------------
843 Set to `true` to indent files in the Status widget.  Files in the `Staged`,
844 `Modified`, etc. categories will be grouped in a tree-like structure.
845 Defaults to `false`.
847 cola.statusshowtotals
848 ---------------------
849 Set to `true` to display files counts in the Status widget's category titles.
850 Defaults to `false`.
852 cola.tabwidth
853 -------------
854 The number of columns occupied by a tab character.  Defaults to 8.
856 cola.terminal
857 -------------
858 The command to use when launching commands within a graphical terminal.
860 `cola.terminal` defaults to `xterm -e` when unset.
861 e.g. when opening a shell, `git cola` will run `xterm -e $SHELL`.
863 `git cola` has built-in support for `xterm`, `gnome-terminal`, `konsole`.
864 If either `gnome-terminal`, `xfce4-terminal`, or `konsole` are installed
865 then they will be preferred over `xterm` when `cola.terminal` is unset.
867 The table below shows the built-in values that are used for the respective
868 terminal.  You can force the use of a specific terminal by configuring cola
869 accordingly.
871 cola.terminalshellquote
872 -----------------------
873 Some terminal require that the command string get passed as a string.
874 For example, ``xfce4-terminal -e "git difftool"`` requires shell quoting,
875 whereas ``gnome-terminal -- git difftool`` does not.
877 You should not need to set this variable for the built-in terminals
878 cola knows about -- it will behave correctly without configuration.
879 For example, when unconfigured, cola already knows that xfce4-terminal
880 requires shell quoting.
882 This configuration variable is for custom terminals outside of the builtin set.
883 The table below shows the builtin configuration.
885 =================== ======================= =============================
886 Terminal            ``cola.terminal``       ``cola.terminalshellquote``
887 =================== ======================= =============================
888 gnome-terminal      ``gnome-terminal --``   ``false``
889 konsole             ``konsole -e``          ``false``
890 xfce4-terminal      ``xfce4-terminal -e``   ``true``
891 xterm               ``xterm -e``            ``false``
892 =================== ======================= =============================
894 cola.textwidth
895 --------------
896 The number of columns used for line wrapping.
897 Tabs are counted according to `cola.tabwidth`.
899 .. _cola_theme:
901 cola.theme
902 ----------
903 Specifies the GUI theme to use throughout `git cola`. The theme specified
904 must be one of the following values:
906 * `default` â€“ default Qt theme, may appear different on various systems
907 * `flat-dark-blue`
908 * `flat-dark-green`
909 * `flat-dark-grey`
910 * `flat-dark-red`
911 * `flat-light-blue`
912 * `flat-light-green`
913 * `flat-light-grey`
914 * `flat-light-red`
916 If unset, or set to an invalid value, then the default style will be
917 used. The `default` theme is generated by Qt internal engine and should look
918 native but may look noticeably different on different platforms. The flat
919 themes on the other hand should look similar (but not identical) on various
920 systems.
922 The GUI theme can also be specified by passing ``--theme=<name>`` on the
923 command line.
925 cola.turbo
926 ----------
927 Set to `true` to enable "turbo" mode.  "Turbo" mode disables some
928 features that can slow things down when operating on huge repositories.
929 "Turbo" mode will skip loading Git commit messages, author details, status
930 information, and commit date details in the `File Browser` tool.
931 Defaults to `false`.
933 cola.color.text
934 ---------------
935 The default diff text color, in hexadecimal #RRGGBB notation.
936 Defaults to "#030303"::
938     git config cola.color.text '#030303'
940 cola.color.add
941 --------------
942 The default diff "add" background color, in hexadecimal #RRGGBB notation.
943 Defaults to "#d2ffe4"::
945     git config cola.color.add '#d2ffe4'
947 cola.color.remove
948 -----------------
949 The default diff "remove" background color, in hexadecimal #RRGGBB notation.
950 Defaults to "#fee0e4"::
952     git config cola.color.remove '#fee0e4'
954 cola.color.header
955 -----------------
956 The default diff header text color, in hexadecimal #RRGGBB notation.
957 Defaults to "#bbbbbb"::
959     git config cola.color.header '#bbbbbb'
961 commit.cleanup
962 --------------
963 Configure whether commit messages should be stripped of whitespace and comments.
965 Valid values are ``strip``, ``whitespace``, ``verbatim``, ``scissors`` or ``default``.
967 The ``default`` mode uses the ``whitespace`` mode when committing through Git Cola
968 and the ``strip`` mode when committing using the ``git commit`` command-line.
970 * ``strip`` - Strip leading and trailing empty lines, trailing whitespace,
971   commentary and collapse consecutive empty lines.
973 * ``whitespace`` - Same as strip except ``# commentary`` is not removed.
974   This is the ``default`` behavior when committing through `Git Cola`.
976 * ``verbatim`` - Do not change the message at all.
978 * ``scissors`` - Same as whitespace except that everything from (and including)
979   the line found below is truncated, if the message is to be edited.
980   "#" can be customized with ``core.commentChar``::
982     # ------------------------ >8 ------------------------
983     Scissor-lines and all following lines are removed.
985 Changing the mode to ``whitespace`` can be useful when you always want to keep
986 lines that begin with comment character ``#`` in your log message, even when
987 committing using the command-line ``git commit``.
989 On the contrary, if you always want to always strip comments, even when
990 committing through Git Cola, then configure ``commit.cleanup`` to ``strip``.
992 Please see the `git commit cleanup mode documentation
993 <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---cleanupltmodegt>`_
994 for more details.
996 core.commentChar
997 ----------------
998 Commit messages can contain comments that start with this character.
999 Defaults to ``#``.
1001 Please see the `git config documentation
1002 <https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar>`_
1003 for more details.
1005 core.hooksPath
1006 --------------
1007 Hooks are programs you can place in a hooks directory to trigger actions at
1008 certain points in git’s execution. Hooks that don’t have the executable bit
1009 set are ignored.
1011 By default the hooks directory is ``$GIT_DIR/hooks``, but that can
1012 be changed via the ``core.hooksPath`` configuration variable
1014 The ``cola-prepare-commit-msg`` hook functionality and Cola's Git LFS
1015 detection honors this configuration.
1017 Please see the `git hooks documentation <https://git-scm.com/docs/githooks>`_
1018 for more details.
1020 gui.diffcontext
1021 ---------------
1022 The number of diff context lines to display.
1024 gui.displayuntracked
1025 --------------------
1026 `git cola` avoids showing untracked files when set to `false`.
1028 gui.editor
1029 ----------
1030 The default text editor to use is defined in `gui.editor`.
1031 The config variable overrides the VISUAL environment variable.
1032 e.g. `gvim -f -p`.
1034 gui.historybrowser
1035 ------------------
1036 The history browser to use when visualizing history.
1037 Defaults to `gitk`.
1039 diff.tool
1040 ---------
1041 The default diff tool to use.
1043 merge.tool
1044 ----------
1045 The default merge tool to use.
1047 user.email
1048 ----------
1049 Your email address to be recorded in any newly created commits.
1050 Can be overridden by the 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_EMAIL', and
1051 'EMAIL' environment variables.
1053 user.name
1054 ---------
1055 Your full name to be recorded in any newly created commits.
1056 Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
1057 environment variables.
1059 ENVIRONMENT VARIABLES
1060 =====================
1062 GIT_COLA_ICON_THEME
1063 -------------------
1064 When set in the environment, `GIT_COLA_ICON_THEME` overrides the
1065 theme specified in the `cola.icontheme` configuration.
1066 Read :ref:`cola_icontheme` for more details.
1068 GIT_COLA_SCALE
1069 --------------
1070 .. Important:: `GIT_COLA_SCALE` should not be used with newer versions of Qt.
1072     Set `QT_AUTO_SCREEN_SCALE_FACTOR` to `1` and Qt will automatically
1073     scale the interface to the correct size based on the display DPI.
1074     This option is also available by setting `cola.hidpi` configuration.
1076     See the `Qt High DPI documentation <https://doc.qt.io/qt-5/highdpi.html>`_
1077     for more details.
1079 `git cola` can be made to scale its interface for HiDPI displays.
1080 When defined, `git cola` will scale icons, radioboxes, and checkboxes
1081 according to the scale factor.  The default value is `1`.
1082 A good value is `2` for high-resolution displays.
1084 Fonts are not scaled, as their size can already be set in the settings.
1086 GIT_COLA_TRACE
1087 --------------
1088 When defined, `git cola` logs `git` commands to stdout.
1089 When set to `full`, `git cola` also logs the exit status and output.
1090 When set to `trace`, `git cola` logs to the `Console` widget.
1092 VISUAL
1093 ------
1094 Specifies the default editor to use.
1095 This is ignored when the `gui.editor` configuration variable is defined.
1097 LANGUAGE SETTINGS
1098 =================
1099 `git cola` automatically detects your language and presents some
1100 translations when available.  This may not be desired, or you
1101 may want `git cola` to use a specific language.
1103 You can make `git cola` use an alternative language by creating a
1104 `~/.config/git-cola/language` file containing the standard two-letter
1105 gettext language code, e.g. "en", "de", "ja", "zh", etc.::
1107     mkdir -p ~/.config/git-cola &&
1108     echo en >~/.config/git-cola/language
1110 Alternatively you may also use LANGUAGE environmental variable to temporarily
1111 change `git cola`'s language just like any other gettext-based program.  For
1112 example to temporarily change `git cola`'s language to English::
1114     LANGUAGE=en git cola
1116 To make `git cola` use the zh_TW translation with zh_HK, zh, and en as a
1117 fallback.::
1119     LANGUAGE=zh_TW:zh_HK:zh:en git cola
1122 CUSTOM GUI ACTIONS
1123 ==================
1124 `git cola` allows you to define custom GUI actions by setting `git config`
1125 variables.  The "name" of the command appears in the "Actions" menu.
1127 guitool.<name>.cmd
1128 ------------------
1129 Specifies the shell command line to execute when the corresponding item of the
1130 Tools menu is invoked. This option is mandatory for every tool. The command is
1131 executed from the root of the working directory, and in the environment it
1132 receives the name of the tool as GIT_GUITOOL, the name of the currently
1133 selected file as FILENAME, and the name of the current branch as CUR_BRANCH
1134 (if the head is detached, CUR_BRANCH is empty).
1136 If ``<name>`` contains slashes (``/``) then the leading part of the name,
1137 up until the final slash, is treated like a path of submenus under which the
1138 actions will be created.
1140 For example, configuring ``guitool.Commands/Util/echo.cmd`` creates a
1141 ``Commands`` menu inside the top-level ``Actions`` menu, a ``Util`` menu
1142 inside the ``Commands`` menu and an ``echo`` action inside the ``Commands``
1143 submenu.
1145 guitool.<name>.background
1146 -------------------------
1147 Run the command in the background (similar to editing and difftool actions).
1148 This avoids blocking the GUI.  Setting `background` to `true` implies
1149 `noconsole` and `norescan`.
1151 guitool.<name>.needsfile
1152 ------------------------
1153 Run the tool only if a diff is selected in the GUI. It guarantees that
1154 FILENAME is not empty.
1156 guitool.<name>.noconsole
1157 ------------------------
1158 Run the command silently, without creating a window to display its output.
1160 guitool.<name>.norescan
1161 -----------------------
1162 Don’t rescan the working directory for changes after the tool finishes
1163 execution.
1165 guitool.<name>.confirm
1166 ----------------------
1167 Show a confirmation dialog before actually running the tool.
1169 guitool.<name>.argprompt
1170 ------------------------
1171 Request a string argument from the user, and pass it to the tool through the
1172 ARGS environment variable. Since requesting an argument implies confirmation,
1173 the confirm option has no effect if this is enabled. If the option is set to
1174 true, yes, or 1, the dialog uses a built-in generic prompt; otherwise the
1175 exact value of the variable is used.
1177 guitool.<name>.revprompt
1178 ------------------------
1179 Request a single valid revision from the user, and set the REVISION
1180 environment variable. In other aspects this option is similar to argprompt,
1181 and can be used together with it.
1183 guitool.<name>.revunmerged
1184 --------------------------
1185 Show only unmerged branches in the revprompt subdialog. This is useful for
1186 tools similar to merge or rebase, but not for things like checkout or reset.
1188 guitool.<name>.title
1189 --------------------
1190 Specifies the title to use for the prompt dialog.
1191 Defaults to the tool name.
1193 guitool.<name>.prompt
1194 ---------------------
1195 Specifies the general prompt string to display at the top of the dialog,
1196 before subsections for argprompt and revprompt.
1197 The default value includes the actual command.
1199 guitool.<name>.shortcut
1200 -----------------------
1201 Specifies a keyboard shortcut for the custom tool.
1203 The value must be a valid string understood by the `QAction::setShortcut()` API.
1204 See http://qt-project.org/doc/qt-4.8/qkeysequence.html#QKeySequence-2
1205 for more details about the supported values.
1207 Avoid creating shortcuts that conflict with existing built-in `git cola`
1208 shortcuts.  Creating a conflict will result in no action when the shortcut
1209 is used.
1211 SETTING UP CREDENTIAL HELPERS
1212 =============================
1213 Git has robust support for automatically handling credentials.
1215 The recommended approach is to use SSH keys and an SSH agent, but any of the core Git
1216 Credentials helpers will get used automatically by Git Cola.
1218 See https://git-scm.com/doc/credential-helpers for more details.
1220 SETTING UP GPG FOR SIGNED COMMITS
1221 =================================
1222 When creating signed commits, `gpg` will attempt to read your password from the
1223 terminal from which `git cola` was launched.
1224 The way to make this work smoothly is to use a GPG agent so that you can avoid
1225 needing to re-enter your password every time you commit.
1227 This also gets you a graphical passphrase prompt instead of getting prompted
1228 for your password in the terminal.
1230 Install gpg-agent and friends
1231 -----------------------------
1232 On Mac OS X, you may need to `brew install gpg-agent` and install the
1233 `Mac GPG Suite <https://gpgtools.org/macgpg2/>`_.
1235 On Linux use your package manager to install gnupg2,
1236 gnupg-agent and pinentry-qt, e.g.::
1238     sudo apt-get install gnupg2 gnupg-agent pinentry-qt
1240 On Linux, you should also configure Git so that it uses gpg2 (gnupg2),
1241 otherwise you will get errors mentioning, "unable to open /dev/tty".
1242 Set Git's `gpg.program` to `gpg2`::
1244     git config --global gpg.program gpg2
1246 Configure gpg-agent and a pin-entry program
1247 -------------------------------------------
1248 On Mac OS X, edit `~/.gnupg/gpg.conf` to include the line,::
1250     use-agent
1252 This is typically not needed on Linux, where `gpg2` is used, as
1253 this is the default value when using `gpg2`.
1255 Next, edit `~/.gnupg/gpg-agent.conf` to contain a pinentry-program line
1256 pointing to the pinentry program for your platform.
1258 The following example `~/.gnupg/gpg-agent.conf` shows how to use
1259 pinentry-gtk-2 on Linux::
1261     pinentry-program /usr/bin/pinentry-gtk-2
1262     default-cache-ttl 3600
1264 This following example `.gnupg/gpg-agent.conf` shows how to use MacGPG2's
1265 pinentry app on On Mac OS X::
1267     pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
1268     default-cache-ttl 3600
1269     enable-ssh-support
1270     use-standard-socket
1272 Once this has been set up then you will need to reload your gpg-agent config::
1274     echo RELOADAGENT | gpg-connect-agent
1276 If you see the following output::
1278     OK
1280 Then the daemon is already running, and you do not need to start it yourself.
1282 If it is not running, eval the output of ``gpg-agent --daemon`` in your shell
1283 prior to launching `git cola`.::
1285     eval $(gpg-agent --daemon)
1286     git cola
1288 SHELL COMPLETIONS
1289 =================
1291 Git Cola provides shell completions for zsh and bash.
1292 The completion scripts and instructions are included in Git Cola's
1293 `contrib` directory.
1295 * `Shell completion scripts <https://gitlab.com/git-cola/git-cola/-/tree/main/contrib>`_
1297 * `Setup instructions <https://gitlab.com/git-cola/git-cola/-/blob/main/contrib/README.md>`_
1299 WINDOWS NOTES
1300 =============
1302 Git Installation
1303 ----------------
1304 If Git is installed in a custom location, e.g. not installed in `C:/Git` or
1305 Program Files, then the path to Git must be configured by creating a file in
1306 your home directory `~/.config/git-cola/git-bindir` that points to your git
1307 installation.  e.g.::
1309     C:/Tools/Git/bin
1311 SSH Agents for Key-based Authentication
1312 ---------------------------------------
1313 You may need to setup ssh-agent in order to use SSH key-based authentication
1314 on Windows. It has been reported that starting OpenSSH agent in
1315 Windows Services and adding the key using Powershell are necessary in order
1316 to get things working.
1318 Please see the following links for more details.
1320 https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows
1322 FIPS SECURITY MODE
1323 ==================
1324 `FIPS Security Mode <https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/FIPS_Mode_-_an_explanation>`_
1325 is available in newer versions of Python. These include Python 3.9+ and the
1326 patched Python 3.6 used by CentOS8/RHEL8 (and possibly others).
1328 Git Cola uses the ``hashlib.md5`` function and adheres to the FIPS security
1329 mode when available. Git Cola does not use the MD5 value for security purposes.
1330 MD5 is used only for the purposes of implementing the ``cola/gravatar.py``
1331 Gravatar client.
1333 LINKS
1334 =====
1336 Git Cola's Git Repository
1337 -------------------------
1338 https://github.com/git-cola/git-cola/
1340 Git Cola Homepage
1341 -----------------
1342 https://git-cola.github.io/
1344 Mailing List
1345 ------------
1346 https://groups.google.com/group/git-cola