Skip to main content

PyGitUp is a Python port of aanand/git-up. It not only fully covers the abilities of git-up and should be a drop-in replacement, but also extends it slightly.

Why use git up?

git pull has two problems:

  • It merges upstream changes by default, when it’s really more polite to rebase over them, unless your collaborators enjoy a commit graph that looks like bedhead.

  • It only updates the branch you’re currently on, which means git push will shout at you for being behind on branches you don’t particularly care about right now.

(https://github.com/aanand/git-up/)

Demonstration

demo.gif

Why use the Python port?

I wasn’t able to use the original git-up, because I didn’t want to install a whole Ruby suite just for git-up and even with Ruby installed, there were some problems running on my Windows machine. So, my reasons for writing and using this port are:

  1. Windows support.

  2. Written in Python ;)

How do I install it?

  1. Install git-up via pip: $ uv tool install git-up

  2. cd to your project’s directory.

  3. Run git up and enjoy!

Homebrew users can also use brew: brew install pygitup

How to run it locally?

Could also checkout the .github/workflows/ci-workflow.yml

  1. clone repo and cd to repo directory.

  2. Install poetry as guided by poetry installation doc

  3. Run poetry install

  4. Run program with poetry run git-up

  5. Run all tests with poetry run pytest -v --cov=PyGitUp or poetry run pytest -v --cov=PyGitUp --cov-report html

  6. Run one test with poetry run pytest -q PyGitUp/tests/test_version.py -v --cov=PyGitUp

Note for Windows users:

See these instructions for installing pip, if you haven’t already installed it. And don’t forget to either:

  • make your Python/Scripts and Python/Lib/site-packages writable for you,

  • run pip with admin privileges

  • or use pip install --user git-up and add %APPDATA%/Python/Scripts to %PATH%.

Otherwise pip will refuse to install git-up due to Access denied errors.

Python version compatibility:

Python 3.7 and upwards are supported :)

Options and Configuration

Command Line Arguments

  • git up -h shows a help message.

  • git up --quiet suppresses all output except for error messages.

  • git up --no-fetch skips fetching the remote and rebases all local branches.

  • git up --version shows the current version and optionally checks for updates (see below).

Configuration

To configure PyGitUp, you can set options in your git config. Run git config [--global] git-up.[name] [value] to set one of these options:

  • git-up.fetch.prune [*true*|false]: If set to true, PyGitUp will append the --pruneoption to git fetch and thus remove any remote tracking branches which no longer exist on the remote (see git fetch –help).

  • git-up.fetch.all [true|*false*]: If set to false, PyGitUp will only fetch remotes for which there is at least one local tracking branch. Setting this option will make git up always fetch from all remotes, which is useful if e.g. you use a remote to push to your CI system but never check those branches out.

  • git-up.fetch.progress [true|*false*]: If set to true, show progress and ref updates reported by git fetch. This output is suppressed when using git up --quiet.

  • git-up.push.auto [true|*false*]: Push the current branch after rebasing and fast-forwarding.

  • git-up.push.all [true|*false*]: Push all branches when auto-pushing.

  • git-up.push.tags [true|*false*]: Push tags when auto-pushing.

  • git-up.rebase.arguments [string]: If set, PyGitUp will use this string as additional arguments when calling git rebase. Example: --preserve-merges to recreate merge commits in the rebased branch.

  • git-up.rebase.auto [*true*|false]: If set to false, PyGitUp won’t rebase your branches for you but notify you that they diverged. This can be useful if you have a lot of in-progress work that you don’t want to deal with at once, but still want to update other branches.

  • git-up.rebase.log-hook [cmd]: Runs cmd every time a branch is rebased or fast-forwarded, with the old head as $1 and the new head as $2. This can be used to view logs or diffs of incoming changes. Example: echo "changes on $1:"; git log --oneline --decorate $1..$2.

  • git-up.rebase.show-hashes [true|*false*]: If set to true, PyGitUp will show the hashes of the current commit (or the point where the rebase starts) and the target commit like git pull does.

  • git-up.rebase.conflict-resolver [cmd]: If set, PyGitUp will run this command when a rebase conflict occurs. It runs in the repository’s working directory while the rebase is still in progress, so the command can inspect the conflict itself (e.g. via git status, git diff) and is expected to resolve all conflicts, stage the files, and run git rebase --continue.

    Afterwards git up checks that the branch actually contains the target commit. Only then does it continue to the next branch. If the command exits non-zero, or exits 0 without completing the rebase (for example because it gave up and ran git rebase --abort), git up reports the branch as unresolved and stops, leaving it for manual resolution.

    The command is only run for genuine conflicts. Rebases that fail for other reasons — untracked files that would be overwritten, an invalid git-up.rebase.arguments — report their original error instead.

    Environment variables GITUP_BRANCH, GITUP_TARGET, and GITUP_REPO_PATH are also set for the resolver process. Note that the command is run through the system shell, which is cmd.exe on Windows — the single-quoted examples below need double quotes there.

    Examples:

    git config git-up.rebase.conflict-resolver "claude -p 'Resolve the current git rebase conflicts, then run git rebase --continue'"
    git config git-up.rebase.conflict-resolver "claude -p 'Resolve the current git rebase conflicts, then run git rebase --continue' --dangerously-skip-permissions"
    git config git-up.rebase.conflict-resolver "aider --message 'Resolve the current git rebase conflicts, then run git rebase --continue'"

    Note: AI agents like claude may prompt for tool approvals by default. Use --dangerously-skip-permissions to run fully autonomously, or --allowedTools 'Edit,Read,Bash,Write,Glob,Grep' to scope the permissions.

New in v1.0.0:

  • git-up.updates.check [*true*|false]: When running git up --version, it shows the version number and checks for updates. If you feel uncomfortable with it, just set it to false to turn off the checks.

Credits

The original git-up has been written by aanand: aanand/git-up/.

Changelog

v2.5.0 (2026-08-10)

  • Support rebasing branches that are checked out in worktrees. Branches whose worktree has an operation in progress are skipped. Thanks @abersnaze for Pull Request #145.

  • Add git-up.rebase.conflict-resolver to run a command when a rebase conflict occurs. Thanks @abersnaze for Pull Request #146.

  • Add git-up.fetch.progress to make git fetch more verbose. Thanks @agido-malter for Pull Request #148.

  • Fix a command injection in git-up.rebase.log-hook: branch and remote names are now passed to the hook through the environment instead of a command line, so names containing shell metacharacters are no longer executed as commands. This affects both the cmd.exe and the sh code path.

  • Fix a crash on git output that is not valid UTF-8.

  • Fix worktree detection on MinGW.

  • Update dependencies.

v2.4.0 (2025-12-27)

  • Switch to packaging instead of pkg_resources. Closes #139.

  • Fix top-level directory detection on MinGW.

  • Update dependencies and switch to the uv package manager.

v2.3.0 (2024-10-05)

v2.2.0 (2022-11-21)

v2.1.0 (2021-10-02)

v2.0.3 (2021-09-23)

  • Drop support for Python 3.6 (following GitPython)

  • Update PyGitUp’s CLI argument parser Click to version 8.0. Thanks @hugovk for Pull Request #109.

  • Update other dependencies

v2.0.2 (2020-12-30)

v2.0.1 (2020-08-26)

  • Update dependencies

v2.0.0 (2020-08-15)

  • Drop Python 2 support in order to fix Issue 102

  • Drop Ruby Bundler integration

  • Migrate tests to py.test

v1.6.1 (2018-12-12)

v1.6.0 (2018-10-26)

v1.5.2 (2018-09-28)

  • Fixed version requirement for Click dependency (#82).

v1.5.1 (2018-09-13)

  • Fixed crash on Cygwin with rebase log hook enabled (#80).

v1.5.0 (2018-04-26)

v1.4.7 (2018-04-07)

  • Added shorthand commandline arguments (-V, -q, -h, see #73).

v1.4.6 (2017-12-19)

  • 3rd party dependencies have been updated (see #65).

v1.4.5 (2017-01-02)

  • Fixed problems when working with branches containing hash signs in their name (#55).

  • No longer installs a now unneeded script on pip install. Thanks @ekohl for Pull Request #60.

v1.4.4 (2016-11-30)

  • Fixed a bug when working with git worktree (#58).

v1.4.3 (2016-11-22)

  • Fixed a bug with GitPython <= 2.0.8 (#56, #57).

v1.4.2 (2016-09-29)

  • Switched the command line argument parsing library (#53).

v1.4.1 (2016-08-02)

  • Include tests in PyPI distribution (#51).

v1.4.0 (2016-02-29)

  • 3rd party dependencies have been updated.

  • Dependencies on 3rd party libraries have been loosened to better interact with other installed packages. Thanks MaximilianR for Pull Request #45.

  • Added an command line argument to turn of fetching (--no-fetch). Thanks @buoto for Pull Request #46.

  • Don’t show a stacktrace anymore when stashing fails (#35).

  • Fixed a bug that caused problems with submodules if the submodule had unstashed changes/ Thanks @Javex for Pull Request #27.

v1.3.1 (2015-08-31)

  • Fixed a bug when showing the version on Python 3 #34.

v1.3.0 (2015-04-08)

  • Support for Python 3 has been added. Thanks @r4ts0n for Pull Request #23 and @Byron for quickly merging a Pull Request in GitPython and releasing a new version on which this release depends.

v1.2.2 (2015-02-23)

  • Now updates submodules when called from git submodule foreach (#8).

v1.2.1 (2014-12-16)

  • Fixed a problem with setuptools 8.x (#19).

  • 3rd party dependencies have been updated

v1.2.0 (2014-12-10)

  • Added an option to show hashes when fast-forwarding/rebasing like git pull does (git-up.rebase.show-hashes).

  • Fixed a bug when having branches with both local tracking branches and remote tracking branches (#17).

v1.1.5 (2014-11-19)

  • 3rd party dependencies have been updated to fix a problem with a 3rd party library (#18).

v1.1.4 (2014-04-18)

  • Fixed some typos in README and PyGitUp output.

  • 3rd party dependencies have been updated.

v1.1.3 (2014-03-23)

  • ahead of upstream messages are now cyan (see aanand/git-up#60).

  • Fixed problem when using % in the log hook (#11).

v1.1.2 (2013-10-08)

  • Fixed problems with the dependency declaration.

v1.1.1 (2013-10-07)

  • Fix for #7 (AttributeError: ‘GitUp’ object has no attribute ‘git’) introduced by v1.1.0.

v1.1.0 (2013-10-07)

  • Prior to v1.1.0, PyGitUp tried to guess the upstream branch for a local branch by looking for a branch on any remote with the same name. With v1.1.0, PyGitUp stops guessing and uses the upstream branch config instead.

    This by the way fixes issue #6 (git up doesn’t work with local only branches).

    Note: This change may break setups, where a local branch accidentally has the same name as a remote branch without any tracking information set. Prior to v1.1.0, git up would still fetch and rebase from the remote branch. If you run into troubles with such a setup, setting tracking information using git branch -u <remote>/<remote branch> <local branch> should help.

  • 3rd party dependencies have been updated.

  • Allows to run git up --version from non-git dirs, too.

v1.0.0 (2013-09-05)

Finally PyGitUp reaches 1.0.0. You can consider it stable now :)

  • Added a comprehensive test suite, now with a coverage of about 90%.

  • Lots of code cleanup.

  • Added option -h to display a help screen (--help won’t work, because git catches this option and handles it before PyGitUp can do).

  • Added option --version to show, what version of PyGitUp is running. Also checks for updates (can be disabled, see configuration).

  • Added option --quiet to be quiet and only display error messages.

v0.2.3 (2013-06-05)

  • Fixed issue #4 (ugly exception if remote branch has been deleted).

v0.2.2 (2013-05-04)

  • Fixed issue #3 (didn’t return to previous branch).

v0.2.1 (2013-03-18)

  • Fixed problem: check-bundler.rb has not been installed when installing via PyPI (problems with setup.py).

v0.2 (2013-03-18)

  • Incorporated aanand/git-up#41: Support for bundle install --local and rbenv rehash.

  • Fixed issue #1 (strange output buffering when having multiple remotes to fetch from).

  • Some under-the-hood improvements.

v0.1 (2013-03-14)

  • Initial Release

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_up-2.5.0.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_up-2.5.0-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file git_up-2.5.0.tar.gz.

File metadata

  • Download URL: git_up-2.5.0.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for git_up-2.5.0.tar.gz
Algorithm Hash digest
SHA256 7341db24c27add12cc16ac7ce048c1a9a851d945b0be4d8a48f93c8b1a69f83f
MD5 378e487bf6801a84d74c0489551bc0ac
BLAKE2b-256 4519b3f4b5adbb9e0118d858d8ede758da325a45ba105ed33eb37eca7668cad9

See more details on using hashes here.

File details

Details for the file git_up-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: git_up-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for git_up-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbc528cbd34725a833672dbfd61b992996f1ff5fab1820531fba8f57181893d5
MD5 1715b935ebabc69bcad870ab58fc6ba5
BLAKE2b-256 bab54a3864ab616be728a6377bd48135db4cac069662f1386273dff2edfe434a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.5.0 This release

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1.post1

2 files

2.0.1

2 files

2.0.0

2 files

1.6.1

2 files

1.6.0

2 files

1.5.2

1 file

1.5.1

1 file

1.5.0

2 files

1.4.7

2 files

1.4.6

1 file

1.4.5

1 file

1.4.4

1 file

1.4.3

1 file

1.4.2

1 file

1.4.1

1 file

1.4.0

1 file

1.3.0

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.5

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.0

2 files

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2

1 file

0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page