Merge pull request #1212 from davvid/dev
[git-cola.git] / README.md
blobbd90c76490fe36851cdecf218163dbaa50321997
1 # git-cola: The highly caffeinated Git GUI
3 Git Cola is a powerful Git GUI with a slick and intuitive user interface.
5     git clone https://github.com/git-cola/git-cola
7 [![Build status](https://github.com/git-cola/git-cola/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/git-cola/git-cola/actions/workflows/main.yml)
9 * [Screenshots](https://git-cola.github.io/screenshots.html)
11 * [Downloads](https://git-cola.github.io/downloads.html)
14 # Documentation
16 * [Keyboard shortcuts](https://git-cola.github.io/share/doc/git-cola/hotkeys.html)
18 * [HTML documentation](https://git-cola.readthedocs.io/en/latest/)
20 * [Git Cola documentation](share/doc/git-cola/git-cola.rst)
22 * [Git DAG documentation](share/doc/git-cola/git-dag.rst)
24 * [Contributing guidelines](CONTRIBUTING.md)
27 # Requirements
29 ## Build
31 * [Sphinx](http://sphinx-doc.org/) is used to generate the documentation.
33 ## Runtime
35 * [Git](https://git-scm.com/) 2.2.0 or newer.
37 * [Python](https://python.org/) 3.6 or newer.
39 * [QtPy](https://github.com/spyder-ide/qtpy) 1.1.0 or newer.
41 Git Cola uses QtPy, so you can choose between PyQt5 and PySide2 by setting
42 the `QT_API` environment variable to `pyqt5` or `pyside2` as desired.
43 `qtpy` defaults to `pyqt5` and falls back to `pyside2` if `pyqt5` is not installed.
45 Any of the following Python Qt libraries must be installed:
47 * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/download5)
48   5.6 or newer.
50 * [PySide2](https://github.com/PySide/PySide)
51   5.11.0 or newer.
54 ## Optional Features
56 Git Cola enables additional features when the following
57 Python modules are installed.
59 [send2trash](https://github.com/hsoft/send2trash) enables cross-platform
60 "Send to Trash" functionality.
63 # Installation
65 You can install the latest released version using `pip`:
67     pip install git-cola
69 You can use `pip install .` to install the latest version from source.
71 Once you have `git-cola` installed in your `$PATH` then you can launch it like any other
72 `git` built-in command:
74     git cola
75     git dag
77 ## Python Virtual Environments
79 If you don't have PyQt installed then the easiest way to get it is to use a Python
80 virtualenv and install Git Cola inside of it.
82     # Create a virtualenv called "env3" and activate it.
83     python3 -m venv env3
84     source env3/bin/activate
86     # One-time setup: install optional requirements.
87     pip install -r requirements/requirements-optional.txt
89     # Generate the i18n translations.
90     make
92     # Install cola in "editable" mode so that it uses the source tree.
93     pip install --editable .
95     # Run Git Cola.
96     git cola
98 If you add `$PWD/env3/bin` (or add a symlink to the `$PWD/env3/bin/git-cola` script) to
99 your `$PATH` then you can run `git cola` as if it were a builtin `git` command without
100 needing to have the virtualenv activated.
102 ## Standalone Installation
104 Running `make install` will install Git Cola in your `$HOME` directory
105 (`$HOME/bin/git-cola`, `$HOME/share/git-cola`, etc).
107 If you want to do a global install you can do
109     make prefix=/usr/local install
111 The `Makefile` also supports `DESTDIR`:
113     make DESTDIR=/tmp/stage prefix=/usr/local install
115 ## Linux
117 Linux is it! Your distro has probably already packaged git-cola.
118 If not, please file a bug against your distribution ;-)
120 ### Arch
122 Available in the [AUR](https://aur.archlinux.org/packages/git-cola/).
124 ### Debian, Ubuntu
126     apt install git-cola
128 ### Fedora
130     dnf install git-cola
132 ### Gentoo
134     emerge git-cola
136 ### OpenSUSE, SLE
138     zypper install git-cola
140 ### Slackware
142 Available in [SlackBuilds.org](http://slackbuilds.org/result/?search=git-cola).
144 ### Ubuntu
146 [See here](https://packages.ubuntu.com/search?keywords=git-cola) for the
147 versions that are available in Ubuntu's repositories.
149 There was a [PPA by @pavreh](https://launchpad.net/~pavreh/+archive/ubuntu/git-cola)
150 but it has not been updated for a while.
153 ## FreeBSD
155     # install from official binary packages
156     pkg install -r FreeBSD devel/git-cola
158     # build from source
159     cd /usr/ports/devel/git-cola && make clean install
161 ## macOS
163 [Homebrew](https://brew.sh/) is the easiest way to install
164 Git Cola's PyQt5 dependencies.  We will use Homebrew to install
165 the git-cola recipe, but build our own .app bundle from source.
167 [Sphinx](http://sphinx-doc.org/latest/install.html) is used to build the
168 documentation.
170     brew install sphinx-doc
171     brew install git-cola
173 Once brew has installed `git-cola` you can:
175 1. Clone the git-cola repositroy
177     git clone https://github.com/git-cola/git-cola
178     cd git-cola
180 2. Build the git-cola.app application bundle
182     make \
183         PYTHON=$(brew --prefix python3)/bin/python3 \
184         PYTHON_CONFIG=$(brew --prefix python3)/bin/python3-config \
185         SPHINXBUILD=$(brew --prefix sphinx-doc)/bin/sphinx-build \
186         git-cola.app
188 3. Copy it to /Applications
190     rsync -ar --delete git-cola.app/ /Applications/git-cola.app/
192 Newer versions of Homebrew install their own `python3` installation and
193 provide the `PyQt5` modules for `python3` only.  You have to use
194 `python3 ./bin/git-cola` when running from the source tree.
196 ### Upgrading using Homebrew
198 If you upgrade using `brew` then it is recommended that you re-install
199 Git Colaa's dependencies when upgrading.  Re-installing ensures that the
200 Python modules provided by Homebrew will be properly set up.
202 A quick fix when upgrading to newer versions of XCode or macOS is to
203 reinstall pyqt5.
205     brew reinstall pyqt@5
207 You may also need to relink your pyqt installation:
209     brew link pyqt@5
211 This is required when upgrading to a modern (post-10.11 El Capitan) Mac OS X.
212 Homebrew now bundles its own Python3 installation instead of using the
213 system-provided default Python.
215 If the "brew reinstall" command above does not work then re-installing from
216 scratch using the instructions below should get things back in shape.
218     # update homebrew
219     brew update
221     # uninstall git-cola and its dependencies
222     brew uninstall git-cola
223     brew uninstall pyqt5
224     brew uninstall sip
226     # re-install git-cola and its dependencies
227     brew install git-cola
229 ## Windows
231 IMPORTANT If you have a 64-bit machine, install the 64-bit versions only.
232 Do not mix 32-bit and 64-bit versions.
234 Download and install the following:
236 * [Git for Windows](https://git-for-windows.github.io/)
238 * [Git Cola](https://github.com/git-cola/git-cola/releases)
240 Once these are installed you can run Git Cola from the Start menu.
242 See "Windows (Continued)" below for more details.
245 # Goodies
247 Git Cola ships with an interactive rebase editor called `git-cola-sequence-editor`.
248 `git-cola-sequence-editor` is used to reorder and choose commits when rebasing.
249 Start an interactive rebase through the "Rebase" menu, or through the
250 `git cola rebase` sub-command to use the `git-cola-sequence-editor`:
252     git cola rebase @{upstream}
254 `git-cola-sequence-editor` can be launched independently of git cola by telling
255 `git rebase` to use it as its editor through the `GIT_SEQUENCE_EDITOR`
256 environment variable:
258     export GIT_SEQUENCE_EDITOR="$HOME/git-cola/bin/git-cola-sequence-editor"
259     git rebase -i @{upstream}
262 # Git Cola Sub-commands
264 The `git-cola` command exposes various sub-commands that allow you to quickly
265 launch tools that are available from within the git-cola interface.
266 For example, `git cola find` launches the file finder,
267 and `git cola grep` launches the grep tool.
269 See `git cola --help-commands` for the full list of commands.
271     $ git cola --help-commands
272     usage: git-cola [-h]
273     
274                     {cola,am,archive,branch,browse,config,
275                      dag,diff,fetch,find,grep,merge,pull,push,
276                      rebase,remote,search,stash,tag,version}
277                     ...
278     
279     valid commands:
280       {cola,am,archive,branch,browse,config,
281        dag,diff,fetch,find,grep,merge,pull,push,
282        rebase,remote,search,stash,tag,version}
284         cola                start git-cola
285         am                  apply patches using "git am"
286         archive             save an archive
287         branch              create a branch
288         browse              browse repository
289         config              edit configuration
290         dag                 start git-dag
291         diff                view diffs
292         fetch               fetch remotes
293         find                find files
294         grep                grep source
295         merge               merge branches
296         pull                pull remote branches
297         push                push remote branches
298         rebase              interactive rebase
299         remote              edit remotes
300         search              search commits
301         stash               stash and unstash changes
302         tag                 create tags
303         version             print the version
305 ## Development
307 If you already have Git Cola's dependencies installed then you can 
308 start `cola` as a Python module if you have the source code available.
310     python -m cola
311     python -m cola dag
314 The following commands should be run during development:
316     # Run the unit tests
317     $ make test
319     # Run tests and longer-running pylint and flake8 checks
320     $ make check
322     # Run tests against multiple python interpreters using tox
323     $ make tox
325 The test suite can be found in the [test](test) directory.
327 Commits and pull requests are automatically tested for code quality
328 using [GitHub Actions](https://github.com/git-cola/git-cola/actions/workflows/main.yml).
330 Auto-format `po/*.po` files before committing when updating translations:
332     $ make po
334 When submitting patches, consult the
335 [contributing guidelines](CONTRIBUTING.md).
338 ## Packaging Notes
340 Git Cola installs its modules into the default Python site-packages directory
341 (eg. `lib/python3.7/site-packages`) using setuptools.
343 While end-users can use `pip install git-cola` to install Git Cola, distribution
344 packagers should use the `make prefix=/usr` install process. Git Cola's `Makefile` wraps
345 `python setup.py install --single-version-externally-managed` to provide a
346 packaging-friendly `make install` target.
349 # Windows (Continued)
351 ## Microsoft Visual C++ 2015 Redistributable
353 Earlier versions of Git Cola may have shipped without `vcruntime140.dll`  and may
354 not run on machines that are missing this DLL.
356 To fix this, download the
357 [Microsoft Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=52685)
358 and install it
360 Git Cola v4.0.0 and newer include this DLL and do not require this to be installed
361 separately.
363 ## Development
365 In order to develop Git Cola on Windows you will need to install
366 Python3 and pip.  Install PyQt5 using `pip install PyQt5`
367 to make the PyQt5 bindings available to Python.
369 Once these are installed you can use `python.exe` to run
370 directly from the source tree.  For example, from a Git Bash terminal:
372     /c/Python36/python.exe ./bin/git-cola
374 ## Multiple Python versions
376 If you have multiple versions of Python installed, the `contrib/win32/cola`
377 launcher script might choose the newer version instead of the python
378 that has PyQt installed.  In order to resolve this, you can set the
379 `cola.pythonlocation` git configuration variable to tell cola where to
380 find python.  For example:
382     git config --global cola.pythonlocation /c/Python39
384 ## Building Windows Installers
386 Windows installers are built using
388 * [Pynsist](https://pynsist.readthedocs.io/en/latest/).
390 * [NSIS](http://nsis.sourceforge.net/Main_Page) is also needed.
392 To build the installer using Pynsist run:
394     ./contrib/win32/run-pynsist.sh
396 This will generate an installer in `build/nsis/`.
398 ## Windows "History Browser" Configuration Upgrade
400 You may need to configure your history browser if you are upgrading from an
401 older version of Git Cola on Windows.
403 `gitk` was originally the default history browser, but `gitk` cannot be
404 launched as-is on Windows because `gitk` is a shell script.
406 If you are configured to use `gitk`, then change your configuration to
407 go through Git's `sh.exe` on Windows.  Similarly, we must go through
408 `python.exe` if we want to use `git-dag`.
410 If you want to use gitk as your history browser open the
411 Preferences screen and change the history browser command to:
413     "C:/Program Files/Git/bin/sh.exe" --login -i C:/Git/bin/gitk
415 `git-dag` became the default history browser on Windows in `v2.3`, so new
416 users do not need to configure anything.