Package: git-up
PyGitUpis a Python port ofaanand/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 usegit up?git pull has two problems:It merges upstream changes by default, when it’s really more polite torebase
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/)DemonstrationWhy use the Python port?I wasn’t able to use the originalgit-up, because I didn’t want to install
a whole Ruby suite just forgit-upand even with Ruby installed, there were
some problems running on my Windows machine. So, my reasons for writing
and using this port are:Windows support.Written in Python ;)How do I install it?Installgit-upviapip:$ pip installgit-upcdto your project’s directory.Rungit upand enjoy!Homebrew users can also usebrew:brew install pygitupHow to run it locally?Could also checkout the.github/workflows/ci-workflow.ymlclone repo andcdto repo directory.Installpoetryas guided bypoetry installation docRunpoetry installRun program withpoetry rungit-upRun all tests withpoetry run pytest-v--cov=PyGitUporpoetry run pytest-v--cov=PyGitUp--cov-reporthtmlRun one test withpoetry run pytest-qPyGitUp/tests/test_version.py-v--cov=PyGitUpNote for Windows users:Seethese instructionsfor installing pip, if you haven’t already installed it. And don’t forget
to either:make yourPython/ScriptsandPython/Lib/site-packageswritable for
you,runpipwith admin privilegesor usepip install--usergit-upand add%APPDATA%/Python/Scriptsto%PATH%.Otherwise pip will refuse to installgit-updue toAccess deniederrors.Python version compatibility:Python 3.7 and upwards are supported :)Options and ConfigurationCommand Line Argumentsgit up-hshows a help message.git up--quietsuppresses all output except for error messages.git up--no-fetchskips fetching the remote and rebases all local branches.git up--versionshows the current version and optionally checks for
updates (see below).ConfigurationTo configurePyGitUp, you can set options in your git config. Rungit config[--global]git-up.[name][value]to set one of these
options:git-up.fetch.prune[*true*|false]: If set totrue,PyGitUpwill append the--pruneoption togit fetchand
thus remove any remote tracking branches which no longer exist on
the remote (seegit fetch
–help).git-up.fetch.all[true|*false*]: If set tofalse,PyGitUpwill only fetch remotes for which there is at least one local
tracking branch. Setting this option will makegit upalways 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.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,PyGitUpwill use
this string as additional arguments when callinggit rebase.
Example:--preserve-mergesto recreate merge commits in the
rebased branch.git-up.rebase.auto[*true*|false]: If set tofalse,PyGitUpwon’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]: Runscmdevery time a branch
is rebased or fast-forwarded, with the old head as$1and 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 totrue,PyGitUpwill show the hashes of the current commit (or the point
where the rebase starts) and the target commit likegit pulldoes.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 feel
uncomfortable with it, just set it tofalseto turn off the checks.CreditsThe originalgit-uphas been written by aanand:aanand/git-up/.Changelogv2.2.0 (2022-11-21)Add support for Python 3.11. Thanks@hugovkforPull Request #118.v2.1.0 (2021-10-02)Switch to Python’sargparsefor CLI argument parsing. Thanks@ekohlforPull Request #96.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 dependenciesv2.0.2 (2020-12-30)Remove old Python 2 code. Thanks@hugovkforPull Request #104.v2.0.1 (2020-08-26)Update dependenciesv2.0.0 (2020-08-15)Drop Python 2 support in order to fixIssue 102Drop Ruby Bundler integrationMigrate tests topy.testv1.6.1 (2018-12-12)Upgrade to click>=7.0.0. Thanks@no-preserve-rootforPull Request #87.v1.6.0 (2018-10-26)Skip stashing changes when possible. Thanks@ChronialforPull Request #86.Added faster fast-forward on branches that are not checked out. Thanks@ChronialforPull Request #83.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)Added auto-push support. Thanks@WoLpHforPull Request #74.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.
ThanksMaximilianRforPull 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@JavexforPull 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@r4ts0nforPull Request #23and@Byronfor quickly merging a Pull Request
inGitPythonand releasing a new version on which this release depends.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 updatedv1.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 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 andPyGitUpoutput.3rd party dependencies have been updated.v1.1.3 (2014-03-23)ahead of upstreammessages 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 by
v1.1.0.v1.1.0 (2013-10-07)Prior to v1.1.0,PyGitUptried 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,PyGitUpstops guessing and uses the upstream branch config instead.This by the way fixes issue#6(git updoesn’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 upwould still fetch and rebase from the remote branch.
If you run into troubles with such a setup, setting tracking information
usinggit branch-u<remote>/<remotebranch> <local branch>should help.3rd party dependencies have been updated.Allows to rungit up--versionfrom non-git dirs, too.v1.0.0 (2013-09-05)FinallyPyGitUpreaches 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-hto display a help screen (--helpwon’twork, becausegitcatches this option and handles it beforePyGitUpcan do).Added option--versionto show, what version ofPyGitUpis running.
Also checks for updates (can be disabled, see configuration).Added option--quietto 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)Incorporatedaanand/git-up#41: Support forbundle install--localandrbenv 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