# gitcola **Repository Path**: luckystarting/gitcola ## Basic Information - **Project Name**: gitcola - **Description**: git-cola 是一个强大的 Git 客户端 GUI 工具,使用 Python 编写 - **Primary Language**: Python - **License**: GPL-2.0 - **Default Branch**: main - **Homepage**: https://www.oschina.net/p/git-cola - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-08-15 - **Last Updated**: 2024-08-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # git-cola: The highly caffeinated Git GUI Git Cola是一个功能强大的Git GUI,具有流畅直观的用户界面。 git clone https://gitee.com/luckystarting/gitcola.git [![License](https://img.shields.io/:license-GPL-green.svg)](LICENSE) [![Build status](https://github.com/git-cola/git-cola/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/git-cola/git-cola/actions/workflows/main.yml) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/251/badge)](https://bestpractices.coreinfrastructure.org/projects/251) [![pre-commit.ci](https://results.pre-commit.ci/badge/github/git-cola/git-cola/main.svg)](https://results.pre-commit.ci/latest/github/git-cola/git-cola/main) * [截图](https://git-cola.github.io/screenshots.html) * [下载](https://git-cola.github.io/downloads.html) # 文档 * [键盘快捷键](https://git-cola.github.io/share/doc/git-cola/hotkeys.html) * [HTML文档](https://git-cola.readthedocs.io/en/latest/) * [Git Cola文档](docs/git-cola.rst) * [Git DAG文档](docs/git-dag.rst) * [贡献指南](CONTRIBUTING.md) # 必要条件 ## 构建 * [Sphinx](http://sphinx-doc.org/) 用于生成文档。 ## 运行时 * [Git](https://git-scm.com/) 2.2.0 或更新。 * [Python](https://python.org/) 3.6 或更新。 * [QtPy](https://github.com/spyder-ide/qtpy) 2.0.0 或更新。 Git-Cola使用QtPy,因此您可以根据需要将 `QT_API` 环境变量设置为`pyqt6`, `pyqt5` 或 `pyside2`,从而在PyQt6、PyQt5和PySide2之间进行选择 `qtpy` 默认 `pyqt5` 如果未安装 `pyqt5` 则回退到 `pyqt6` 和 `pyside2` 必须安装以下任何一个Python Qt库: * [PyQt5 / PyQt6](https://www.riverbankcomputing.com/software/pyqt/download5) 需要5.9或更高版本。QtPy也支持Qt 6.2或更高版本。 * [PySide2](https://github.com/PySide/PySide) 5.12.0 或更高版本。 ## 可选功能 安装以下Python模块后,Git Cola将启用其他功能。 [Send2Trash](https://pypi.org/project/Send2Trash/) 启用跨平台“发送到回收站”功能。 ([source](https://github.com/hsoft/send2trash)) [notify_py](https://pypi.org/project/notify_py/) 启用桌面通知的传递。 ([source](https://github.com/ms7m/notify-py)) [pyobjc](https://pypi.org/project/pyobjc/) 在macOS上启用macOS特定的应用程序主题。 ([source](https://github.com/ronaldoussoren/pyobjc)) # 安装 有几种方法可以安装Git Cola,但您不需要“安装”Git Cola来运行它。 Git Cola被设计为直接从其源代码树运行。安装是可选的。 ## 来源 运行最新Git Cola版本的推荐方法是使用发行版的包管理器安装其PyQt依赖项,然后直接从源代码运行LS `./bin/git-cola` ## Installing PyQt dependencies on Debian / Ubuntu systems Git Cola works with either PyQt5 or PyQt6 because it uses the [qtpy](https://github.com/spyder-ide/qtpy) library for PyQt compatibility. ### PyQt5 Users on newer Debian/Ubuntu version can install a single package to run from source. ```bash sudo apt install python3-qtpy ``` If you are on an older version that does not have `python3-qtpy` available then you can install the following packages directly. ```bash sudo apt install python3-pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qtwebengine python3-pyqt5.qtsvg ``` ### PyQt6 如果你想在较新的PyQt6生态系统中使用Git Cola,那么你可以安装这些包而不是PyQt5。 ```bash sudo apt install python3-pyqt6 python3-pyqt6.qtsvg python3-pyqt6.qtwebengine ``` 此时,您应该能够从源代码树启动M `./bin/git-cola` ,无需再做任何事情。 下面的进一步说明详细介绍了如何从PyPI安装Git Cola,或者如何将其安装到与源代码树分离的位置。 ## Linux Linux is it! Your distro has probably already packaged `git-cola`. If not, please file a bug against your distribution ;-) ### Arch Available in the [AUR](https://aur.archlinux.org/packages/git-cola/). ### Debian, Ubuntu apt install git-cola ### Fedora dnf install git-cola ### Gentoo emerge git-cola ### OpenSUSE, SLE zypper install git-cola ### Slackware Available in [SlackBuilds.org](http://slackbuilds.org/result/?search=git-cola). ### Ubuntu [See here](https://packages.ubuntu.com/search?keywords=git-cola) for the versions that are available in Ubuntu's repositories. ## FreeBSD # 从官方二进制软件包安装 pkg install -r FreeBSD devel/git-cola # Build from source cd /usr/ports/devel/git-cola && make clean install ## 使用pip从PyPI安装到Python Virtualenv中 **注意**: 切勿在Python虚拟环境之外或以root身份运行 `pip install` 或 `garden install`! **注意**: 如果你在Linux发行版上,你的包管理器可以提供PyQt6或PyQt5, 那么强烈建议你使用系统的包管理程序安装这些依赖项。详见上一节。 安装最新版本的一种方法是使用 `venv` (virtualenv) 和 `pip`. 这将安装 [git-cola from pypi.org](https://pypi.org/project/git-cola/). python3 -m venv --system-site-packages env3 ./env3/bin/pip install git-cola ./env3/bin/git-cola 将 `env3/bin` 目录添加到您的 `PATH` 中,或从 `PATH` 的某个地方 (如`~/.local/bin/git-cola`) 添加到`bin/git-cola` 的符号链接,您就可以像任何其他内置的 `git` 命令一样启动git cola: git cola git dag ## 从源代码安装到Python Virtualenv 如果你没有安装PyQt,那么最简单的方法就是使用Python virtualenv,并在“可编辑”模式下将Git-Cola安装到其中。 此安装方法允许您通过运行`Git pull`来升级Git Cola。 # Create a virtualenv called "env3" and activate it. python3 -m venv --system-site-packages env3 # Install PyQt and (optional) extra packages to enable all features. ./env3/bin/pip install --editable '.[extras,pyqt6]' # Run Git Cola via the "git-cola" Git subcommand. source env3/bin/activate git cola If you add `env3/bin` (or symlink to `env3/bin/git-cola` ) somewhere in your `$PATH` then you can run `git cola` as if it were a builtin `git` command from outside of the virtualenv (e.g. after running "deactivate" or when opening a new shell). ## 从源独立安装 Running `garden -D prefix=$HOME/.local install` will install Git Cola in your `$HOME/.local` directory (`$HOME/.local/bin/git-cola`, `$HOME/.local/lib`, etc). This installation method assumes that the `qtpy` and `PyQt*` dependencies have been pre-installed. The Garden recipe also supports `DESTDIR` to support creating packages for Linux package managers: garden -D DESTDIR=/tmp/stage -D prefix=/usr/local install If you do not have `garden` available then `make` can be used instead. The `Makefile` supports staged installs using the conventional [DESTDIR](https://www.gnu.org/software/make/manual/html_node/DESTDIR.html) and [prefix](https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html) variables. make DESTDIR=/tmp/stage prefix=/usr/local install ## macOS For most end-users we recommend using either Homebrew or installing into a Python virtualenv as described above. You can install Git Cola from source using the same steps as above. ### Homebrew An easy way to install Git Cola is to use [Homebrew](https://brew.sh/) . Use Homebrew to install the git-cola recipe: brew install git-cola If you install using Homebrew you can stop at this step. You don't need to clone the repo or anything. ### git-cola.app If you have all of the dependencies installed, either via `pip` or `brew` then you can build a shell `git-cola.app` app bundle wrapper for use in `/Applications`. If you'd like to build a `git-cola.app` bundle for `/Applications` run this command: garden macos/app You will need to periodically rebuild the app wrapper whenever Python is upgraded. ### Updating macOS and Homebrew Updating macOS can often break Homebrew-managed software. If you update macOS and Git Cola stops working then then you probably need to re-install Git Cola's dependencies. Re-installing from scratch using the instructions below can get things back in shape. brew update brew uninstall git-cola brew uninstall pyqt brew uninstall pyqt@5 brew autoremove brew install git-cola ## Windows 重要提示:如果您有64位计算机,请仅安装64位版本。 不要混合使用32位和64位版本。 下载并安装以下内容: * [Git for Windows](https://git-for-windows.github.io/) * [Git Cola](https://github.com/git-cola/git-cola/releases) 安装这些后,您可以从“开始”菜单运行Git Cola。 有关更多详细信息,请参阅下面的“Windows(续)”。 如果你想用[winget](https://github.com/microsoft/winget-cli) 安装Git Cola,请运行以下命令: winget install git-cola.git-cola 由于还没有依赖性解决方案,您还必须安装Git: winget install Git.Git # 优点 Git Cola附带了一个名为`Git Cola序列编辑器`的交互式变基编辑器。 `git-cola-sequence-editor`用于在变基时重新排序和选择提交。 通过`rebase`菜单或通过`git cola rebase`子命令使用`git cola-sequence editor`启动交互式rebase: git cola rebase @{upstream} `git-cola-sequence-editor` 可以独立于git cola启动,方法是通过 `GIT_SEQUENCE_EDITOR` 环境变量告诉`git rebase`将其用作编辑器: export GIT_SEQUENCE_EDITOR="$HOME/git-cola/bin/git-cola-sequence-editor" git rebase -i @{upstream} ## Shell 竣工 Shell完成脚本可用于bash和zsh。 每个脚本都包含如何安装和激活补全的说明。 * [bash completion script](contrib/git-cola-completion.bash) * [zsh completion script](contrib/_git-cola) # Git Cola 子命令 `git-cola` 命令公开了各种子命令,允许您快速启动git cola界面中可用的工具。例如, `git cola find` 启动文件查找器, `git cola grep` 启动grep工具。 有关完整的命令列表,请参阅 `git cola --help-commands` $ git cola --help-commands usage: git-cola [-h] {cola,am,archive,branch,browse,config, dag,diff,fetch,find,grep,merge,pull,push, rebase,remote,search,stash,tag,version} ... valid commands: {cola,am,archive,branch,browse,config, dag,diff,fetch,find,grep,merge,pull,push, rebase,remote,search,stash,tag,version} cola start git-cola am apply patches using "git am" archive 保存存档 branch create a branch browse 浏览存储库 config 编辑配置 dag start git-dag diff view diffs fetch fetch remotes find find files grep grep source merge merge branches pull pull remote branches push push remote branches rebase interactive rebase remote edit remotes search search commits stash stash and unstash changes tag create tags version print the version ## 发展 如果你已经安装了Git Cola的依赖项,那么如果你有可用的源代码,你可以将`Cola`作为Python模块启动。 python -m cola python -m cola dag 在开发过程中应运行以下命令: # Run the unit tests $ garden test # Run tests and doc checks $ garden check # Run tests against multiple python interpreters using tox $ garden tox 测试套件可以在 [test](test) 目录中找到。 使用 [GitHub Actions](https://github.com/git-cola/git-cola/actions/workflows/main.yml) 自动测试提交和拉取请求的代码质量 更新翻译时,在提交之前自动格式化 `cola/i18n/*.po` 文件: $ garden po 提交补丁时,请咨询 [contributing guidelines](CONTRIBUTING.md). ## Packaging Notes Git Cola installs its modules into the default Python site-packages directory (e.g. `lib/python3.7/site-packages`) using setuptools. While end-users can use `pip install git-cola` to install Git Cola, distribution packagers should use the `garden -D prefix=/usr install` process. Git Cola's Garden recipe wraps `pip install --prefix=` to provide a packaging-friendly `garden install` target. # Windows(续) ## Microsoft Visual C++ 2015 可再发行版 早期版本的Git Cola可能没有附带 `vcruntime140.dll` ,并且可能无法在缺少此dll的计算机上运行。 To fix this, download the [Microsoft Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=52685) and install it Git Cola v4.0.0及更高版本包含此DLL,不需要单独安装。 ## Development In order to develop Git Cola on Windows you will need to install Python3 and pip. Install PyQt5 using `pip install PyQt5` to make the PyQt5 bindings available to Python. Once these are installed you can use `python.exe` to run directly from the source tree. For example, from a Git Bash terminal: /c/Python39/python.exe ./bin/git-cola ## Multiple Python versions If you have multiple versions of Python installed, the `contrib/win32/cola` launcher script might choose the newer version instead of the python that has PyQt installed. In order to resolve this, you can set the `cola.pythonlocation` git configuration variable to tell cola where to find python. For example: git config --global cola.pythonlocation /c/Python39 ## Building Windows Installers Windows installers are built using * [Pynsist](https://pynsist.readthedocs.io/en/latest/). * [NSIS](http://nsis.sourceforge.net/Main_Page) is also needed. To build the installer using Pynsist run: ./contrib/win32/run-pynsist.sh This will generate an installer in `build/nsis/`. ## Windows "History Browser" Configuration Upgrade You may need to configure your history browser if you are upgrading from an older version of Git Cola on Windows. `gitk` was originally the default history browser, but `gitk` cannot be launched as-is on Windows because `gitk` is a shell script. If you are configured to use `gitk`, then change your configuration to go through Git's `sh.exe` on Windows. Similarly, we must go through `python.exe` if we want to use `git-dag`. If you want to use gitk as your history browser open the Preferences screen and change the history browser command to: "C:/Program Files/Git/bin/sh.exe" --login -i C:/Git/bin/gitk `git-dag` became the default history browser on Windows in `v2.3`, so new users do not need to configure anything.