AI Skill Report Card

Pushing Git Changes

B+84·Nov 27, 2026·Source: Web
14 / 15
Bash
git status --short && git branch --show-current && git remote -v git diff # review unstaged changes git add path/to/file1 path/to/file2 git commit -m "feat(scope): short description" git push # or: git push -u <remote> <branch> if no upstream

Never use git add ., --force, reset --hard, or rebase --skip without reviewing the changes or getting explicit user approval.

Recommendation▾
Trim content Claude already knows: the Conventional Commits type table, the generic common-errors table, and the 'Best Practices' and 'Common Pitfalls' sections largely restate guidance already given in the workflow. Merge or cut the duplication to tighten conciseness.
14 / 15
Progress:
- [ ] Step 1: Inspect repository state
- [ ] Step 2: Review changes for problems
- [ ] Step 3: Run project checks
- [ ] Step 4: Stage specific files and commit
- [ ] Step 5: Push (set upstream if needed)
- [ ] Step 6: Handle rejection or auth failure
- [ ] Step 7: Confirm result and report

Step 1: Inspect Repository State

Bash
git status git branch --show-current git branch -vv # shows upstream tracking git remote -v git log -5 --oneline

Identify the current branch, configured remote(s), upstream, staged vs. unstaged files, and recent history. Never assume the branch is main/master or the remote is origin.

Step 2: Review Changes

Bash
git status --short git diff # unstaged git diff --cached # staged

Look for:

  • Secrets: API keys, passwords, tokens, connection strings, .env files
  • Debug code (console.log, Debugger, print statements, commented-out blocks)
  • Build artifacts, node_modules, bin/, obj/, .DS_Store, logs
  • Unrelated changes that belong in a separate commit
  • Environment-specific configuration

If secrets are found: stop, do not commit, tell the user. If a secret was already committed, warn that rotating it is required (removing it from history is not sufficient).

Step 3: Run Project Checks

Detect the project type and use existing scripts. Do not add or upgrade dependencies as part of a push.

ProjectCommands
.NETdotnet restore && dotnet build && dotnet test
Node/React/TSnpm install && npm run build && npm run lint && npm test
Pythonpytest / ruff check . / project-defined scripts

If a check fails, report the errors and ask whether to fix or proceed. Never claim checks passed if they weren't run. If no checks exist, say so.

Step 4: Stage and Commit

Stage specific files:

Bash
git add src/Inventory/ReceiptValidator.cs tests/ReceiptValidatorTests.cs git commit -m "feat(inventory): add receipt validation"

Use git add . or git add -A only after reviewing the full diff and confirming the user wants everything included.

Commit message format (Conventional Commits):

<type>(<scope>): <imperative description>
TypeUse for
featNew functionality
fixBug fixes
refactorRestructuring without behavior change
docsDocumentation
testTests
choreMaintenance, dependencies
styleFormatting only
perfPerformance

Keep the subject under ~72 characters, imperative mood ("add", not "added"). Add a body (git commit with a second -m) when the why isn't obvious. Split unrelated changes into separate commits.

If the repository's history uses a different convention, follow the repository's convention.

Step 5: Push

Bash
git branch -vv # check for upstream
  • Upstream exists: git push
  • No upstream: git push -u <remote> <branch-name>

Do not push directly to protected or shared branches (main, master, release/*) without user authorization. If the user is on main and the repository uses pull requests, suggest creating a branch.

Step 6: Handle Failures

Rejected: non-fast-forward / "fetch first"

Bash
git fetch <remote> git log --oneline --graph --decorate --all -15 git status

Explain the divergence to the user (how many commits ahead/behind). Then integrate remote changes:

Bash
git pull --rebase <remote> <branch>

Use merge instead (git pull --no-rebase) if the user prefers it, the branch is shared, or the repo convention is merge commits.

If conflicts occur:

  1. git status to list conflicted files
  2. Open each file, read both sides, and preserve intent from both where possible
  3. Remove all conflict markers (<<<<<<<, =======, >>>>>>>)
  4. Re-run project checks
  5. git add <resolved-files> then git rebase --continue (or git commit for merges)

If the right resolution is unclear, stop and ask the user. Abort safely with git rebase --abort or git merge --abort if things go wrong.

Authentication failure

Bash
git remote -v git config --get credential.helper

Diagnose which applies: expired/missing credentials, personal access token required (HTTPS), SSH key not loaded/registered (ssh -T git@github.com), or insufficient repository permissions. Give the user the fix steps. Never ask for or print passwords or tokens.

Other common errors

ErrorCause / Action
src refspec ... does not match anyNo commits yet, or wrong branch name. Check git branch and git log.
remote: Permission deniedWrong account or no write access. Check remote URL and permissions.
protected branch hook declinedPush via a feature branch and pull request.
file exceeds 100 MBRemove the file from the commit, add to .gitignore, consider Git LFS.
no upstream branchUse git push -u <remote> <branch>.

Step 7: Confirm and Report

Bash
git status git log -1 --stat git branch -vv

Report: branch pushed, remote, commit hash and message, files changed, checks run (and results), and the pull request link if the remote returned one.

Recommendation▾
Make examples true input/output pairs with literal artifacts: show actual command output (e.g., a real `git push` rejection message, a conflict-marker block before/after resolution) and a commit message that is bad vs. good, rather than prose summaries of 'Actions' and 'Output'.

Create a new branch before committing when the user asks, or when the current branch is protected:

Bash
git switch -c feature/inventory-receipt-validation

Naming: feature/<description>, fix/<description>, refactor/<description>, docs/<description>, lowercase-kebab-case. Uncommitted changes carry over to the new branch automatically.

Verify the base before branching: git fetch <remote> and confirm the starting point is the intended branch.

14 / 20

Example 1: Standard push Input: "Commit and push my changes" Actions: inspect state, find 3 modified files and no secrets, run dotnet build && dotnet test (pass), stage the 3 files, commit fix(category): resolve category loading issue, git push. Output: "Pushed fix/category-loading to origin. Commit a1b2c3d: 3 files changed. Build and 42 tests passed."

Example 2: No upstream Input: "Push this branch" Actions: git branch -vv shows no tracking branch, so git push -u origin feature/export-report. Output: "Pushed and set upstream to origin/feature/export-report."

Example 3: Rejected push Input: "Push failed with non-fast-forward" Actions: git fetch origin, find 2 remote commits not in local history, git pull --rebase origin feature/export-report, resolve a conflict in ReportService.cs preserving both changes, git add, git rebase --continue, re-run tests, git push. Output: "Rebased onto 2 remote commits, resolved 1 conflict in ReportService.cs (kept both the new filter and the remote null-check). Tests pass. Pushed."

Example 4: Secret detected Input: "Push everything" Actions: git diff reveals appsettings.Production.json containing a connection string password. Output: "Stopped before committing: appsettings.Production.json contains a database password. Recommend adding it to .gitignore and using environment variables or user-secrets. I've staged the other 4 files. Want me to commit those?"

Recommendation▾
Add a negative example showing a bad outcome (e.g., a force-push or `git add .` that wiped or leaked work and the correct alternative), and include a failed-checks example so the 'ask whether to fix or proceed' path is demonstrated.
  • Always inspect before acting; state what you found.
  • Prefer small, focused commits with clear messages.
  • Fetch before pushing to shared branches to avoid surprises.
  • Prefer --force-with-lease over --force in the rare case a force-push is approved, and only on your own feature branch.
  • Respect .gitignore; if a needed pattern is missing, propose adding it.
  • Preserve the user's uncommitted work: if switching branches or pulling requires a clean tree, ask before using git stash, and always tell the user what was stashed.
  • Follow the repository's existing conventions (commit style, branching model, PR process).
  • After pushing, mention PR creation if the workflow expects it.
  • Blind git add .: sweeps in secrets, artifacts, and unrelated changes.
  • Force-pushing to fix a rejection: destroys others' commits. Integrate with rebase or merge instead.
  • git reset --hard or git checkout . to "clean up": permanently discards uncommitted work.
  • Assuming origin and main: always read git remote -v and the current branch.
  • Claiming checks passed without running them.
  • Pushing to a protected branch directly.
  • Resolving conflicts by taking one side wholesale: loses someone's work; read both sides.
  • Committing secrets, then deleting them in a later commit: they remain in history; rotate the credential.
  • Vague messages like "update", "fix stuff", "wip".
  • Mixing unrelated changes in one commit.
  • Requesting or echoing credentials: never ask for passwords or tokens.
0
Grade B+AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
14/15
Workflow
14/15
Examples
14/20
Completeness
16/20
Format
15/15
Conciseness
11/15