3.5 KiB
3.5 KiB
Usage
Environment Requirements
- Linux or Unix-like terminal environment with curses support.
- Python 3 interpreter available as
python3. - Git installed and available in
PATH. - GitHub CLI
ghinstalled and authenticated for GitHub repository creation. If using Gitea see below. - Gitea API token for Gitea repository creation (read/write permissions for repository and organization) over HTTPS.
Installation
- Make the script executable:
chmod +x git-tui - Install as a memorable command name (example:
gtui):sudo install -m 755 git-tui /usr/local/bin/gtui
Running
- Run from any project directory:
gtui
Non-Repository Bootstrap Flow
- If the current directory is not a Git repository,
git-tuioffers setup actions:- Initialize repository only.
- Initialize, create a new Gitea remote repository, and sync.
- Initialize, connect an existing Gitea remote repository, and sync.
- Create and publish flow:
- Initializes a local Git repository.
- Stages all current files.
- Creates an initial commit.
- Gitea creation uses the HTTPS API token, then configures and pushes
originusing the separately selected SSH or HTTPS Git transport.
- Optional Gitea environment variables:
GITEA_URLorGITEA_BASE_URLfor instance URL default.GITEA_OWNERfor default owner or organization.GITEA_TOKENorGITEA_ACCESS_TOKENfor API token default.
- Network Git commands temporarily suspend curses and use the real terminal, allowing normal SSH passphrase, HTTPS credential, and credential-helper prompts.
Existing Repository Without Remote Flow
- If the current directory is already a Git repository and has no remotes configured,
git-tuioffers startup actions:- Connect to an existing Gitea remote repository and sync.
- Create a Gitea remote repository and sync (API token required).
- Continue without remote configuration.
- Quit.
- Connect existing remote flow:
- A full clone URL is used unchanged, preserving custom SSH users, aliases, hosts, and ports.
- For
owner/name, uses the Gitea API to obtain the instance's exactssh_urlorclone_url; private repository lookup requires an API token. - Configures remote
originto the selected repository URL. - Inspects both histories and synchronizes automatically when one side can be fast-forwarded.
- If histories diverge, offers merge, replace-local-with-backup, and force-push-with-lease choices.
- Requires existing uncommitted changes to be committed or stashed before synchronization.
- Repositories with a configured remote expose
Disconnect remotein the normal operations menu. This removes only the local Git remote configuration.
Key Commands in UI
- Main menu:
Up/Downorj/kto move.Enterto execute selected action.qorEscto quit.
- File selector:
Spaceto toggle file selection.ato toggle all files.Enterto confirm.qorEscto cancel.
Git Operations Covered
- Stage all changes (
git add -A). - Stage selected files (
git add -- <paths...>). - Unstage selected files (
git restore --staged -- <paths...>). - Commit staged changes (
git commit -m "<message>"). - Push current branch (
git push). - Pull with rebase (
git pull --rebase). - Fetch all remotes (
git fetch --all --prune). - Show full status (
git status).
Cross References
- Architecture and contracts:
doc/architecture.md - Change history:
CHANGELOG.md