clone: clone into the parent directory by default
[git-cola.git] / docs / git-cola.rst
bloba8b35efa99f297c468a83974ec1ae36a6ea6cd64
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.notifyonpush
791 -----------------
792 Enable desktop notifications when commits are pushed using the "Push" dialog.
793 Set to ``true`` to enable desktop notifications.
794 Defaults to ``false``.
796 cola.dragencoding
797 -----------------
798 `git cola` encodes paths dragged from its widgets into `utf-16` when adding
799 them to the drag-and-drop mime data (specifically, the `text/x-moz-url` entry).
800 `utf-16` is used to make `gnome-terminal` see the right paths, but other
801 terminals may expect a different encoding.  If you are using a terminal that
802 expects a modern encoding, e.g. `terminator`, then set this value to `utf-8`.
804 cola.readsize
805 -------------
806 `git cola` avoids reading large binary untracked files.
807 The maximum size to read is controlled by `cola.readsize`
808 and defaults to `2048`.
810 cola.resizebrowsercolumns
811 -------------------------
812 `git cola` will automatically resize the file browser columns as folders are
813 expanded/collapsed when ``cola.resizebrowsercolumns`` is set to `true`.
815 cola.patchesdirectory
816 ---------------------
817 The default directory to use when exporting patches. Relative paths are treated
818 as being relative to the current repository. Absolute paths are used as-is.
819 Defaults to `patches`.
821 cola.safemode
822 -------------
823 The "Stage" button in the `git cola` Actions panel stages all files when it is
824 activated and no files are selected.  This can be problematic if it is
825 accidentally triggered after carefully preparing the index with staged
826 changes.  "Safe Mode" is enabled by setting `cola.safemode` to `true`.
827 When enabled, `git cola` will do nothing when "Stage" is activated without a
828 selection.  Defaults to `false`.
830 cola.savewindowsettings
831 -----------------------
832 `git cola` will remember its window settings when set to `true`.
833 Window settings and X11 sessions are saved in `$HOME/.config/git-cola`.
835 cola.showpath
836 -------------
837 `git cola` displays the absolute path of the repository in the window title.
838 This can be disabled by setting `cola.showpath` to `false`.
839 Defaults to `true`.
841 cola.signcommits
842 ----------------
843 `git cola` will sign commits by default when set `true`. Defaults to `false`.
844 See the section below on setting up GPG for more details.
846 cola.startupmode
847 ----------------
848 Control how the list of repositories is displayed in the startup dialog.
849 Set to `list` to view the list of repositories as a list, or `folder` to view
850 the list of repositories as a collection of folder icons.
851 Defaults to `list`.
853 cola.statusindent
854 -----------------
855 Set to `true` to indent files in the Status widget.  Files in the `Staged`,
856 `Modified`, etc. categories will be grouped in a tree-like structure.
857 Defaults to `false`.
859 cola.statusshowtotals
860 ---------------------
861 Set to `true` to display files counts in the Status widget's category titles.
862 Defaults to `false`.
864 cola.sync
865 ---------
866 Set to `false` to disable calling `os.fdatasync()`  / `os.fdata()` when saving
867 settings. Defaults to `true`, which means that these functions are called when windows
868 are closed and their settings are saved.
870 cola.tabwidth
871 -------------
872 The number of columns occupied by a tab character.  Defaults to 8.
874 cola.terminal
875 -------------
876 The command to use when launching commands within a graphical terminal.
878 `cola.terminal` defaults to `xterm -e` when unset.
879 e.g. when opening a shell, `git cola` will run `xterm -e $SHELL`.
881 `git cola` has built-in support for `xterm`, `gnome-terminal`, `konsole`.
882 If either `gnome-terminal`, `xfce4-terminal`, or `konsole` are installed
883 then they will be preferred over `xterm` when `cola.terminal` is unset.
885 The table below shows the built-in values that are used for the respective
886 terminal.  You can force the use of a specific terminal by configuring cola
887 accordingly.
889 cola.terminalshellquote
890 -----------------------
891 Some terminal require that the command string get passed as a string.
892 For example, ``xfce4-terminal -e "git difftool"`` requires shell quoting,
893 whereas ``gnome-terminal -- git difftool`` does not.
895 You should not need to set this variable for the built-in terminals
896 cola knows about -- it will behave correctly without configuration.
897 For example, when not configured, cola already knows that xfce4-terminal
898 requires shell quoting.
900 This configuration variable is for custom terminals outside of the builtin set.
901 The table below shows the builtin configuration.
903 .. code-block:: text
905     Terminal            cola.terminal           cola.terminalshellquote
906     --------            -------------           -----------------------
907     gnome-terminal      "gnome-terminal --"     false
908     konsole             "konsole -e"            false
909     xfce4-terminal      "xfce4-terminal -e"     true
910     xterm               "xterm -e"              false
913 cola.textwidth
914 --------------
915 The number of columns used for line wrapping.
916 Tabs are counted according to `cola.tabwidth`.
918 .. _cola_theme:
920 cola.theme
921 ----------
922 Specifies the GUI theme to use throughout `git cola`. The theme specified
923 must be one of the following values:
925 * `default` – default Qt theme, may appear different on various systems
926 * `flat-dark-blue`
927 * `flat-dark-green`
928 * `flat-dark-grey`
929 * `flat-dark-red`
930 * `flat-light-blue`
931 * `flat-light-green`
932 * `flat-light-grey`
933 * `flat-light-red`
935 If unset, or set to an invalid value, then the default style will be
936 used. The `default` theme is generated by Qt internal engine and should look
937 native but may look noticeably different on different platforms. The flat
938 themes on the other hand should look similar (but not identical) on various
939 systems.
941 The GUI theme can also be specified by passing ``--theme=<name>`` on the
942 command line.
944 cola.turbo
945 ----------
946 Set to `true` to enable "turbo" mode.  "Turbo" mode disables some
947 features that can slow things down when operating on huge repositories.
948 "Turbo" mode will skip loading Git commit messages, author details, status
949 information, and commit date details in the `File Browser` tool.
950 Defaults to `false`.
952 cola.color.text
953 ---------------
954 The default diff text color, in hexadecimal #RRGGBB notation.
955 Defaults to "#030303"::
957     git config cola.color.text '#030303'
959 cola.color.add
960 --------------
961 The default diff "add" background color, in hexadecimal #RRGGBB notation.
962 Defaults to "#d2ffe4"::
964     git config cola.color.add '#d2ffe4'
966 cola.color.remove
967 -----------------
968 The default diff "remove" background color, in hexadecimal #RRGGBB notation.
969 Defaults to "#fee0e4"::
971     git config cola.color.remove '#fee0e4'
973 cola.color.header
974 -----------------
975 The default diff header text color, in hexadecimal #RRGGBB notation.
976 Defaults to "#bbbbbb"::
978     git config cola.color.header '#bbbbbb'
980 commit.cleanup
981 --------------
982 Configure whether commit messages should be stripped of whitespace and comments.
984 Valid values are ``strip``, ``whitespace``, ``verbatim``, ``scissors`` or ``default``.
986 The ``default`` mode uses the ``whitespace`` mode when committing through Git Cola
987 and the ``strip`` mode when committing using the ``git commit`` command-line.
989 * ``strip`` - Strip leading and trailing empty lines, trailing whitespace,
990   commentary and collapse consecutive empty lines.
992 * ``whitespace`` - Same as strip except ``# commentary`` is not removed.
993   This is the ``default`` behavior when committing through `Git Cola`.
995 * ``verbatim`` - Do not change the message at all.
997 * ``scissors`` - Same as whitespace except that everything from (and including)
998   the line found below is truncated, if the message is to be edited.
999   "#" can be customized with ``core.commentChar``::
1001     # ------------------------ >8 ------------------------
1002     Scissor-lines and all following lines are removed.
1004 Changing the mode to ``whitespace`` can be useful when you always want to keep
1005 lines that begin with comment character ``#`` in your log message, even when
1006 committing using the command-line ``git commit``.
1008 On the contrary, if you always want to always strip comments, even when
1009 committing through Git Cola, then configure ``commit.cleanup`` to ``strip``.
1011 Please see the `git commit cleanup mode documentation
1012 <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---cleanupltmodegt>`_
1013 for more details.
1015 core.commentChar
1016 ----------------
1017 Commit messages can contain comments that start with this character.
1018 Defaults to ``#``.
1020 Please see the `git config documentation
1021 <https://git-scm.com/docs/git-config#Documentation/git-config.txt-corecommentChar>`_
1022 for more details.
1024 core.hooksPath
1025 --------------
1026 Hooks are programs you can place in a hooks directory to trigger actions at
1027 certain points in git’s execution. Hooks that don’t have the executable bit
1028 set are ignored.
1030 By default the hooks directory is ``$GIT_DIR/hooks``, but that can
1031 be changed via the ``core.hooksPath`` configuration variable
1033 The ``cola-prepare-commit-msg`` hook functionality and Cola's Git LFS
1034 detection honors this configuration.
1036 Please see the `git hooks documentation <https://git-scm.com/docs/githooks>`_
1037 for more details.
1039 gui.diffcontext
1040 ---------------
1041 The number of diff context lines to display.
1043 gui.displayuntracked
1044 --------------------
1045 `git cola` avoids showing untracked files when set to `false`.
1047 gui.editor
1048 ----------
1049 The default text editor to use is defined in `gui.editor`.
1050 The config variable overrides the VISUAL environment variable.
1051 Defaults to `gvim -f -p`.
1053 gui.historybrowser
1054 ------------------
1055 The history browser to use when visualizing history.
1056 Defaults to `gitk`.
1058 diff.tool
1059 ---------
1060 The default diff tool to use.
1062 merge.tool
1063 ----------
1064 The default merge tool to use.
1066 user.email
1067 ----------
1068 Your email address to be recorded in any newly created commits.
1069 Can be overridden by the 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_EMAIL', and
1070 'EMAIL' environment variables.
1072 user.name
1073 ---------
1074 Your full name to be recorded in any newly created commits.
1075 Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
1076 environment variables.
1079 ENVIRONMENT VARIABLES
1080 =====================
1082 GIT_COLA_ICON_THEME
1083 -------------------
1084 When set in the environment, `GIT_COLA_ICON_THEME` overrides the
1085 theme specified in the `cola.icontheme` configuration.
1086 Read :ref:`cola_icontheme` for more details.
1088 GIT_COLA_SCALE
1089 --------------
1090 .. Important:: `GIT_COLA_SCALE` should not be used with newer versions of Qt.
1092     Set `QT_AUTO_SCREEN_SCALE_FACTOR` to `1` and Qt will automatically
1093     scale the interface to the correct size based on the display DPI.
1094     This option is also available by setting `cola.hidpi` configuration.
1096     See the `Qt High DPI documentation <https://doc.qt.io/qt-5/highdpi.html>`_
1097     for more details.
1099 `git cola` can be made to scale its interface for HiDPI displays.
1100 When defined, `git cola` will scale icons, radio buttons, and checkboxes
1101 according to the scale factor.  The default value is `1`.
1102 A good value is `2` for high-resolution displays.
1104 Fonts are not scaled, as their size can already be set in the settings.
1106 GIT_COLA_TRACE
1107 --------------
1108 When defined, `git cola` logs `git` commands to stdout.
1109 When set to `full`, `git cola` also logs the exit status and output.
1110 When set to `trace`, `git cola` logs to the `Console` widget.
1112 VISUAL
1113 ------
1114 Specifies the default editor to use.
1115 This is ignored when the `gui.editor` configuration variable is defined.
1117 LANGUAGE SETTINGS
1118 =================
1119 `git cola` automatically detects your language and presents some
1120 translations when available.  This may not be desired, or you
1121 may want `git cola` to use a specific language.
1123 You can make `git cola` use an alternative language by creating a
1124 `~/.config/git-cola/language` file containing the standard two-letter
1125 gettext language code, e.g. "en", "de", "ja", "zh", etc.::
1127     mkdir -p ~/.config/git-cola &&
1128     echo en >~/.config/git-cola/language
1130 Alternatively you may also use LANGUAGE environmental variable to temporarily
1131 change `git cola`'s language just like any other gettext-based program.  For
1132 example to temporarily change `git cola`'s language to English::
1134     LANGUAGE=en git cola
1136 To make `git cola` use the zh_TW translation with zh_HK, zh, and en as a
1137 fallback.::
1139     LANGUAGE=zh_TW:zh_HK:zh:en git cola
1142 CUSTOM GUI ACTIONS
1143 ==================
1144 `git cola` allows you to define custom GUI actions by setting `git config`
1145 variables.  The "name" of the command appears in the "Actions" menu.
1147 guitool.<name>.cmd
1148 ------------------
1149 Specifies the shell command line to execute when the corresponding item of the
1150 Tools menu is invoked. This option is mandatory for every tool. The command is
1151 executed from the root of the working directory, and in the environment it
1152 receives the name of the tool as GIT_GUITOOL, the name of the currently
1153 selected file as FILENAME, and the name of the current branch as CUR_BRANCH
1154 (if the head is detached, CUR_BRANCH is empty).
1156 If ``<name>`` contains slashes (``/``) then the leading part of the name,
1157 up until the final slash, is treated like a path of sub-menus under which the
1158 actions will be created.
1160 For example, configuring ``guitool.Commands/Util/echo.cmd`` creates a
1161 ``Commands`` menu inside the top-level ``Actions`` menu, a ``Util`` menu
1162 inside the ``Commands`` menu and an ``echo`` action inside the ``Commands``
1163 sub-menu.
1165 guitool.<name>.background
1166 -------------------------
1167 Run the command in the background (similar to editing and difftool actions).
1168 This avoids blocking the GUI.  Setting `background` to `true` implies
1169 `noconsole` and `norescan`.
1171 guitool.<name>.needsfile
1172 ------------------------
1173 Run the tool only if a diff is selected in the GUI. It guarantees that
1174 FILENAME is not empty.
1176 guitool.<name>.noconsole
1177 ------------------------
1178 Run the command silently, without creating a window to display its output.
1180 guitool.<name>.norescan
1181 -----------------------
1182 Don’t rescan the working directory for changes after the tool finishes
1183 execution.
1185 guitool.<name>.confirm
1186 ----------------------
1187 Show a confirmation dialog before actually running the tool.
1189 guitool.<name>.argprompt
1190 ------------------------
1191 Request a string argument from the user, and pass it to the tool through the
1192 ARGS environment variable. Since requesting an argument implies confirmation,
1193 the confirm option has no effect if this is enabled. If the option is set to
1194 true, yes, or 1, the dialog uses a built-in generic prompt; otherwise the
1195 exact value of the variable is used.
1197 guitool.<name>.revprompt
1198 ------------------------
1199 Request a single valid revision from the user, and set the REVISION
1200 environment variable. In other aspects this option is similar to argprompt,
1201 and can be used together with it.
1203 guitool.<name>.revunmerged
1204 --------------------------
1205 Show only unmerged branches in the revprompt sub-dialog. This is useful for
1206 tools similar to merge or rebase, but not for things like checkout or reset.
1208 guitool.<name>.title
1209 --------------------
1210 Specifies the title to use for the prompt dialog.
1211 Defaults to the tool name.
1213 guitool.<name>.prompt
1214 ---------------------
1215 Specifies the general prompt string to display at the top of the dialog,
1216 before subsections for argprompt and revprompt.
1217 The default value includes the actual command.
1219 guitool.<name>.shortcut
1220 -----------------------
1221 Specifies a keyboard shortcut for the custom tool.
1223 The value must be a valid string understood by the `QAction::setShortcut()` API.
1224 See https://doc.qt.io/qt-6/qkeysequence.html#toString
1225 for more details about the supported values.
1227 Avoid creating shortcuts that conflict with existing built-in `git cola`
1228 shortcuts.  Creating a conflict will result in no action when the shortcut
1229 is used.
1232 SETTING UP CREDENTIAL HELPERS
1233 =============================
1234 Git has robust support for automatically handling credentials.
1236 The recommended approach is to use SSH keys and an SSH agent, but any of the core Git
1237 Credentials helpers will get used automatically by Git Cola.
1239 See https://git-scm.com/doc/credential-helpers for more details.
1242 SETTING UP GPG FOR SIGNED COMMITS
1243 =================================
1244 When creating signed commits, `gpg` will attempt to read your password from the
1245 terminal from which `git cola` was launched.
1246 The way to make this work smoothly is to use a GPG agent so that you can avoid
1247 needing to re-enter your password every time you commit.
1249 This also gets you a graphical passphrase prompt instead of getting prompted
1250 for your password in the terminal.
1252 Install gpg-agent and friends
1253 -----------------------------
1254 On Mac OS X, you may need to `brew install gpg-agent` and install the
1255 `Mac GPG Suite <https://gpgtools.org/macgpg2/>`_.
1257 On Linux use your package manager to install gnupg2,
1258 gnupg-agent and pinentry-qt, e.g.::
1260     sudo apt-get install gnupg2 gnupg-agent pinentry-qt
1262 On Linux, you should also configure Git so that it uses gpg2 (gnupg2),
1263 otherwise you will get errors mentioning, "unable to open /dev/tty".
1264 Set Git's `gpg.program` to `gpg2`::
1266     git config --global gpg.program gpg2
1268 Configure gpg-agent and a pin-entry program
1269 -------------------------------------------
1270 On Mac OS X, edit `~/.gnupg/gpg.conf` to include the line,::
1272     use-agent
1274 This is typically not needed on Linux, where `gpg2` is used, as
1275 this is the default value when using `gpg2`.
1277 Next, edit `~/.gnupg/gpg-agent.conf` to contain a pinentry-program line
1278 pointing to the pinentry program for your platform.
1280 The following example `~/.gnupg/gpg-agent.conf` shows how to use
1281 pinentry-gtk-2 on Linux::
1283     pinentry-program /usr/bin/pinentry-gtk-2
1284     default-cache-ttl 3600
1286 This following example `.gnupg/gpg-agent.conf` shows how to use MacGPG2's
1287 pinentry app on On Mac OS X::
1289     pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
1290     default-cache-ttl 3600
1291     enable-ssh-support
1292     use-standard-socket
1294 Once this has been set up then you will need to reload your gpg-agent config::
1296     echo RELOADAGENT | gpg-connect-agent
1298 If you see the following output::
1300     OK
1302 Then the daemon is already running, and you do not need to start it yourself.
1304 If it is not running, eval the output of ``gpg-agent --daemon`` in your shell
1305 prior to launching `git cola`.::
1307     eval $(gpg-agent --daemon)
1308     git cola
1311 SHELL COMPLETIONS
1312 =================
1314 Git Cola provides shell completions for zsh and bash.
1315 The completion scripts and instructions are included in Git Cola's
1316 `contrib` directory.
1318 * `Shell completion scripts <https://gitlab.com/git-cola/git-cola/-/tree/main/contrib>`_
1320 * `Setup instructions <https://gitlab.com/git-cola/git-cola/-/blob/main/contrib/README.md>`_
1323 WINDOWS NOTES
1324 =============
1326 Git Installation
1327 ----------------
1328 If Git is installed in a custom location, e.g. not installed in `C:/Git` or
1329 Program Files, then the path to Git must be configured by creating a file in
1330 your home directory `~/.config/git-cola/git-bindir` that points to your git
1331 installation, e.g.::
1333     C:/Tools/Git/bin
1335 SSH Agents for Key-based Authentication
1336 ---------------------------------------
1337 You may need to setup ssh-agent in order to use SSH key-based authentication
1338 on Windows. It has been reported that starting OpenSSH agent in
1339 Windows Services and adding the key using Powershell are necessary in order
1340 to get things working.
1342 Please see the following links for more details.
1344 https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows
1347 FIPS SECURITY MODE
1348 ==================
1350 `FIPS Security Mode <https://github.com/python/cpython/issues/53462>`_
1351 is available in newer versions of Python. These include Python 3.9+ and the
1352 patched Python 3.6 used by CentOS8/RHEL8 (and possibly others).
1354 Git Cola uses the ``hashlib.md5`` function and adheres to the FIPS security
1355 mode when available. Git Cola does not use the MD5 value for security purposes.
1356 MD5 is used only for the purposes of implementing the ``cola/gravatar.py``
1357 Gravatar client.
1360 LINKS
1361 =====
1363 Git Cola's Git Repository
1364 -------------------------
1365 * `Primary repository <https://gitlab.com/git-cola/git-cola/>_`.
1366 * `Mirror repository <https://github.com/git-cola/git-cola/>_`.
1369 Git Cola Homepage
1370 -----------------
1371 https://git-cola.gitlab.io/