git-commit
Safely commit changes with automatic syncing, rebasing, and git hook enforcement
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Safely commit changes with automatic syncing, rebasing, and git hook enforcement
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Guide the agent through iterative PR/MR refinement to ensure all CI checks, tests, linting, and validation passes before considering the work complete. Never declare success until all automated checks pass.
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Use when executing implementation plans with independent tasks in the current session
| name | git-commit |
| description | Safely commit changes with automatic syncing, rebasing, and git hook enforcement |
| version | 1.0.0 |
| author | GitHub Copilot |
| tags | ["git","version-control","commit","rebase","hooks"] |
This skill ensures safe git commits by:
This skill should be invoked before committing changes to ensure your branch is up-to-date and properly rebased.
Fetch all remote branches to ensure we have the latest information:
git fetch origin
Get the current branch name:
CURRENT_BRANCH=$(git branch --show-current)
Check if a remote branch with the same name exists:
git ls-remote --heads origin "$CURRENT_BRANCH" | grep -q "$CURRENT_BRANCH"
REMOTE_BRANCH_EXISTS=$?
If the same-name remote branch exists, rebase from it. Otherwise, rebase from origin/main:
if [ $REMOTE_BRANCH_EXISTS -eq 0 ]; then
echo "Rebasing from origin/$CURRENT_BRANCH"
git rebase "origin/$CURRENT_BRANCH"
else
echo "Rebasing from origin/main"
git rebase origin/main
fi
Stage your changes and commit. Git hooks will run automatically:
git add .
git commit
NEVER use --no-verify or -n flags, as this bypasses git hooks.
Rebase Conflicts: If conflicts occur during rebase, resolve them manually:
# Fix conflicts in files
git add <resolved-files>
git rebase --continue
Failed Hooks: If pre-commit or commit-msg hooks fail, fix the issues they report and try again. Do not bypass hooks.
# 1. Fetch latest
git fetch origin
# 2. Get current branch
CURRENT_BRANCH=$(git branch --show-current)
# 3. Check for remote branch
if git ls-remote --heads origin "$CURRENT_BRANCH" | grep -q "$CURRENT_BRANCH"; then
git rebase "origin/$CURRENT_BRANCH"
else
git rebase origin/main
fi
# 4. Commit (hooks will run)
git add .
git commit -m "Your commit message"
git commit --amend (hooks still run)git push origin $CURRENT_BRANCH after successful commit✅ Always fetches latest remote changes
✅ Rebases from appropriate branch
✅ Never bypasses git hooks
✅ Prevents diverged branch issues
✅ Enforces pre-commit validations