git-update

Installation
SKILL.md

Execute the following steps:

  1. Check if current directory is a valid git repository
  2. Fetch latest changes from remote
  3. Check if working directory is clean (no local changes)
  4. If clean: analyze safety and pull with rebase directly (skip stash operations)
  5. If dirty: stash changes with git stash push --include-untracked --keep-index (preserves staging state)
  6. Analyze if rebasing looks safe (check for potential conflicts by comparing commit histories)
  7. If safe: pull with rebase, then restore stash if needed with git stash pop
  8. If unsafe: abort and restore stash if needed with git stash pop to return to exact original state
  9. Always provide exactly one sentence summary of the operation result

Safety checks:

  • Use git rev-parse --is-inside-work-tree to verify git repository
  • Look for divergent commit histories that could cause conflicts
  • Check if remote has force-pushed (dangerous for rebase)
  • Verify we're on a branch that can be safely rebased
  • Use git status --porcelain to check for local changes efficiently
  • Only stash/unstash if working directory is dirty
Installs
62
Repository
dzhuneyt/skills
First Seen
Jun 13, 2026