Skip to content

YaronKoresh/git-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Git Manager

A friendly, single-file Windows batch front-end for Git — turning intimidating commands into guided, plain-English actions.

platform shell git license

Git Manager is a self-contained .bat script that wraps everyday Git workflows behind a clean, numbered menu. Double-click it from anywhere inside a repo (or any subfolder) and it walks you through saving, syncing, branching, releasing, undoing mistakes, and even resolving merge conflicts — without ever needing to memorize a single Git flag.


Why use it

  • Zero install. One file. No dependencies beyond Git for Windows + built-in PowerShell.
  • Self-relocating. Copies itself to %TEMP% on launch so it never locks the repo folder.
  • Auto-finds the repo root. Walks up the directory tree until it finds .git.
  • Plain-language menus. "Save and upload", "Get latest updates", "Start a new task" — not push, pull, checkout -b.
  • Smart conflict resolver. Bundled PowerShell engine auto-resolves whitespace-only, identical, empty-side, and same-author conflicts, then walks you through anything left.
  • Safe by default. Automatic stashing, --force-with-lease before --force, backups before every conflict rewrite, and confirmation prompts on destructive actions.
  • Network resilience. Push/pull/fetch operations retry up to 3 times with backoff.

Quick start

  1. Make sure Git for Windows is installed and on PATH.
  2. Drop manage-git.bat anywhere — desktop, a tools folder, or directly inside your repo.
  3. Double-click it, or run it from any folder inside a Git repository:
    manage-git.bat
  4. Pick a number. That's it.

The script copies itself to %TEMP% and re-launches from there, passing your original folder as its working directory. This means you can update the source .bat file even while it's running.


Feature map

The main menu groups every operation into 12 categories:

# Category What it covers
1 Quick Actions One-shot combos: sync, update, new task, finish task, release, PR review, undo last commit, split a big commit, identity setup
2 First Time Setup Configure user, init / clone, set up remotes
3 Branches Create, switch, list, rename, delete, track remote branches
4 Saving Changes Stage, commit, amend, partial saves, stash management
5 Sync Pull, push, fetch, force-with-lease, set upstream
6 History Logs, file history, blame, status, diffs
7 Merging Merge branches, rebase, cherry-pick, with safety prompts
8 Undo Revert, reset (soft / mixed / hard), restore files, drop a specific commit
9 Versions Tags, releases, annotated tags, push tags
10 Subprojects Submodule add / update / sync / deinit
11 Advanced Reflog, gc, prune, low-level plumbing
12 Help — Resolve Conflicts The smart conflict resolver (see below)

The smart conflict resolver

When a merge, pull, rebase, or cherry-pick stops on conflicts, option [12] (or any flow that detected a conflict) launches the bundled resolver. It is a PowerShell engine embedded directly in the .bat (lines prefixed :::PS_RES:::) and extracted to %TEMP% at runtime.

Auto-resolution strategies

For every <<<<<<< / ======= / >>>>>>> block it runs these checks in order:

  1. Identical blocks — both sides made the same edit → keep one.
  2. Both sides empty → drop the whole block.
  3. One side empty → keep the non-empty side.
  4. Whitespace-only difference → keep ours.
  5. Same author, both sides → keep the newer commit's version (uses git log timestamps).
  6. Safe-concat for text formats (.gitignore, .env, .txt, .md) → deduplicated union of both sides.

Interactive fallback

Anything that can't be auto-resolved is shown side-by-side with these choices:

[1] Keep TOP block only
[2] Keep BOTTOM block only
[3] Keep BOTH: Top then Bottom
[4] Keep BOTH: Bottom then Top
[5] Open file in default editor

After each file, a colored git diff preview lets you Stage or Revert before moving on.

File-list actions

From the file picker you can also:

  • Type A to keep TOP for every remaining file
  • Type B to keep BOTTOM for every remaining file
  • Type ABORT to restore every backup and auto-detect & abort the underlying operation (merge --abort, rebase --abort, cherry-pick --abort, revert --abort)

Safety net

  • Every file is .bak-backed before being touched.
  • If the resolver would leave any unresolved markers in the output, it refuses to claim success and the original is restored.
  • BOMs, mixed line endings (CRLF / LF / CR), and unterminated conflict blocks are detected and handled without silently corrupting the file.

Recent fixes

  • Conflict-marker rewrite reliability. Previously, files with a UTF-8 BOM on the first line, stray \r characters at line ends, or unterminated conflict blocks could cause the parser to skip the opening <<<<<<< marker while still consuming the trailing >>>>>>> line as content — leaving a half-rewritten file. The parser now:
    • reads the file as raw bytes and strips the BOM explicitly,
    • detects markers with anchored regex (^<{7}(\s|$), ^={7}(\s|$), ^>{7}(\s|$), ^\|{7}(\s|$)) so trailing whitespace and CR characters can't fool it,
    • flushes any in-flight conflict block when a new marker or EOF arrives unexpectedly,
    • verifies the output is fully marker-free before declaring success (otherwise it returns exit 2 so the caller restores the backup),
    • preserves the original line endings and BOM when writing the resolved file.

Requirements

  • Windows with cmd.exe
  • Git for Windows (git on PATH)
  • Windows PowerShell 5.1+ (ships with Windows 10 / 11)

Tips

  • You can run the script from any subfolder of a repo — it walks up until it finds .git.
  • It also works fine for submodules: launch it from inside the submodule and it'll treat that as the repo root.
  • For force-push protection, the script always tries --force-with-lease first and only falls back to --force after an explicit confirmation.
  • Network ops (push, pull, fetch) auto-retry up to 3 times with a 3-second backoff.

License

See LICENSE.

About

Single-file Windows batch script that turns Git workflows into a guided menu, automates common repo tasks, and includes smart conflict resolution.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors