Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A nicer `git pull`

License

NotificationsYou must be signed in to change notification settings

msiemens/PyGitUp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

356 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Why usegit up?

git pull has two problems:

  • It merges upstream changes by default, when it's really more polite torebaseover 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 willshout at you for being behind on branches you don't particularly care aboutright now.

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

Demonstration

demo.gif

Why use the Python port?

I wasn't able to use the originalgit-up, because I didn't want to installa whole Ruby suite just for git-up and even with Ruby installed, there weresome problems running on my Windows machine. So, my reasons for writingand using this port are:

  1. Windows support.
  2. Written in Python ;)

How do I install it?

  1. Installgit-up viapip:$ uv tool install git-up
  2. cd to your project's directory.
  3. Rungit up and enjoy!

Homebrew users can also usebrew:brew install pygitup

How to run it locally?

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

  1. clone repo andcd to repo directory.
  2. Installpoetry as guided bypoetry installation doc
  3. Runpoetry install
  4. Run program withpoetry run git-up
  5. Run all tests withpoetry run pytest -v --cov=PyGitUp orpoetry run pytest -v --cov=PyGitUp --cov-report html
  6. Run one test withpoetry run pytest -q PyGitUp/tests/test_version.py -v --cov=PyGitUp

Note for Windows users:

Seethese instructionsfor installing pip, if you haven't already installed it. And don't forgetto either:

  • make yourPython/Scripts andPython/Lib/site-packages writable foryou,
  • runpip with admin privileges
  • or usepip install --user git-up and add%APPDATA%/Python/Scriptsto%PATH%.

Otherwise pip will refuse to installgit-up due toAccess 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 forupdates (see below).

Configuration

To configurePyGitUp, you can set options in your git config. Rungit config [--global] git-up.[name] [value] to set one of theseoptions:

  • git-up.fetch.prune [*true*|false]: If set totrue,PyGitUp will append the--pruneoption togit fetch andthus remove any remote tracking branches which no longer exist onthe remote (seegit fetch--help).
  • git-up.fetch.all [true|*false*]: If set tofalse,PyGitUpwill only fetch remotes for which there is at least one localtracking branch. Setting this option will makegit up always fetchfrom all remotes, which is useful if e.g. you use a remote to push toyour CI system but never check those branches out.
  • git-up.push.auto [true|*false*]: Push the current branch afterrebasing 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 usethis string as additional arguments when callinggit rebase.Example:--preserve-merges to recreate merge commits in therebased branch.
  • git-up.rebase.auto [*true*|false]: If set tofalse,PyGitUp won't rebase your branches for you but notify you thatthey diverged. This can be useful if you have a lot of in-progresswork that you don't want to deal with at once, but still want toupdate other branches.
  • git-up.rebase.log-hook [cmd]: Runscmd every time a branchis rebased or fast-forwarded, with the old head as$1 and the newhead as$2. This can be used to view logs or diffs of incomingchanges. Example:echo "changes on $1:"; git log --oneline --decorate $1..$2.
  • git-up.rebase.show-hashes [true|*false*]: If set totrue,PyGitUp will show the hashes of the current commit (or the pointwhere the rebase starts) and the target commit likegit pull does.

New in v1.0.0:

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

Credits

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

Changelog

v2.4.0 (2025-12-27)

  • Switch topackaging instead ofpkg_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 parserClickto version 8.0. Thanks@hugovkforPull 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 fixIssue 102
  • Drop Ruby Bundler integration
  • Migrate tests topy.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 onpip install. Thanks@ekohlforPull Request #60.

v1.4.4 (2016-11-30)

  • Fixed a bug when working withgit 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.ThanksMaximilianR forPull Request #45.
  • Added an command line argument to turn of fetching (--no-fetch). Thanks@buotoforPull 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 forPull 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)

v1.2.2 (2015-02-23)

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

v1.2.1 (2014-12-16)

  • Fixed a problem withsetuptools 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 likegit pulldoes (git-up.rebase.show-hashes).
  • Fixed a bug when having branches with both local tracking branches andremote tracking branches (#17).

v1.1.5 (2014-11-19)

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

v1.1.4 (2014-04-18)

  • Fixed some typos in README andPyGitUp output.
  • 3rd party dependencies have been updated.

v1.1.3 (2014-03-23)

  • ahead of upstream messages are now cyan (seeaanand/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 byv1.1.0.

v1.1.0 (2013-10-07)

  • Prior to v1.1.0,PyGitUp tried to guess the upstream branch for a localbranch 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 hasthe same name as a remote branch without any tracking information set. Priorto 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 informationusinggit branch -u <remote>/<remote branch> <local branch> should help.

  • 3rd party dependencies have been updated.

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

v1.0.0 (2013-09-05)

FinallyPyGitUp 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 (--helpwon't work, becausegit catches this option and handles it beforePyGitUp can do).
  • Added option--version to show, what version ofPyGitUp 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 (uglyexception if remote branch has been deleted).

v0.2.2 (2013-05-04)

  • Fixed issue#3 (didn'treturn to previous branch).

v0.2.1 (2013-03-18)

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

v0.2 (2013-03-18)

  • Incorporatedaanand/git-up#41: Support forbundle install --local andrbenv rehash.
  • Fixed issue#1 (strangeoutput buffering when having multiple remotes to fetch from).
  • Some under-the-hood improvements.

v0.1 (2013-03-14)

  • Initial Release

About

A nicer `git pull`

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors18

Languages


[8]ページ先頭

©2009-2026 Movatter.jp