Write gitp ush and execute git push -u origin <current-branch>.
A small demo that turns your typo into a feature - making gitp ush a shortcut for git push with automatic upstream setting.
- Simple typo-to-feature conversion:
gitp ush→git push -u origin <branch> - Automatically detects your current git branch
- Automatically sets upstream tracking
- Supports additional git push arguments
cargo build --releaseThe binary will be created at ./target/release/gitp
Optional: Add to your PATH:
# Copy to a directory in your PATH
sudo cp ./target/release/gitp /usr/local/bin/
# Or add an alias to your shell config (.bashrc, .zshrc, etc.)
alias gitp='/path/to/target/release/gitp'gitp ushCurrent branch: main
Executing: git push -u origin main
Successfully pushed to origin/main
gitp ush --force
gitp ush --tags
gitp ush --force-with-lease- You run
gitp ush(either by typo or intentionally) - The tool detects the current git branch
- Executes
git push -u origin <branch>with any additional arguments - Sets upstream tracking automatically
This demonstrates how to build a simple CLI tool in Rust that:
- Parses command-line arguments
- Executes git commands programmatically
- Provides a better UX by automating common tasks
- Turns a common typo into a useful feature