git-send 0.1.4

Commit and push changes with a single command
# git-send

[![Crates.io Version](https://img.shields.io/crates/v/git-send?style=for-the-badge)](https://crates.io/crates/git-send)
[![Crates.io Downloads](https://img.shields.io/crates/d/git-send?style=for-the-badge)](https://crates.io/crates/git-send)
[![Crates.io Size](https://img.shields.io/crates/size/git-send?style=for-the-badge)](https://crates.io/crates/git-send)

Stage, commit, pull (with rebase), and push your repository with one command.
`git-send` is a small Rust utility that keeps your workflow consistent by
composing the most common Git plumbing steps into a single, well‑logged
operation.

## Highlights

- Stage every tracked and untracked change with `git add -A`
- Commit with a positional or `-m/--message` flag, falling back to a
configurable default message
- Pull with `--rebase` and optionally auto-stash dirty worktrees before pulling
- Push to `origin/<current-branch>` once the history is up to date
- Toggle any step (`--dry-run`, `--no-pull`, `--no-push`) without editing
scripts
- Colorized output plus `-v/--verbose` logging for deeper insight

## Getting Started

### Prerequisites

- [Rust]https://www.rust-lang.org/tools/install 1.91+ (stable toolchain
recommended)
- Cargo (bundled with Rust)
- [just]https://github.com/casey/just (optional) if you prefer the provided
recipes

### Build from source

```sh
git clone https://git.sr.ht/~anhkhoakz/git-send
cd git-send
cargo build --release # just build
```

## Installation

```sh
# just install
strip target/release/git-send && \ # I have no idea why do this, but it's recommended
sudo install -m 755 "target/release/git-send" "/usr/local/bin/git-send" # just install
```

### Run

```sh
cargo run -- --message "chore: update configs"
git send --message "chore: update configs" # if installed
./target/release/git-send --message "chore: update configs" # if build
```

Use `--dry-run` any time you want to confirm what would happen without touching
your repo:

```sh
git-send --dry-run --message "docs: README refresh"
```

You will see the inferred branch, remote, and the ordered list of Git commands
that would execute.

## CLI Reference

```sh
git-send [OPTIONS] [COMMIT_MESSAGE]
```

| Flag | Description |
| --- | --- |
| `-m, --message <MSG>` | Commit message (same as positional argument) |
| `--dry-run` | Log every planned Git command without running it |
| `--no-pull` | Skip `git pull --rebase origin <branch>` |
| `--no-push` | Skip `git push origin <branch>` |
| `-v, --verbose` | Enable verbose logging via `env_logger` |
| `--config <PATH>` | Use a custom config file instead of the default |

`-h/--help` and `-V/--version` are provided automatically by Clap.

## Configuration

`git-send` merges settings from (1) a config file, (2) environment variables,
and (3) CLI flags. Later sources win.

### Config file

By default the tool looks for `~/.config/git-send/config`. Supply
`--config /path/to/file` to override. Example:

```cfg
# git-send configuration file
# Boolean values: 1/true/yes/on or 0/false/no/off
default_msg=Update: automated commit
dry_run=false
no_pull=false
no_push=false
auto_stash=true
verbose=false
```

### Environment variables

| Variable | Meaning |
| --- | --- |
| `GIT_SEND_DEFAULT_MSG` | Overrides the fallback commit message |
| `GIT_SEND_DRY_RUN` | `"1"` / `"true"` to enable dry runs |
| `GIT_SEND_NO_PULL` | Skip pulls regardless of config |
| `GIT_SEND_NO_PUSH` | Skip pushes regardless of config |

Use the config file to turn on `auto_stash` if you often have local
modifications that should be stashed before a pull. When enabled, `git-send`
will stash before pulling and restore the stash afterward (even if the pull
fails).

## Exit codes & errors

- Exits `0` when every requested Git operation succeeds
- Exits `1` if a configuration, Git command, or validation step fails (for
example: empty commit message, not a Git repo, failed pull/push)

Logs and user-facing messages are colorized via `colored` and `env_logger` for
easy scanning. Use `--verbose` when you need to inspect the underlying Git calls
and their stdout/stderr.

## Contributing

Bug reports and pull requests are welcome. Please open an issue first if you
would like to propose a sizable change. Make sure that `cargo fmt`,
`cargo clippy`, and the existing tests (`cargo test`) pass before submitting.

## License

Distributed under the MIT or Apache-2.0 . See [LICENSE](LICENSE) and
[LICENSE-APACHE](LICENSE-APACHE) for details.