| name | git-workflow |
| description | Don't guess git commands. Use this reference for all git and GitHub CLI operations. |
| emoji | 🧩 |
| version | 1.0.0 |
Git Workflow
Don't guess git commands. Use this reference for all git and GitHub CLI operations.
Status & Inspection
git status
git diff
git diff --staged
git log --oneline -10
git log --oneline --graph --all
git show <commit>
Staging & Committing
git add <file>
git add .
git commit -m "type: message"
git commit --amend --no-edit
git reset HEAD <file>
git restore <file>
Commit Message Format
Use conventional commits:
feat: add X — new feature
fix: resolve Y — bug fix
chore: update deps — maintenance
docs: update README — documentation
refactor: restructure Z — code reorganization
test: add tests for W — tests
Branching
git checkout -b feature/name
git switch main
git switch -c feature/name
git branch -d feature/name
git branch -D feature/name
git merge feature/name
git rebase main
Remote Operations
git fetch origin
git pull origin main
git push origin HEAD
git push -u origin feature/name
git push --force-with-lease
GitHub CLI (gh)
gh pr create --title "Title" --body "Description" --base main
gh pr create --draft
gh pr list
gh pr view
gh pr merge 123 --squash
gh pr review 123 --approve
gh issue create --title "Bug: X" --body "Details"
gh issue list
gh issue close 42
gh repo view --web
gh run list
Conflict Resolution
git status
git add <resolved-file>
git commit
git merge --abort
git rebase --abort
Stashing
git stash
git stash pop
git stash list
git stash apply stash@{2}
Undo / Recovery
git revert HEAD
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
git reflog
Prometheus-Specific Git Patterns
Repository Structure
- Main repo root:
D:\Prometheus (Windows) / /d/Prometheus (bash)
- Submodule:
workspace/xposemarket-site (a separate git repository tracked as mode 160000)
- Only one
.git directory at the root level
Working with Submodules
Initialize submodules after cloning:
git submodule status
git submodule update --init --recursive
For main Prometheus repo:
git status
git log --oneline -5
git branch --show-current
For submodule (workspace/xposemarket-site):
⚠️ NEVER use just xposemarket-site — always use the full relative path:
cd workspace/xposemarket-site && git status
git -C workspace/xposemarket-site status
cd xposemarket-site && git status
Recommended Pattern for Scripts & Tools
Use git -C to run commands in subdirectories without changing directories. This is more reliable in automated contexts:
git -C workspace/xposemarket-site status --short
git -C workspace/xposemarket-site log --oneline -5
git -C workspace/xposemarket-site branch --show-current
git -C workspace/xposemarket-site remote -v
Why git -C: Avoids directory state persistence issues, works consistently on Windows and Unix, and is ideal for tools and run_command operations.
Common Prometheus Workflows
Save and push work
git add .
git commit -m "feat: describe the change"
git push origin HEAD
Create feature branch → open PR
git checkout -b feature/my-thing
git add .
git commit -m "feat: implement my thing"
git push -u origin feature/my-thing
gh pr create --title "feat: my thing" --body "What and why" --base main
Sync branch with upstream main
git fetch origin
git rebase origin/main
git push --force-with-lease
Check submodule status
git -C workspace/xposemarket-site status
git -C workspace/xposemarket-site log --oneline -5
Safety Rules
- ❌ Never
git push --force on shared branches (main, develop)
- ✅ Use
--force-with-lease only on your own branches
- ✅ Always
git status before committing
- ❌ Never commit API keys, secrets, or .env files
- ✅ When unsure about destructive ops, stash or create a backup branch first
- ⚠️ Submodules: Always use full path
workspace/xposemarket-site — relative cd commands fail in tools