Metadata-Version: 2.4
Name: gitpush-tool
Version: 0.4.1
Summary: Supercharged Git push tool with automatic GitHub repo creation and pushing
Home-page: https://github.com/inevitablegs/gitpush
Author: Ganesh Sonawane
Author-email: sonawaneganu3101@gmail.com
License: MIT
Project-URL: Documentation, https://github.com/inevitablegs/gitpush
Project-URL: Source, https://github.com/inevitablegs/gitpush
Project-URL: Tracker, https://github.com/inevitablegs/gitpush/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-python
Dynamic: summary

# GitPush Tool 🚀

[![PyPI version](https://img.shields.io/pypi/v/gitpush-tool.svg)](https://pypi.org/project/gitpush-tool/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/inevitablegs/gitpush/blob/main/LICENSE)

A supercharged Git CLI and safety tool that simplifies repository creation and pushing with intelligent defaults, rich pre-push diffstat inspection (`+++---` lines), and active safeguards against dangerous Git commands.

---

## ✨ Features

- **Decision-Support Status Dashboard (`gitpush status`):** Actionable repository overview showing worktree breakdown, commit sync, intelligent next-step recommendations, and a 0-100 Repo Health score.
- **Pre-Push Safety & Diffstat Preview:** See changed files, line additions/deletions (`+X, -Y`), ahead/behind status, and pending commits before pushing.
- **Dangerous Git Operation Guard:** Analyzes and protects against risky actions (`reset --hard`, force pushes, deleting unmerged branches, dirty `git clean`, detached HEADs).
- **Protected Branch Safeguard:** Automatically detects and alerts when pushing or force-pushing to `main`, `master`, `prod`, `release`, or `dev`.
- **One-Command GitHub Repo Creation:** Initialize Git, create a remote GitHub repo, and push in a single step via GitHub CLI (`gh`).
- **Safe Force Pushing:** Uses `--force-with-lease` by default to avoid overwriting teammate commits.
- **Dry-Run Mode:** Preview your push inspection without modifying anything.
- **Non-Interactive & CI Friendly:** Skip prompts with `-y` or `--yes`.

---

## 📊 Decision-Support Status Dashboard (`gitpush status`)

```text
Repository:  my-project
Branch:      feature/payment
Tracking:    origin/feature/payment

WORKTREE
────────────────────────
Modified       4
Added          2
Deleted        1
Untracked      3
Line Changes   +142, -18

COMMITS
────────────────────────
Ahead          3
Behind         1

PUSH / STATUS
────────────────────────
⚠ Remote has 1 commit(s) you don't have locally.

Recommended:
    git pull --rebase
    gitpush "Commit message"

Health:
    82/100 [████████░░] Good (Minor Action Needed)
```

---

## 🛡️ Pre-Push Warning & Inspection

Whenever you run `gitpush`, you get an instant, clear breakdown of your repository state:

```text
═══════════════════════════════════════════════════════════════
 🚀 GITPUSH PRE-PUSH INSPECTION & SUMMARY
═══════════════════════════════════════════════════════════════

Repository:    my-project (/Users/username/Projects/my-project)
Target Branch: main ⚠️ [PROTECTED BRANCH]  ──>  origin/main
Sync Status:   Ahead: 2 commit(s), Behind: 0 commit(s)
Action:        Commit: 'Add user authentication flow'

Warnings:
  ⚠️  Pushing directly to protected branch 'main'.

Changed Files (3 file(s), +84 / -12):
  M   src/auth.py                          (+65, -8)
  M   README.md                            (+19, -4)
  ??  config/auth.json                     (+12 lines, untracked)

Pending Commits to Push (2):
  • 8f3d1a2 Initial auth scaffold
  • 4e9c7b1 Implement JWT token verification
═══════════════════════════════════════════════════════════════

Continue? [y/N]:
```

---

## 🛑 Dangerous Command Guard

Use `gitpush guard <command>` (or `gitpush-guard <command>`) before executing risky Git operations:

```text
Command: [WARNING ⚠️]
    git reset --hard HEAD~5

Changes that may be lost:
    5 commit(s)
    12 modified/staged file(s)

Risks & Warnings:
    ⚠️  All uncommitted changes in tracked files will be permanently discarded.
    ⚠️  12 uncommitted modified/staged file(s) will be lost immediately.
    ⚠️  5 commit(s) will be unlinked from current branch HEAD.

Repository:
    my-project

Continue? [y/N]:
```

### What Guard Detects:
- **`reset --hard`**: Identifies uncommitted files and commits that will be orphaned.
- **`force push`**: Detects remote overwrite risks and protected branch overrides.
- **`deleting branches`**: Identifies unmerged commits that would be lost.
- **`cleaning untracked files`**: Warns of files/directories `git clean -fd` will permanently delete.
- **`checkout / restore`**: Flags uncommitted modifications about to be discarded.
- **`rebasing with uncommitted work`**: Warns of dirty working trees before rebase conflicts occur.
- **`pushing to protected branches`**: Direct pushes to `main`, `master`, `prod`, `dev`, etc.
- **`detached HEAD situations`**: Warns when working or committing on detached HEADs.

---

## 🛠️ Usage & Commands

| Command | Description |
|---|---|
| `gitpush "Commit message"` | Stages all changes, previews diffs, commits, and pushes. |
| `gitpush` | Pushes staged/unpushed changes with safety preview. |
| `gitpush -y` | Pushes immediately without confirmation prompt. |
| `gitpush --dry-run` | Shows the pre-push inspection and exits without changes. |
| `gitpush --force` | Safe force push using `--force-with-lease`. |
| `gitpush --tags` | Pushes all local tags. |
| `gitpush guard <git command>` | Inspects and guards any dangerous Git command. |
| `gitpush --init` | Initializes Git repo and creates default `.gitignore`. |
| `gitpush --new-repo <name>` | Creates a new GitHub repo and pushes in one step. |

---

## 📄 License

MIT License. See [LICENSE](https://github.com/inevitablegs/gitpush/blob/main/LICENSE) for details.
