Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ install:
ln -sf rig ~/.local/bin/rip
ln -sf rig ~/.local/bin/rir
ln -sf rig ~/.local/bin/rim
ln -sf rig ~/.local/bin/rs
# clean old gt symlinks
rm -f ~/.local/bin/gt ~/.local/bin/gco ~/.local/bin/gto
rm -f ~/.local/bin/gtp ~/.local/bin/gtr
Expand All @@ -15,5 +16,5 @@ install:
rm -f ~/bin/gt ~/bin/gco ~/bin/gto ~/bin/gtp ~/bin/gtr

clean:
rm -f ~/.local/bin/rig ~/.local/bin/rco
rm -f ~/.local/bin/rig ~/.local/bin/rco ~/.local/bin/rs
rm -f ~/.local/bin/rip ~/.local/bin/rir ~/.local/bin/rim
16 changes: 16 additions & 0 deletions rig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ maintain, no tracking to configure, no stale branches to clean up.
| `rig push` / `rig p` | `rip` | Push HEAD to origin/branch |
| `rig rebase` / `rig r` | `rir` | Fetch + rebase -i origin/branch |
| `rig merge` / `rig m` | `rim` | Fetch + merge origin/branch |
| `rig status` / `rig s` | `rs` | Show branch, tracking info, recent history |

**Shared flags**: `-z` offline (no fetch), `-n` dry-run, `?` force fzf

Expand Down Expand Up @@ -106,6 +107,21 @@ rim -n main # Dry-run
rim ? # Interactive branch selection
```

### Status (rs)

```bash
rs # Show current branch, ahead/behind, recent history
```

Output:
```
feature (origin/feature, 3 ahead)
M src/main.rs

Recent:
main → feature → bugfix → feature
```

## How It Works

Single busybox-style script. Symlinks (`rco`, `rip`, `rir`, `rim`)
Expand Down
20 changes: 19 additions & 1 deletion rig/rig
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,27 @@ EOF
fi
}

# ── Status ───────────────────────────────────────────────────────────

cmd_status(){
local branch=$(get_current_branch 2>/dev/null) || true
if [[ -z "$branch" ]]; then echo "(detached)"; return; fi
local a=$(git rev-list --count "origin/$branch..HEAD" 2>/dev/null || echo "?")
local b=$(git rev-list --count "HEAD..origin/$branch" 2>/dev/null || echo "?")
local t=""
[[ "$a" != "0" && "$a" != "?" ]] && t+="${a} ahead"
[[ "$b" != "0" && "$b" != "?" ]] && { [[ -n "$t" ]] && t+=", "; t+="${b} behind"; }
[[ -n "$t" ]] && echo "$branch (origin/$branch, $t)" || echo "$branch"
git status --short -uno 2>/dev/null
local h=$(recent | head -5 | paste -sd '→' -)
[[ -n "$h" ]] && printf "\nRecent:\n %s\n" "$h"
}

# ── Install ──────────────────────────────────────────────────────────

cmd_install(){
local dir=$(dirname "$(readlink -f "$0")")
local symlinks=(rco rip rir rim)
local symlinks=(rco rip rir rim rs)
for s in "${symlinks[@]}"; do
ln -sf rig "$dir/$s"
echo " $dir/$s -> rig"
Expand All @@ -164,6 +180,7 @@ rig - ripgit: git tools
rig p [branch] Push to origin (rip)
rig r [pattern] Rebase -i origin (rir)
rig m [pattern] Merge origin (rim)
rig s Show branch, tracking, recent (rs)
rig install Create symlinks

Flags: -z offline, -n dry-run, ? force fzf
Expand All @@ -177,6 +194,7 @@ dispatch(){
p|push|rip) shift; cmd_push "$@" ;;
r|rebase|rir) shift; cmd_branch_op rebase "$@" ;;
m|merge|rim) shift; cmd_branch_op merge "$@" ;;
s|status|rs) shift; cmd_status "$@" ;;
install) cmd_install ;;
-h|--help|help|"") usage ;;
*) echo "error: unknown command: $1"; usage ;;
Expand Down