Skip to content

Latest commit

 

History

History
120 lines (102 loc) · 3.93 KB

File metadata and controls

120 lines (102 loc) · 3.93 KB

Git Utilities for Windows Command Prompt

This directory contains standalone batch files that provide git aliases and functions converted from zsh to Windows batch format.

Setup

  1. The _bashrc.cmd file automatically adds this directory to your PATH
  2. All git aliases are defined using doskey commands
  3. Complex functions are implemented as standalone .bat files

Available Aliases

Basic Git Commands

  • ggit
  • gugit-update.bat (fetch + pull)
  • gsgit-status.bat (fetch + status + worktree list)
  • gdgit diff
  • gd0git diff HEAD~0
  • gd1git diff HEAD~1
  • gagit add
  • grgit restore
  • grrgit remote
  • grrsgit remote -v show
  • grsgit restore --staged
  • gragit restore --staged . && git restore .
  • grAgit-restore-all.bat (restore all + clean)
  • gfgit fetch -p
  • gftgit fetch --tags -f
  • gcgit commit
  • gcagit commit --amend
  • gchgit-checkout.bat (fetch + checkout)
  • gclgit clone
  • glgit log
  • glsagit ls-remote --refs
  • glsbgit ls-remote --refs --heads
  • glsgit-ls-remote-formatted.bat (formatted remote branches)
  • glstgit ls-remote --refs --tags

Git Branch Commands

  • gbgit branch
  • gtgit tag
  • gbvgit branch -vv
  • gbvrgit branch -vv -r
  • gbcgit branch --show-current
  • gblggit branch -vv | grep gone (gone branches)
  • gbDgit branch -D $(gblg) (delete gone branches)
  • gblbgit branch -vv | grep behind (behind branches)

Git Push/Pull Commands

  • gplgit pull
  • gplogit pull origin
  • gphgit push
  • gphogit push -u origin
  • gphtgit push --tags
  • gphfgit push --force

Git Merge/Rebase Commands

  • gmgit merge
  • gmagit merge --abort
  • grbgit rebase
  • grbcgit rebase --continue
  • grbagit rebase --abort

Git Cherry-pick Commands

  • gcpgit cherry-pick
  • gcpagit cherry-pick --abort
  • gcpcgit cherry-pick --continue

Git Stash Commands

  • gstgit stash
  • gstagit stash apply
  • gstpgit stash pop
  • gstlgit stash list
  • gstsgit stash show
  • gstdgit stash drop

Git Worktree Commands

  • gwgit worktree
  • gwlgit worktree list
  • gwagit worktree add
  • gwmgit worktree move
  • gwrgit worktree remove
  • gwpgit worktree prune

Git PR Commands

  • gprlgit branch -vv | grep __PR- (PR branches)
  • gprDgit branch -D $(gprl) (delete PR branches)

Complex Functions

  • gbUgit-branch-update-all.bat (update all branches)
  • gdngit-diff-n.bat (diff n commits back)
  • gwAgit-worktree-add.bat (add worktree with naming)
  • gwchgit-worktree-checkout.bat (switch worktrees)
  • gprgit-pull-request.bat (fetch PR branches)

Usage

After loading _bashrc.cmd, you can use these aliases from any directory:

gs          # git status with fetch and worktree list
gu          # git update (fetch + pull)
gbU         # update all branches
gdn 2       # show diff from 2 commits ago
gwA ../feature-branch  # add worktree for feature-branch
gpr 123     # fetch and checkout PR #123

Files

  • git-update.bat - Fetch and pull
  • git-status.bat - Fetch, status, and worktree list
  • git-restore-all.bat - Restore all changes and clean
  • git-checkout.bat - Fetch and checkout
  • git-branch-update-all.bat - Update all branches
  • git-diff-n.bat - Show diff from n commits back
  • git-worktree-add.bat - Add worktree with naming
  • git-worktree-checkout.bat - Switch between worktrees
  • git-pull-request.bat - Fetch and checkout PR branches
  • test-git-aliases.bat - Test script to verify setup