A git repository updater
Project description
gitupdt
A Python tool for easily updating Git repositories. It checks for updates in remote repositories and allows you to pull branches or switch to tags through an interactive menu.
This tool is intended for use in execution-only repositories that are cloned for software usage purposes, without making edits. It is not recommended for use in development repositories.
Features
- Remote update check: Check if there are updates in the remote repository
- Interactive selection menu: Interactive CLI powered by questionary
- Branch pull: Update the current branch to the latest state
- Checkout to tag: Switch to a specified version tag
- Reset mode: Use
git reset --hardwith the--resetoption to update - requirements.txt change display and installation: Display changes in dependency files and support automatic installation
- pyproject.toml change display and uv sync: Detect changes in pyproject.toml dependencies section and run uv sync when uv is installed
- Automatic virtual environment detection: Automatically detect
.venvorvenvfolders and display appropriate Python interpreter options - Repository maintenance: Automatically run
git gc --autoafter updates
Installation
pip install gitupdt
Usage
Update repository in current directory
gitupdt
Update repository at specified path
gitupdt /path/to/repo
Update with reset mode
When you specify the --reset option, it uses git reset --hard instead of git checkout or git pull to update. This is useful for forcibly overwriting a local file with a remote one when the local file is corrupted.
gitupdt --reset
gitupdt /path/to/repo --reset
Available Actions
When you run the tool, you can select from the following actions:
- Checkout and Pull latest remote: Checkout and pull the remote default branch
- Pull: Update the current branch to the latest state (when behind remote)
- Checkout to tag: Switch to a specified version tag (select from latest or past tags)
Automatic Installation on requirements.txt Changes
When there are changes in requirements.txt, the following process occurs:
- Changes are displayed in unified diff format
- You are prompted whether to install the updated
requirements.txt - You can select the appropriate install command:
- If uv is installed:
uv pip installoruv add(only if pyproject.toml exists) - Currently running Python
- Detected virtual environment (
.venvorvenv) Python
- If uv is installed:
- Installation is executed with the selected command
- You can also choose to cancel and install manually later
The script traverses the repository folders upward. If it finds a folder named .venv or venv, it checks whether it's a venv environment and presents it as an option.
Automatic uv sync on pyproject.toml Changes
If uv is installed and pyproject.toml exists, the following process occurs:
- Changes in the
dependenciessection ofpyproject.tomlare displayed in unified diff format - You are prompted whether to run
uv syncto update dependencies - If you choose
uv sync, dependencies will be updated - You can also choose to cancel and update manually later
Note: If there are changes in pyproject.toml, the requirements.txt change confirmation will not be performed.
Changelog
1.1.1
- Added the ability to skip
pyproject.tomland userequirements.txtinstead.
1.1.0
- Added uv support for package installation
uv pip installanduv addoptions are now available when uv is installed
- Added pyproject.toml change detection and uv sync
- Detects changes in the
dependenciessection ofpyproject.toml - Automatically prompts to run
uv syncwhen changes are detected
- Detects changes in the
- Changed minimum Python version from 3.9 to 3.11 (due to tomllib usage)
Dependencies
- GitPython
- questionary
- packaging
Python Version
Python 3.11 or higher is required.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitupdt-1.1.1.tar.gz.
File metadata
- Download URL: gitupdt-1.1.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2e98ce087f475210dd4dd9d8991334f4867af8d2038a1fd6120dc0ed8b3a9e6
|
|
| MD5 |
491db778a98d81711e9f2b98ddecb80f
|
|
| BLAKE2b-256 |
485766b190e466fac761c4822a33f2ffae13e1e40230763cc8b62df858b17ed7
|
File details
Details for the file gitupdt-1.1.1-py3-none-any.whl.
File metadata
- Download URL: gitupdt-1.1.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9adb8f22d762f9145d4e2a7f7b62611c21234248e3d08096cd96a1451feba790
|
|
| MD5 |
6d4101744e5bd6837029ecda03bc8ac6
|
|
| BLAKE2b-256 |
128154b0e628baf9eede971d217dc5c608194d9b78488045bbb2711810852169
|