thanks: add Nanda to the credits
[git-cola.git] / README.md
blob6ee28e198213d3e65fdeebbf2919445709fcabce
1 # git-cola: The highly caffeinated Git GUI
3     git-cola is a powerful Git GUI with a slick and intuitive user interface.
5     Copyright (C) 2007-2020, David Aguilar and contributors
7     This program is free software: you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation, either version 2 of the License, or
10     (at your option) any later version.
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
17     You should have received a copy of the GNU General Public License
18     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 ## SCREENSHOTS
22 Screenshots are available on the
23 [git-cola screenshots page](https://git-cola.github.io/screenshots.html).
25 ## DOWNLOAD
27     apt install git-cola
29 New releases are available on the
30 [git-cola download page](https://git-cola.github.io/downloads.html).
32 ## FORK
34     git clone git://github.com/git-cola/git-cola.git
36 [![git-cola build status](https://api.travis-ci.org/git-cola/git-cola.svg?branch=main)](https://travis-ci.org/git-cola/git-cola)
38 [git-cola on github](https://github.com/git-cola/git-cola)
40 [git-cola google group](https://groups.google.com/group/git-cola/)
43 # NUTRITIONAL FACTS
45 ## ACTIVE INGREDIENTS
47 * [git](https://git-scm.com/) 1.6.3 or newer.
49 * [Python](https://python.org/) 2.6 or newer (Python 2+3 compatible).
51 * [QtPy](https://github.com/spyder-ide/qtpy) 1.1.0 or newer.
53 * [argparse](https://pypi.python.org/pypi/argparse) 1.1 or newer.
54   argparse is part of the stdlib in Python 2.7; install argparse separately if
55   you are running on Python 2.6.
57 * [Sphinx](http://sphinx-doc.org/) for building the documentation.
59 git-cola uses QtPy, so you can choose between PyQt4, PyQt5, and
60 PySide by setting the `QT_API` environment variable to `pyqt4`, `pyqt5` or
61 `pyside` as desired.  `qtpy` defaults to `pyqt5` and falls back to `pyqt4`
62 if `pyqt5` is not installed.
64 Any of the following Python Qt libraries must be installed:
66 * [PyQt4](https://www.riverbankcomputing.com/software/pyqt/download)
67   4.6 or newer
69 * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/download5)
70   5.2 or newer
72 * [PySide](https://github.com/PySide/PySide)
73   1.1.0 or newer
75 Set `QT_API=pyqt4` in your environment if you have both
76 versions of PyQt installed and want to ensure that PyQt4 is used.
78 ## ADDITIVES
80 git-cola enables additional features when the following
81 Python modules are installed.
83 [send2trash](https://github.com/hsoft/send2trash) enables cross-platform
84 "Send to Trash" functionality.
86 # BREWING INSTRUCTIONS
88 ## RUN FROM SOURCE
90 You don't need to install git-cola to run it.
91 Running git-cola from its source tree is the easiest
92 way to try the latest version.
94     git clone git://github.com/git-cola/git-cola.git
95     cd git-cola
96     ./bin/git-cola
97     ./bin/git-dag
99 You can also start `cola` as a Python module if Python can find it.
101     cd git-cola
102     python -m cola
103     python -m cola dag
105 Having git-cola's `bin/` directory in your path allows you to run
106 `git cola` like a regular built-in Git command:
108     # Replace "$PWD/bin" with the path to git-cola's bin/ directory
109     PATH="$PWD/bin":"$PATH"
110     export PATH
112     git cola
113     git dag
115 The instructions below assume that you have git-cola present in your
116 `$PATH`.  Replace "git cola" with "./bin/git-cola" as needed if you'd like to
117 just run it in-place.
119 # DOCUMENTATION
121 * [HTML documentation](https://git-cola.readthedocs.io/en/latest/)
123 * [git-cola manual](share/doc/git-cola/git-cola.rst)
125 * [git-dag manual](share/doc/git-cola/git-dag.rst)
127 * [Keyboard shortcuts](https://git-cola.github.io/share/doc/git-cola/hotkeys.html)
129 * [Contributing guidelines](CONTRIBUTING.md)
131 # INSTALLATION
133 Normally you can just do "make install" to install git-cola
134 in your `$HOME` directory (`$HOME/bin`, `$HOME/share`, etc).
135 If you want to do a global install you can do
137     make prefix=/usr install
139 The platform-specific installation methods below use the native
140 package manager.  You should use one of these so that all of git-cola's
141 dependencies are installed.
143 Distutils is used by the `Makefile` via `setup.py` to install git-cola and
144 its launcher scripts.  distutils replaces the `#!/usr/bin/env python` lines in
145 scripts with the full path to python at build time, which can be undesirable
146 when the runtime python is not the same as the build-time python.  To disable
147 the replacement of the `#!/usr/bin/env python` lines, pass `USE_ENV_PYTHON=1`
148 to `make`.
150 ## LINUX
152 Linux is it! Your distro has probably already packaged git-cola.
153 If not, please file a bug against your distribution ;-)
155 ### arch
157 Available in the [AUR](https://aur.archlinux.org/packages/git-cola/).
159 ### debian, ubuntu
161     apt install git-cola
163 ### fedora
165     dnf install git-cola
167 ### gentoo
169     emerge git-cola
171 ### opensuse, sle
173     zypper install git-cola
175 ### slackware
177 Available in [SlackBuilds.org](http://slackbuilds.org/result/?search=git-cola).
179 ### FreeBSD
181     # install from official binary packages
182     pkg install -r FreeBSD devel/git-cola
183     # build from source
184     cd /usr/ports/devel/git-cola && make clean install
186 ## Ubuntu
188 See https://packages.ubuntu.com/search?keywords=git-cola for the versions that
189 are available by default. There was a [PPA](https://launchpad.net/~pavreh/+archive/ubuntu/git-cola)
190 maintained by @pavreh, but it has not been update for a while.
192 ## MAC OS X
194 [Homebrew](https://brew.sh/) is the easiest way to install
195 git-cola's Qt4 and PyQt4 dependencies.  We will use Homebrew to install
196 the git-cola recipe, but build our own .app bundle from source.
198 [Sphinx](http://sphinx-doc.org/latest/install.html) is used to build the
199 documentation.
201     brew install sphinx-doc
202     brew install git-cola
204 Once brew has installed git-cola you can:
206 1. Clone git-cola
208     `git clone git://github.com/git-cola/git-cola.git && cd git-cola`
210 2. Build the git-cola.app application bundle
212     ```
213     make \
214         PYTHON=$(brew --prefix python3)/bin/python3 \
215         PYTHON_CONFIG=$(brew --prefix python3)/bin/python3-config \
216         SPHINXBUILD=$(brew --prefix sphinx-doc)/bin/sphinx-build \
217         git-cola.app
218    ```
220 3. Copy it to /Applications
222     `rm -fr /Applications/git-cola.app && cp -r git-cola.app /Applications`
224 Newer versions of Homebrew install their own `python3` installation and
225 provide the `PyQt5` modules for `python3` only.  You have to use
226 `python3 ./bin/git-cola` when running from the source tree.
228 ### UPGRADING USING HOMEBREW
230 If you upgrade using `brew` then it is recommended that you re-install
231 git-cola's dependencies when upgrading.  Re-installing ensures that the
232 Python modules provided by Homebrew will be properly set up.
234 A quick fix when upgrading to newer versions of XCode or macOS is to
235 reinstall pyqt5.
237     brew reinstall pyqt@5
239 You may also need to relink your pyqt installation:
241     brew link pyqt@5
243 This is required when upgrading to a modern (post-10.11 El Capitan) Mac OS X.
244 Homebrew now bundles its own Python3 installation instead of using the
245 system-provided default Python.
247 If the "brew reinstall" command above does not work then re-installing from
248 scratch using the instructions below should get things back in shape.
250     # update homebrew
251     brew update
253     # uninstall git-cola and its dependencies
254     brew uninstall git-cola
255     brew uninstall pyqt5
256     brew uninstall sip
258     # re-install git-cola and its dependencies
259     brew install git-cola
261 ## WINDOWS INSTALLATION
263 IMPORTANT If you have a 64-bit machine, install the 64-bit versions only.
264 Do not mix 32-bit and 64-bit versions.
266 Download and install the following:
268 * [Git for Windows](https://git-for-windows.github.io/)
270 * [Git Cola](https://github.com/git-cola/git-cola/releases)
272 Once these are installed you can run Git Cola from the Start menu.
274 See "WINDOWS (continued)" below for more details.
276 # GOODIES
278 git cola ships with an interactive rebase editor called `git-cola-sequence-editor`.
279 `git-cola-sequence-editor` is used to reorder and choose commits when rebasing.
280 Start an interactive rebase through the "Rebase" menu, or through the
281 `git cola rebase` sub-command to use the `git-cola-sequence-editor`:
283     git cola rebase origin/main
285 git-cola-sequence-editor can be launched independently of git cola by telling
286 `git rebase` to use it as its editor through the `GIT_SEQUENCE_EDITOR`
287 enviironment variable:
289     env GIT_SEQUENCE_EDITOR="$PWD/bin/git-cola-sequence-editor" \
290     git rebase -i origin/main
292 # COMMAND-LINE TOOLS
294 The git-cola command exposes various sub-commands that allow you to quickly
295 launch tools that are available from within the git-cola interface.
296 For example, `./bin/git-cola find` launches the file finder,
297 and `./bin/git-cola grep` launches the grep tool.
299 See `git cola --help-commands` for the full list of commands.
301     $ git cola --help-commands
302     usage: git-cola [-h]
303     
304                     {cola,am,archive,branch,browse,config,
305                      dag,diff,fetch,find,grep,merge,pull,push,
306                      rebase,remote,search,stash,tag,version}
307                     ...
308     
309     valid commands:
310       {cola,am,archive,branch,browse,config,
311        dag,diff,fetch,find,grep,merge,pull,push,
312        rebase,remote,search,stash,tag,version}
314         cola                start git-cola
315         am                  apply patches using "git am"
316         archive             save an archive
317         branch              create a branch
318         browse              browse repository
319         config              edit configuration
320         dag                 start git-dag
321         diff                view diffs
322         fetch               fetch remotes
323         find                find files
324         grep                grep source
325         merge               merge branches
326         pull                pull remote branches
327         push                push remote branches
328         rebase              interactive rebase
329         remote              edit remotes
330         search              search commits
331         stash               stash and unstash changes
332         tag                 create tags
333         version             print the version
335 ## HACKING
337 The following commands should be run during development:
339     # Run the unit tests
340     $ make test
342     # Run tests and longer-running pylint and flake8 checks
343     $ make check
345     # Run tests against multiple python interpreters using tox
346     $ make tox
348 The test suite can be found in the [test](test) directory.
350 The tests are set up to run automatically when code is pushed using
351 [Travis CI](https://travis-ci.org/git-cola/git-cola).
352 Checkout the [Travis config file](.travis.yml) for more details.
354 Auto-format `po/*.po` files before committing when updating translations:
356     $ make po
358 When submitting patches, consult the
359 [contributing guidelines](CONTRIBUTING.md).
361 ## SOURCE INSTALL
363 For Linux/Unix-like environments with symlinks, an easy way to use the latest
364 `git cola` is to keep a clone of the repository and symlink it into your
365 `~/bin` directory.  If `$HOME/bin` is not already in your `$PATH` you can
366 add these two lines to the bottom of your `~/.bashrc` to make the linked
367 tools available.
369         PATH="$HOME/bin":"$PATH"
370         export PATH
372 Then, install git-cola by linking it into your `~/bin`:
374         mkdir -p ~/src ~/bin
375         git clone git://github.com/git-cola/git-cola.git ~/src/git-cola
376         (cd ~/bin &&
377          ln -s ../src/git-cola/bin/git-cola &&
378          ln -s ../src/git-cola/bin/git-dag)
380 You should then get the latest `git cola` in your shell.
383 ## PACKAGING NOTES
385 Git Cola installs its modules into the default Python site-packages directory
386 (eg. `lib/python2.7/site-packages`), and in its own private `share/git-cola/lib`
387 area by default.  The private modules are redundant and not needed when cola's modules
388 have been installed into the site-packages directory.
390 Git Cola will prefer its private modules when the `share/git-cola/lib` directory
391 exists, but they are not required to exist.  This directory is optional, and can
392 be safely removed if the cola modules have been installed into site-pacakges
393 and are importable through the default `sys.path`.
395 To suppress the installation of the private (redundant) `share/git-cola/lib/cola`
396 package, specify `make NO_PRIVATE_LIBS=1 ...` when invoking `make`,
397 or export `GIT_COLA_NO_PRIVATE_LIBS=1` into the build enviornment.
399     make NO_PRIVATE_LIBS=1 ...
401 Git Cola installs a vendored copy of its QtPy dependency by default.
402 Git Cola provides a copy of the `qtpy` module in its private modules area
403 when installing Git Cola so that you are not required to install QtPy separately.
404 If you'd like to provide your own `qtpy` module, for example from the `python-qtpy`
405 Debian package, then specify `make NO_VENDOR_LIBS=1 ...` when invoking `make`,
406 or export `GIT_COLA_NO_VENDOR_LIBS=1` into the build environment.
408     make NO_VENDOR_LIBS=1 ...
410 Python3 users on debian will need to install `python3-distutils` in order
411 to run the Makefile's installation steps.  `distutils` is a Python build
412 requirement, but not needed at runtime.
414 # WINDOWS (continued)
416 ## Development
418 In order to develop Git Cola on Windows you will need to install
419 Python3 and pip.  Install PyQt5 using `pip install PyQt5`
420 to make the PyQt5 bindings available to Python.
422 Once these are installed you can use `python.exe` to run
423 directly from the source tree.  For example, from a Git Bash terminal:
425     /c/Python36/python.exe ./bin/git-cola
427 ## Multiple Python versions
429 If you have multiple versions of Python installed, the `contrib/win32/cola`
430 launcher script might choose the newer version instead of the python
431 that has PyQt installed.  In order to resolve this, you can set the
432 `cola.pythonlocation` git configuration variable to tell cola where to
433 find python.  For example:
435     git config --global cola.pythonlocation /c/Python36
437 ## BUILDING WINDOWS INSTALLERS
439 Windows installers are built using
441 * [Pynsist](https://pynsist.readthedocs.io/en/latest/).
443 * [NSIS](http://nsis.sourceforge.net/Main_Page) is also needed.
445 To build the installer using Pynsist run:
447     ./contrib/win32/run-pynsist.sh
449 This will generate an installer in `build/nsis/`.
451 ## WINDOWS HISTORY BROWSER CONFIGURATION UPGRADE
453 You may need to configure your history browser if you are upgrading from an
454 older version of Git Cola.
456 `gitk` was originally the default history browser, but `gitk` cannot be
457 launched as-is on Windows because `gitk` is a shell script.
459 If you are configured to use `gitk`, then change your configuration to
460 go through Git's `sh.exe` on Windows.  Similarly, we must go through
461 `python.exe` if we want to use `git-dag`.
463 If you want to use gitk as your history browser open the
464 Preferences screen and change the history browser command to:
466     "C:/Program Files/Git/bin/sh.exe" --login -i C:/Git/bin/gitk
468 git-dag became the default history browser on Windows in `v2.3`, so new
469 users should not need to configure anything.