ChatGPT PromptsChatGPT prompts100 Prompts

100 Best ChatGPT Prompts for Git Command Troubleshooting

A practical Git Command Troubleshooting prompt library powered by ChatGPT prompts. 100 best prompts to diagnose, fix, and learn Git command issues.

GitGit TroubleshootingChatGPT promptsCommand lineVersion controlGit errorsGit workflowsLFSSSHHTTPSsubmodules

Best For

Developers, DevOps engineers, and IT professionals who need practical, repeatable prompts to troubleshoot Git command issues using ChatGPT.

Prompt Use Cases

  • Diagnose Git command errors
  • Resolve merge conflicts
  • Fix authentication failures (SSH/HTTPS)
  • Troubleshoot remote and local repository issues
  • Reproduce and test fixes with exact commands
  • Improve Git workflow reliability

Introduction

This page serves as a practical prompt library for Git Command Troubleshooting. It’s designed for developers, DevOps engineers, and IT professionals who want ready-to-use, copyable prompts to diagnose and fix Git command issues using ChatGPT prompts.

Use these prompts to shorten debugging time, standardize troubleshooting steps, and create repeatable workflows for common Git problems.

Direct Answer

The best ChatGPT prompts for Git Command Troubleshooting are a comprehensive, ready-to-run set of 100 prompts that guide a ChatGPT assistant through diagnosing errors, validating repository state, and providing safe, step-by-step remediation commands. They are designed to be immediately usable with placeholders like [repository], [remote], [branch], [error], [path], and other context-specific tokens.

How to Use These ChatGPT Prompts

  • Replace placeholders like [repository], [remote], [branch], [error], [path], [OS], [git_version], and [token] with your real values before running the prompt.
  • Add constraints such as time bounds, safety checks, and non-destructive defaults to keep operations safe.
  • Request outputs in clear formats: a prioritized command list, followed by verification steps and rollback options if needed.
  • Verify outputs by executing the suggested commands in a controlled environment and cross-checking results against the repository state.

100 Best ChatGPT Prompts for Git Command Troubleshooting

  1. Diagnose the primary Git error message — You are a Git Command Troubleshooter. Role: Senior Git Engineer. Task: Diagnose and resolve the primary error shown when executing a Git operation in a [repository]. Context: The error reported is "[error]" during a [operation] on [branch]/[remote]. Output format: Provide a concise diagnosis, a prioritized, step-by-step command plan, and code blocks for each command. Constraints: Do not modify unrelated files; include rollback options if destructive commands are necessary; ensure commands are safe for a typical workspace. Include expected outcomes after each step.
  2. Verify repository state before troubleshooting — You are a Git Command Troubleshooter. Role: Senior Git Engineer. Task: Validate the current repository state before attempting fixes. Context: Repository at [path] contains [branch] and [remote] settings. Output format: List of checks in bullets with commands and exact expected results. Constraints: Use non-destructive checks first; clearly indicate if anything requires user intervention.
  3. Check remote URL and authentication — You are a Git Command Troubleshooter. Role: Authentication Specialist. Task: Verify remote URL(s) and authentication method for a Git operation in [repository]. Context: Remote is set to [remote_url] and authentication uses [https|ssh]. Output format: Step-by-step commands to verify remote, test connectivity, and refresh credentials; include examples for both SSH and HTTPS. Constraints: Do not alter remote configuration unless required to fix connectivity.
  4. Validate branch existence and spelling — You are a Git Command Troubleshooter. Role: Branch Expert. Task: Confirm the target branch exists and is spelled correctly for a [repository]. Context: Attempted operation targets [branch]. Output format: Commands to list branches, show remote-tracking branches, and verify name usage; include fallback commands if branch is missing. Constraints: Do not create branches unless requested.
  5. Inspect recent commits for issues — You are a Git Command Troubleshooter. Role: Code History Analyst. Task: Inspect recent commits to identify potential causes of the issue. Context: Last [n] commits affecting [path] in [repository]. Output format: A compact summary of each commit and a plan to test suspected changes; include commands to view diffs for specific commits.
  6. Reproduce error with minimal steps — You are a Git Command Troubleshooter. Role: Reproduction Specialist. Task: Reproduce the reported issue with a minimal, isolated setup. Context: Reproduction occurs with [minimal_repo_path] and [initial_branch]. Output format: A reproducible, minimal sequence of commands and expected outputs; include a rollback plan. Constraints: Remove extraneous files and modify only necessary components.
  7. Interpret Git status output accurately — You are a Git Command Troubleshooter. Role: Status Analysis Expert. Task: Interpret a noisy git status output for a [repository]. Context: Status shows [clean|unstaged|staged] files, [untracked] files, and [ignored] patterns. Output format: A clear diagnostic, followed by precise commands to clean or stage changes; include a brief rationale.
  8. Resolve merge conflict guidance — You are a Git Command Troubleshooter. Role: Merge Conflict Specialist. Task: Provide a safe, reproducible set of steps to resolve a merge conflict in [repository] on [branch]. Context: Conflict markers found in [file_path]. Output format: Step-by-step commands, with a recommended strategy (ours/theirs/merge) and post-resolve verification commands.
  9. Troubleshoot 'git push' authentication failures — You are a Git Command Troubleshooter. Role: Credential Guide. Task: Resolve authentication failures during git push for [repository]. Context: Remote uses [SSH|HTTPS] and credentials are [present|expired|revoked]. Output format: Commands to verify credentials, refresh tokens/keys, and reattempt push; include fallback methods.
  10. Troubleshoot 'fatal: could not read from remote repository' — You are a Git Command Troubleshooter. Role: Connectivity Expert. Task: Fix read-from-remote errors during a push/pull/fetch. Context: Remote URL is [remote_url], network may have [proxy|firewall] restrictions. Output format: Diagnostic steps, network tests, and commands to retry with explicit SSH/HTTPS settings.
  11. Debug 'git fetch' hang or timeout — You are a Git Command Troubleshooter. Role: Performance Analyst. Task: Diagnose and resolve a hanging git fetch. Context: Fetch hangs after [seconds], from remote [remote]. Output format: Time-bounded tests, commands to optimize network, and a safe fallback strategy to proceed with partial data.
  12. Resolve 'Permission denied (publickey)' during SSH — You are a Git Command Troubleshooter. Role: SSH Expert. Task: Fix SSH public key authentication failures for [repository]. Context: SSH key [key_id] is configured; agent shows [agent_status]. Output format: Steps to add key to ssh-agent, verify agent, and test connection with ssh -T; include a secure command sequence.
  13. Troubleshoot 'fatal: ref not found' errors — You are a Git Command Troubleshooter. Role: Reference Resolver. Task: Resolve 'ref not found' when referencing [ref_type] in [repository]. Context: Command attempted was [command]. Output format: Commands to list refs, verify fetch/pull targets, and fix ref syntax.
  14. Verify SSH key setup and agent forwarding — You are a Git Command Troubleshooter. Role: SSH Agent Specialist. Task: Verify SSH keys and agent forwarding for a remote repository. Context: Access uses [ssh_host], agent state [agent_status], and key [key_type]. Output format: Commands to confirm keys, agent, and test SSH connection.
  15. Diagnose 'Everything up-to-date' but nothing pushed — You are a Git Command Troubleshooter. Role: State Auditor. Task: Explain why an attempted push reports 'Everything up-to-date'. Context: Local branch [branch] tracks [remote/branch], and [remote] shows latest commit [hash]. Output format: Diagnostic reasoning, and commands to force-check history and remote status.
  16. Analyze 'git diff' shows unexpected changes — You are a Git Command Troubleshooter. Role: Diff Analyst. Task: Investigate unexpected diffs between working tree and index. Context: Diff shows changes in [path]. Output format: Commands to inspect staging area, file contents, and revert or commit if necessary.
  17. Confirm remote tracking configuration — You are a Git Command Troubleshooter. Role: Remote Tracker. Task: Validate the remote-tracking configuration for a given repository. Context: Remote is [remote], local branch [branch] tracks [branch@{remote}]. Output format: Commands to list remotes, show branch configs, and correct tracking if needed.
  18. Troubleshoot 'no such file or directory' in Git hooks — You are a Git Command Troubleshooter. Role: Hook Troubleshooter. Task: Diagnose a 'no such file or directory' error coming from a pre-commit/post-commit hook. Context: Hook script path is [hook_path], interpreter [shell]. Output format: Commands to verify hook paths, permissions, and how to bypass for testing.
  19. Resolve 'remote end hung up unexpectedly' — You are a Git Command Troubleshooter. Role: Connection Specialist. Task: Resolve abrupt remote termination during push/pull. Context: Remote is [remote], operation [operation], and network shows [latency|packet_loss]. Output format: Steps to reconfigure transport, increase timeout, and verify remote health.
  20. Debug 'git reset --hard' losing work — You are a Git Command Troubleshooter. Role: Safety Advisor. Task: Safely diagnose a scenario where 'git reset --hard' may have lost work. Context: Worktree contains [uncommitted_changes], and you want to recover with [reflog] or [stash]. Output format: Recovery steps, commands to restore files, and preventive measures.
  21. Resolve 'index.lock' lock file issues — You are a Git Command Troubleshooter. Role: Lockfile Expert. Task: Resolve a lingering index.lock during an operation in [repository]. Context: Other process may hold lock; PID [pid] visible. Output format: Safe steps to remove lock and retry the operation; include a check that repository integrity is intact.
  22. Troubleshoot 'Could not resolve host' DNS — You are a Git Command Troubleshooter. Role: Network Resolver. Task: Fix DNS resolution failures when contacting a Git remote. Context: Remote URL host [host] cannot be resolved; environment is [OS]. Output format: Network diagnostics and commands to bypass DNS via /etc/hosts, and verify proper DNS config.
  23. Check Git config core.autocrlf and line endings — You are a Git Command Troubleshooter. Role: Config Specialist. Task: Review and adjust core.autocrlf and line ending handling for a cross-platform repo. Context: Team uses [OS] systems with [text] files. Output format: Commands to view config, recommended values, and test with sample files.
  24. Fix 'fatal: Authentication failed' during HTTPS — You are a Git Command Troubleshooter. Role: HTTPS Auth Specialist. Task: Resolve HTTPS authentication failures for a repository. Context: Token/password or credential helper state [state], remote is [https_url]. Output format: Steps to refresh credentials, configure token scopes, and verify push/pull works.
  25. Troubleshoot Git LFS failures — You are a Git Command Troubleshooter. Role: LFS Specialist. Task: Troubleshoot Git LFS pointer issues in [repository]. Context: LFS pointer file [path] points to [oid], and lfs fetch/fetch --all fails. Output format: Commands to verify LFS install, track patterns, and fetch binaries.
  26. Resolve 'repository not found' errors on GitHub — You are a Git Command Troubleshooter. Role: GitHub Integrations Expert. Task: Resolve 'repository not found' when interacting with GitHub. Context: Repo slug [repo], user/token permissions [perm]. Output format: Checks for repository visibility, permission, and correct remote URL, with corrective commands.
  27. Diagnose 'branch is behind' and rebase strategy — You are a Git Command Troubleshooter. Role: Branch Strategy Advisor. Task: Address 'branch is behind' by proposing a safe rebase or merge approach. Context: Local [branch] tracks [remote/branch] and is behind by [n] commits. Output format: Recommended strategy, commands to update, and verification steps.
  28. Validate GPG signatures and verification — You are a Git Command Troubleshooter. Role: Security Auditor. Task: Validate GPG-signed commits and verification status in [repository]. Context: Verification shows [status]. Output format: Commands to configure GPG, verify signatures, and handle unsigned commits.
  29. Fix 'fatal: bad object' corrupted repo — You are a Git Command Troubleshooter. Role: Corruption Specialist. Task: Repair a corrupted repository in [path]. Context: Corruption indicated by [error]. Output format: Steps to verify integrity, recover from backup or reflog, and prevent recurrence.
  30. Investigate 'diverged' branches — You are a Git Command Troubleshooter. Role: Divergence Analyst. Task: Resolve divergence between [local_branch] and [remote_branch]. Context: History differs by [n] commits. Output format: Plan to synchronize with rebase/merge, including commands and safety checks.
  31. Troubleshoot submodule initialization failures — You are a Git Command Troubleshooter. Role: Submodule Expert. Task: Fix failed submodule initialization in [repository]. Context: Submodule URL [submodule_url], path [submodule_path], submodule version [version]. Output format: Commands to init/update submodules, handle authentication, and verify nested repos.
  32. Resolve 'Merge conflict during pull' workflow — You are a Git Command Troubleshooter. Role: Merge Conflict Specialist. Task: Provide a safe, repeatable workflow to resolve a pull-time merge conflict in [repository]. Context: Conflicts occur in [files]. Output format: Steps to merge, resolve, test, and commit changes; include how to configure merge strategy.
  33. Analyze 'git blame' not showing expected author — You are a Git Command Troubleshooter. Role: History Auditor. Task: Explain discrepancies in git blame output for [path]. Context: File shows author attribution different from expected [author]. Output format: Diagnosis steps, commands to verify history, and corrective actions.
  34. Debug 'git stash' application errors — You are a Git Command Troubleshooter. Role: Stash Specialist. Task: Resolve issues applying/creating a stash in [repository]. Context: Stash list includes [stash], and applying stash [stash] fails with [error]. Output format: Commands to inspect stash contents, apply with options, and preserve work.
  35. Handle 'ssh_authentication failed' while using SSH agent — You are a Git Command Troubleshooter. Role: SSH Agent Lead. Task: Fix SSH_AUTHENTICATION failures when using an agent. Context: Agent reports [agent_status], key [key]. Output format: Commands to refresh agent, add keys, and test connection.
  36. Troubleshoot Windows path length issues with Git — You are a Git Command Troubleshooter. Role: Windows Specialist. Task: Resolve path length issues on Windows for a Git repo. Context: Long paths exceed [limit] and crash operations. Output format: Commands to enable long paths, adjust core.longpaths, and verify results.
  37. Diagnose 'You have not concluded your merge' messages — You are a Git Command Troubleshooter. Role: Message Interpreter. Task: Resolve 'not concluded' merge message in [repository]. Context: Merge state appears in [branch]. Output format: Steps to finish the merge, commit, or abort safely; include checks for conflicting files.
  38. Resolve 'invalid path' characters in Windows — You are a Git Command Troubleshooter. Role: Path Compatibility Expert. Task: Address 'invalid path' errors due to invalid characters in Windows paths. Context: Affected files include [paths]. Output format: Commands to clean paths, adjust filenames, and test repository operations.
  39. Clear Git credentials cache issues — You are a Git Command Troubleshooter. Role: Credential Manager. Task: Clear and refresh Git credentials cache for a repo in [environment]. Context: Cache state [state], credentials helper [helper]. Output format: Commands to clear cache, re-authenticate, and verify access.
  40. Fix 'fatal: Authentication failed' with token — You are a Git Command Troubleshooter. Role: Token Auth Specialist. Task: Resolve token-based authentication failures for HTTPS. Context: Token [token_id] used for remote [remote]; token scopes [scopes] are required. Output format: Steps to renew token, configure cache, and verify push/pull.
  41. Troubleshoot 'git rev-parse --abbrev-ref HEAD' returns wrong results — You are a Git Command Troubleshooter. Role: Reference Resolver. Task: Correct an incorrect HEAD reference when running rev-parse. Context: Output shows [branch_name] but workspace indicates [actual_branch]. Output format: Commands to inspect HEAD, refs, and fix misalignment.
  42. Debug 'git rebase' conflicts — You are a Git Command Troubleshooter. Role: Rebase Coach. Task: Resolve conflicts arising during an interactive rebase in [repository]. Context: Conflicts occur at steps [n]. Output format: Step-by-step conflict resolution commands, rebase continuation, and verification.
  43. Resolve 'upstream has diverged' guidance — You are a Git Command Troubleshooter. Role: Divergence Advisor. Task: Provide strategy to resolve upstream divergence for [local_branch] and [upstream_branch]. Context: Divergence by [n] commits. Output format: Recommend rebase vs merge, with exact commands and checks.
  44. Clean up corrupted index file — You are a Git Command Troubleshooter. Role: Integrity Specialist. Task: Repair a corrupted index in [repository]. Context: index corruption indicated by [error]. Output format: Commands to rebuild index, re-add files, and verify repository health.
  45. Troubleshoot 'git gc' and repository health — You are a Git Command Troubleshooter. Role: Maintenance Expert. Task: Run maintenance tasks and diagnose issues from garbage collection in [repository]. Context: gc reports [log]. Output format: Safe gc commands, prune strategy, and verification steps.
  46. Verify Git hooks execution — You are a Git Command Troubleshooter. Role: Hook Validator. Task: Ensure hooks execute correctly for a repository in [path]. Context: Hook [hook_name] runs with [interpreter]. Output format: Commands to test hooks, simulate scenarios, and fix permission or path issues.
  47. Reset local repository to match remote — You are a Git Command Troubleshooter. Role: Sync Specialist. Task: Align local repository with remote state for [repository]. Context: Local HEAD differs from remote HEAD by [n] commits. Output format: Safe reset/checkout sequence, fetch steps, and verification.
  48. Restore deleted files from Git history — You are a Git Command Troubleshooter. Role: History Recovery Expert. Task: Recover deleted files in [repository]. Context: File [path] was deleted in commit [hash]. Output format: Commands to restore from history, verify restored content, and commit restoration.
  49. Resolve 'pathspec did not match any file(s)' errors — You are a Git Command Troubleshooter. Role: Path Resolver. Task: Fix pathspec errors during add/checkout actions in [repository]. Context: Path [path] does not exist in current HEAD. Output format: Commands to verify path existence, case sensitivity checks, and correct path usage.
  50. Diagnose 'fatal: merge-base' failure — You are a Git Command Troubleshooter. Role: Merge Strategy Expert. Task: Resolve a failing merge-base computation between [branchA] and [branchB]. Context: Common ancestor not found due to history rewrite. Output format: Commands to reset or align histories and re-run merge.
  51. Reproduce issue with environment variables — You are a Git Command Troubleshooter. Role: Environment Specialist. Task: Reproduce an issue by setting environment variables for a repository [repository]. Context: ENV vars include [VAR1=value1, VAR2=value2]. Output format: Steps to reproduce, expected outputs, and how to isolate environment-related factors.
  52. Confirm repository remotes configuration — You are a Git Command Troubleshooter. Role: Remote Configuration Expert. Task: Validate remote configurations for a repository. Context: Remotes include [remote1] and [remote2], fetch/push URLs [urls]. Output format: Commands to list remotes, verify URLs, and fix misconfigurations.
  53. Troubleshoot 'git fetch --all' performance — You are a Git Command Troubleshooter. Role: Performance Advisor. Task: Improve performance of git fetch --all for a large repo. Context: Repository has [n] remotes and [m] refs. Output format: Tuning steps, commands to prune stale refs, and caching strategies.
  54. Resolve 'couldn't read the password' prompts — You are a Git Command Troubleshooter. Role: Credential Manager. Task: Resolve password prompts during HTTPS operations. Context: Helper returns [helper], and prompts appear for user input. Output format: Reconfigure credentials, token-based auth, and test commands.
  55. Validate branch protection rules — You are a Git Command Troubleshooter. Role: Policy Auditor. Task: Check and validate branch protection rules for a repository. Context: Rules include [requirement] and [status]. Output format: Commands to view settings, test push restrictions, and propose safe changes.
  56. Debug 'git show' output differences — You are a Git Command Troubleshooter. Role: Show Output Analyst. Task: Compare 'git show' outputs across commits to understand differences for [path]. Context: Differences observed between commits [a] and [b]. Output format: Commands to generate consistent diff output and verify formatting.
  57. Fix 'Operation not permitted' on macOS — You are a Git Command Troubleshooter. Role: macOS Compatibility Expert. Task: Resolve 'Operation not permitted' errors on macOS for Git actions. Context: Path [path] triggers OS-level denial. Output format: System checks, permission changes, and safe git commands.
  58. Resolve conflicts with rebase -i — You are a Git Command Troubleshooter. Role: Interactive Rebase Specialist. Task: Resolve conflicts during an interactive rebase in [repository]. Context: Rebase steps include [list]. Output format: Commands to mark commits as resolved, continue rebase, and verify history integrity.
  59. Assess 'unmerged paths' counts — You are a Git Command Troubleshooter. Role: Merge Quality Analyst. Task: Assess and resolve unmerged paths after a merge in [repository]. Context: Unmerged paths count is [n]. Output format: Commands to resolve, check status, and verify clean merge.
  60. Investigate 'binary file changed' warnings — You are a Git Command Troubleshooter. Role: Binary Handling Expert. Task: Address warnings about binary file changes in [repository]. Context: Binary file [path] shows changes between [commitA] and [commitB]. Output format: Commands to verify binary diffs, configure diff tools, and handle binary merges.
  61. Restore commit from reflog — You are a Git Command Troubleshooter. Role: History Recovery Expert. Task: Restore a lost commit via reflog in [repository]. Context: Reflog shows recent entries including [hash]. Output format: Commands to reset checkout to the desired commit and verify changes.
  62. Diagnose 'hint: Waiting for your editor to close' issues — You are a Git Command Troubleshooter. Role: Editor Interaction Specialist. Task: Diagnose editor-related wait prompts during commit in [repository]. Context: Editor is set to [editor], and the issue occurs on [OS]. Output format: Commands to bypass editor, configure core.editor, and commit safely.
  63. Troubleshoot 'git mv' rename conflicts — You are a Git Command Troubleshooter. Role: Rename Conflict Expert. Task: Resolve conflicts or failures when renaming/moving files with git mv in [repository]. Context: Conflicts arise due to [path] constraints. Output format: Step-by-step commands and verification checks.
  64. Confirm Git user.name and user.email are correct — You are a Git Command Troubleshooter. Role: Identity Validator. Task: Verify and adjust user.name and user.email for a repository. Context: Current identity shows [name] <[email]>, desired identity is [desired_name] <[desired_email]. Output format: Commands to view/set config and test commits.
  65. Manage large file storage integration prompts — You are a Git Command Troubleshooter. Role: LFS Workflow Expert. Task: Manage Git LFS integration prompts in [repository]. Context: LFS pointers reference [oid] and [size], and storage provider is [provider]. Output format: Commands to configure, track, and fetch LFS content; include checks for bandwidth.
  66. Resolve 'remote: Repository not found' on GitLab — You are a Git Command Troubleshooter. Role: GitLab Integrations Specialist. Task: Fix 'remote: Repository not found' when using GitLab. Context: Repo path [path], access token [token]. Output format: Steps to verify project visibility, permissions, and correct remote URL.
  67. Analyze 'git log --graph' readability — You are a Git Command Troubleshooter. Role: Visualization Expert. Task: Improve readability of a graph in git log --graph for [repository]. Context: Output shows [complexity]. Output format: Commands to customize graph formatting, skip merges, and annotate important commits.
  68. Troubleshoot 'git cherry-pick' conflicts — You are a Git Command Troubleshooter. Role: Cherry-Pick Coach. Task: Resolve conflicts during cherry-pick in [repository]. Context: Target commit [hash] conflicts with [branch]. Output format: Step-by-step conflict resolution and validation commands.
  69. Fix 'repository is in read-only mode' errors — You are a Git Command Troubleshooter. Role: Access Control Expert. Task: Address read-only repository errors in [system]. Context: Repo state shows read-only flag or permissions issue. Output format: Commands to adjust permissions and verify changes.
  70. Reset origin to fix broken history — You are a Git Command Troubleshooter. Role: History Stabilizer. Task: Reset origin state to align with remote history in [repository]. Context: History has diverged due to [rewrite]. Output format: Safe reset steps, fetch commands, and verification checks.
  71. Troubleshoot 'git apply' patch failures — You are a Git Command Troubleshooter. Role: Patch Expert. Task: Resolve failures when applying patch files in [repository]. Context: Patch [patch_path] fails with [error]. Output format: Commands to inspect patch, test with --index, and apply cleanly.
  72. Debug 'git bisect' steps — You are a Git Command Troubleshooter. Role: Bisect Coach. Task: Run a bisect session to locate a bug in [repository]. Context: Bad commit is believed to be between [start] and [end]. Output format: Step-by-step bisect commands, how to mark good/bad, and how to finish with a fix.
  73. Address 'could not fetch refs' during clone — You are a Git Command Troubleshooter. Role: Clone Reliability Expert. Task: Resolve 'could not fetch refs' during clone operation. Context: Source is [repo_url], network is [network_type]. Output format: Commands to retry clone, verify network, and handle shallow clones.
  74. Confirm Git's default push behavior — You are a Git Command Troubleshooter. Role: Push Policy Advisor. Task: Confirm default push behavior and adjust if needed for [repository]. Context: Remote is [remote], expected behavior is [behavior]. Output format: Commands to view push.default setting and configure a consistent workflow.
  75. Resolve 'remote end disconnected' errors — You are a Git Command Troubleshooter. Role: Connectivity Specialist. Task: Fix remote end disconnects during git operations. Context: Remote is [remote], network shows [latency]. Output format: Commands to modify transport settings, increase timeout, and validate connectivity.
  76. Investigate 'packfile' errors in fetch — You are a Git Command Troubleshooter. Role: Packfile Expert. Task: Troubleshoot packfile-related errors during fetch in [repository]. Context: Error message mentions [pack_error]. Output format: Steps to verify pack files, clean cache, and re-fetch.
  77. Validate .git/config integrity — You are a Git Command Troubleshooter. Role: Config Auditor. Task: Check integrity of .git/config for a repository. Context: Configuration shows [section] with [value]. Output format: Commands to parse and repair config, and test commands.
  78. Troubleshoot 'git rev-list' performance — You are a Git Command Troubleshooter. Role: Performance Engineer. Task: Improve performance of git rev-list for large histories. Context: Repo has [n] commits; rev-list runs slow. Output format: Options to filter, use --max-count, and test performance.
  79. Handle case-sensitive filesystem issues — You are a Git Command Troubleshooter. Role: Cross-Platform Specialist. Task: Address issues caused by case-insensitive vs case-sensitive filesystems in [repository]. Context: A file named [filename] differs only by case. Output format: Steps to normalize, tests to prevent duplicates, and commands to fix case in filenames.
  80. Resolve 'fatal: write error' when creating files — You are a Git Command Troubleshooter. Role: IO Hazard Analyst. Task: Investigate 'fatal: write error' when Git creates files in [repository]. Context: Disk space [space], permissions [perm], or filesystem [fs]. Output format: Commands to check disk, quotas, and ensure safe writes.
  81. Restore from stash across branches — You are a Git Command Troubleshooter. Role: Stash Mobility Expert. Task: Apply a stash created on one branch to another branch in [repository]. Context: Stash index contains [stash], target branch is [branch]. Output format: Steps to apply stash safely, verify changes, and handle conflicts.
  82. Understand 'fatal: refusing to merge unrelated histories' — You are a Git Command Troubleshooter. Role: History Integration Specialist. Task: Explain and resolve unrelated histories when merging in [repository]. Context: Repositories [src] and [dst] have no common ancestor. Output format: Suitable strategies, commands, and test steps.
  83. Diagnose 'git shortlog' aggregation problems — You are a Git Command Troubleshooter. Role: Log Aggregation Expert. Task: Fix aggregation issues with git shortlog for [repository]. Context: Shortlog shows missing authors [authors]. Output format: Commands to verify commits, authorship, and re-run the aggregation.
  84. Verify SSH config for multiple identities — You are a Git Command Troubleshooter. Role: SSH Config Specialist. Task: Configure SSH to work with multiple identities for a repository. Context: Identities include [id1] and [id2]. Output format: Commands to configure ~/.ssh/config and test connections.
  85. Debug 'git ls-files' listing errors — You are a Git Command Troubleshooter. Role: Inventory Verifier. Task: Resolve listing errors from git ls-files in [repository]. Context: Command returns [error]. Output format: Commands to check index, path patterns, and file tracking.
  86. Resolve 'reference is not a tree' in checkout — You are a Git Command Troubleshooter. Role: Tree Integrity Expert. Task: Resolve 'reference is not a tree' during checkout in [repository]. Context: Checkout target [ref] is not a tree. Output format: Steps to inspect refs, recover from reflog, and perform a safe checkout.
  87. Clean up stale remote-tracking branches — You are a Git Command Troubleshooter. Role: Branch Hygiene Specialist. Task: Prune stale remote-tracking branches for a repository. Context: Remotes include [remote_list]. Output format: Commands to prune, fetch, and verify refs.
  88. Validate signed commits and verification — You are a Git Command Troubleshooter. Role: Security Auditor. Task: Validate GPG signed commits and verification status in [repository]. Context: Verification shows [status]. Output format: Commands to manage signing keys, enable verification, and handle unsigned commits.
  89. Resolve 'branch has no upstream branch' guidance — You are a Git Command Troubleshooter. Role: Upstream Guide. Task: Provide guidance for a branch with no upstream in [repository]. Context: Local branch [branch] lacks upstream. Output format: Commands to set upstream, fetch, and test push/pull.
  90. Troubleshoot Windows git bash path issues — You are a Git Command Troubleshooter. Role: Windows Bash Expert. Task: Resolve path and environment issues for Git Bash on Windows. Context: PATH contains [paths], and you encounter [error]. Output format: Commands to adjust PATH, run Git in a clean shell, and verify path resolution.
  91. Debug 'git show --stat' differences — You are a Git Command Troubleshooter. Role: Show Statistics Analyst. Task: Investigate inconsistencies in 'git show --stat' output for [path]. Context: Difference between commits [a] and [b] shows [diff]. Output format: Commands to reproduce, compare, and annotate file changes.
  92. Inspect 'git clean' dry-run results — You are a Git Command Troubleshooter. Role: Cleanup Planner. Task: Inspect what git clean would remove without deleting files in [repository]. Context: Dry-run output shows [files]. Output format: Commands to safely prune unused files and verify with a real run if appropriate.
  93. Resolve 'fatal: cannot modify header' in pack files — You are a Git Command Troubleshooter. Role: Packfile Safety Analyst. Task: Fix header modification errors in pack files for a repository. Context: Pack error mentions [pack_error]. Output format: Steps to verify pack integrity, recover using backup, and prevent recurrence.
  94. Audit repository permissions and access — You are a Git Command Troubleshooter. Role: Access Auditor. Task: Audit permissions and access to a repository in [organization]. Context: User roles [roles], repo [repo], access token [token]. Output format: Commands to verify ACLs, adjust access, and test with read/write permissions.
  95. Analyze 'git reflog' history accuracy — You are a Git Command Troubleshooter. Role: History Auditor. Task: Analyze reflog entries for accuracy in [repository]. Context: Reflog shows [hashes], and you suspect missing entries. Output format: Commands to compare reflog with commit history and recover references.
  96. Reconcile detached HEAD state safely — You are a Git Command Troubleshooter. Role: Branch State Expert. Task: Handle scenarios where HEAD is detached in [repository]. Context: Detached at [commit_hash]. Output format: Safe steps to reattach to a branch, test build, and verify history.
  97. Troubleshoot Git LFS pointer issues — You are a Git Command Troubleshooter. Role: LFS Troubleshooter. Task: Resolve issues with Git LFS pointers in [repository]. Context: Pointer file at [path] references [oid] and [size]. Output format: Commands to fetch LFS content, verify storage, and fix pointer metadata.
  98. Optimize 'git status --porcelain' output — You are a Git Command Troubleshooter. Role: Status Optimizer. Task: Improve readability and usefulness of porcelain output in [repository]. Context: Current status shows [state]. Output format: Commands to customize status output and filters for automation.
  99. Resolve 'merge commit was not created' anomalies — You are a Git Command Troubleshooter. Role: Merge Anomaly Specialist. Task: Resolve cases where a merge appears not to create a merge commit. Context: Expected [type] merge did not occur after [operation]. Output format: Commands to verify merge history, re-run merge, and ensure correct commit creation.
  100. Create a reproducible test case for Git issue — You are a Git Command Troubleshooter. Role: Test Engineer. Task: Create a minimal, reproducible test case for a Git issue described as [description]. Context: Repository layout [layout], commands to reproduce [reproduce_steps]. Output format: A compact test plan with a script and expected outputs to share with a team.

Markdown Template

100 Best ChatGPT Prompts for Git Command Troubleshooting

# 100 Best ChatGPT Prompts for Git Command Troubleshooting

**Diagnose the primary Git error message**: You are a Git Command Troubleshooter. Role: Senior Git Engineer. Task: Diagnose and resolve the primary error shown when executing a Git operation in a [repository]. Context: The error reported is "[error]" during a [operation] on [branch]/[remote]. Output format: Provide a concise diagnosis, a prioritized, step-by-step command plan, and code blocks for each command. Constraints: Do not modify unrelated files; include rollback options if destructive commands are necessary; ensure commands are safe for a typical workspace. Include expected outcomes after each step.
**Verify repository state before troubleshooting**: You are a Git Command Troubleshooter. Role: Senior Git Engineer. Task: Validate the current repository state before attempting fixes. Context: Repository at [path] contains [branch] and [remote] settings. Output format: List of checks in bullets with commands and exact expected results. Constraints: Use non-destructive checks first; clearly indicate if anything requires user intervention.
**Check remote URL and authentication**: You are a Git Command Troubleshooter. Role: Authentication Specialist. Task: Verify remote URL(s) and authentication method for a Git operation in [repository]. Context: Remote is set to [remote_url] and authentication uses [https|ssh]. Output format: Step-by-step commands to verify remote, test connectivity, and refresh credentials; include examples for both SSH and HTTPS. Constraints: Do not alter remote configuration unless required to fix connectivity.
**Validate branch existence and spelling**: You are a Git Command Troubleshooter. Role: Branch Expert. Task: Confirm the target branch exists and is spelled correctly for a [repository]. Context: Attempted operation targets [branch]. Output format: Commands to list branches, show remote-tracking branches, and verify name usage; include fallback commands if branch is missing. Constraints: Do not create branches unless requested.
**Inspect recent commits for issues**: You are a Git Command Troubleshooter. Role: Code History Analyst. Task: Inspect recent commits to identify potential causes of the issue. Context: Last [n] commits affecting [path] in [repository]. Output format: A compact summary of each commit and a plan to test suspected changes; include commands to view diffs for specific commits.
**Reproduce error with minimal steps**: You are a Git Command Troubleshooter. Role: Reproduction Specialist. Task: Reproduce the reported issue with a minimal, isolated setup. Context: Reproduction occurs with [minimal_repo_path] and [initial_branch]. Output format: A reproducible, minimal sequence of commands and expected outputs; include a rollback plan. Constraints: Remove extraneous files and modify only necessary components.
**Interpret Git status output accurately**: You are a Git Command Troubleshooter. Role: Status Analysis Expert. Task: Interpret a noisy git status output for a [repository]. Context: Status shows [clean|unstaged|staged] files, [untracked] files, and [ignored] patterns. Output format: A clear diagnostic, followed by precise commands to clean or stage changes; include a brief rationale.
**Resolve merge conflict guidance**: You are a Git Command Troubleshooter. Role: Merge Conflict Specialist. Task: Provide a safe, reproducible set of steps to resolve a merge conflict in [repository] on [branch]. Context: Conflict markers found in [file_path]. Output format: Step-by-step commands, with a recommended strategy (ours/theirs/merge) and post-resolve verification commands.
**Troubleshoot 'git push' authentication failures**: You are a Git Command Troubleshooter. Role: Credential Guide. Task: Resolve authentication failures during git push for [repository]. Context: Remote uses [SSH|HTTPS] and credentials are [present|expired|revoked]. Output format: Commands to verify credentials, refresh tokens/keys, and reattempt push; include fallback methods.
**Troubleshoot 'fatal: could not read from remote repository'**: You are a Git Command Troubleshooter. Role: Connectivity Expert. Task: Fix read-from-remote errors during a push/pull/fetch. Context: Remote URL is [remote_url], network may have [proxy|firewall] restrictions. Output format: Diagnostic steps, network tests, and commands to retry with explicit SSH/HTTPS settings.
**Debug 'git fetch' hang or timeout**: You are a Git Command Troubleshooter. Role: Performance Analyst. Task: Diagnose and resolve a hanging git fetch. Context: Fetch hangs after [seconds], from remote [remote]. Output format: Time-bounded tests, commands to optimize network, and a safe fallback strategy to proceed with partial data.
**Resolve 'Permission denied (publickey)' during SSH**: You are a Git Command Troubleshooter. Role: SSH Expert. Task: Fix SSH public key authentication failures for [repository]. Context: SSH key [key_id] is configured; agent shows [agent_status]. Output format: Steps to add key to ssh-agent, verify agent, and test connection with ssh -T; include a secure command sequence.
**Troubleshoot 'fatal: ref not found' errors**: You are a Git Command Troubleshooter. Role: Reference Resolver. Task: Resolve 'ref not found' when referencing [ref_type] in [repository]. Context: Command attempted was [command]. Output format: Commands to list refs, verify fetch/pull targets, and fix ref syntax.
**Verify SSH key setup and agent forwarding**: You are a Git Command Troubleshooter. Role: SSH Agent Specialist. Task: Verify SSH keys and agent forwarding for a remote repository. Context: Access uses [ssh_host], agent state [agent_status], and key [key_type]. Output format: Commands to confirm keys, agent, and test SSH connection.
**Diagnose 'Everything up-to-date' but nothing pushed**: You are a Git Command Troubleshooter. Role: State Auditor. Task: Explain why an attempted push reports 'Everything up-to-date'. Context: Local branch [branch] tracks [remote/branch], and [remote] shows latest commit [hash]. Output format: Diagnostic reasoning, and commands to force-check history and remote status.
**Analyze 'git diff' shows unexpected changes**: You are a Git Command Troubleshooter. Role: Diff Analyst. Task: Investigate unexpected diffs between working tree and index. Context: Diff shows changes in [path]. Output format: Commands to inspect staging area, file contents, and revert or commit if necessary.
**Confirm remote tracking configuration**: You are a Git Command Troubleshooter. Role: Remote Tracker. Task: Validate the remote-tracking configuration for a given repository. Context: Remote is [remote], local branch [branch] tracks [branch@{remote}]. Output format: Commands to list remotes, show branch configs, and correct tracking if needed.
**Troubleshoot 'no such file or directory' in Git hooks**: You are a Git Command Troubleshooter. Role: Hook Troubleshooter. Task: Diagnose a 'no such file or directory' error coming from a pre-commit/post-commit hook. Context: Hook script path is [hook_path], interpreter [shell]. Output format: Commands to verify hook paths, permissions, and how to bypass for testing.
**Resolve 'remote end hung up unexpectedly'**: You are a Git Command Troubleshooter. Role: Connection Specialist. Task: Resolve abrupt remote termination during push/pull. Context: Remote is [remote], operation [operation], and network shows [latency|packet_loss]. Output format: Steps to reconfigure transport, increase timeout, and verify remote health.
**Debug 'git reset --hard' losing work**: You are a Git Command Troubleshooter. Role: Safety Advisor. Task: Safely diagnose a scenario where 'git reset --hard' may have lost work. Context: Worktree contains [uncommitted_changes], and you want to recover with [reflog] or [stash]. Output format: Recovery steps, commands to restore files, and preventive measures.
**Resolve 'index.lock' lock file issues**: You are a Git Command Troubleshooter. Role: Lockfile Expert. Task: Resolve a lingering index.lock during an operation in [repository]. Context: Other process may hold lock; PID [pid] visible. Output format: Safe steps to remove lock and retry the operation; include a check that repository integrity is intact.
**Troubleshoot 'Could not resolve host' DNS**: You are a Git Command Troubleshooter. Role: Network Resolver. Task: Fix DNS resolution failures when contacting a Git remote. Context: Remote URL host [host] cannot be resolved; environment is [OS]. Output format: Network diagnostics and commands to bypass DNS via /etc/hosts, and verify proper DNS config.
**Check Git config core.autocrlf and line endings**: You are a Git Command Troubleshooter. Role: Config Specialist. Task: Review and adjust core.autocrlf and line ending handling for a cross-platform repo. Context: Team uses [OS] systems with [text] files. Output format: Commands to view config, recommended values, and test with sample files.
**Fix 'fatal: Authentication failed' during HTTPS**: You are a Git Command Troubleshooter. Role: HTTPS Auth Specialist. Task: Resolve HTTPS authentication failures for a repository. Context: Token/password or credential helper state [state], remote is [https_url]. Output format: Steps to refresh credentials, configure token scopes, and verify push/pull works.
**Troubleshoot Git LFS failures**: You are a Git Command Troubleshooter. Role: LFS Specialist. Task: Troubleshoot Git LFS pointer issues in [repository]. Context: LFS pointer file [path] points to [oid], and lfs fetch/fetch --all fails. Output format: Commands to verify LFS install, track patterns, and fetch binaries.
**Resolve 'repository not found' errors on GitHub**: You are a Git Command Troubleshooter. Role: GitHub Integrations Expert. Task: Resolve 'repository not found' when interacting with GitHub. Context: Repo slug [repo], user/token permissions [perm]. Output format: Checks for repository visibility, permission, and correct remote URL, with corrective commands.
**Diagnose 'branch is behind' and rebase strategy**: You are a Git Command Troubleshooter. Role: Branch Strategy Advisor. Task: Address 'branch is behind' by proposing a safe rebase or merge approach. Context: Local [branch] tracks [remote/branch] and is behind by [n] commits. Output format: Recommended strategy, commands to update, and verification steps.
**Validate GPG signatures and verification**: You are a Git Command Troubleshooter. Role: Security Auditor. Task: Validate GPG-signed commits and verification status in [repository]. Context: Verification shows [status]. Output format: Commands to configure GPG, verify signatures, and handle unsigned commits.
**Fix 'fatal: bad object' corrupted repo**: You are a Git Command Troubleshooter. Role: Corruption Specialist. Task: Repair a corrupted repository in [path]. Context: Corruption indicated by [error]. Output format: Steps to verify integrity, recover from backup or reflog, and prevent recurrence.
**Investigate 'diverged' branches**: You are a Git Command Troubleshooter. Role: Divergence Analyst. Task: Resolve divergence between [local_branch] and [remote_branch]. Context: History differs by [n] commits. Output format: Plan to synchronize with rebase/merge, including commands and safety checks.
**Troubleshoot submodule initialization failures**: You are a Git Command Troubleshooter. Role: Submodule Expert. Task: Fix failed submodule initialization in [repository]. Context: Submodule URL [submodule_url], path [submodule_path], submodule version [version]. Output format: Commands to init/update submodules, handle authentication, and verify nested repos.
**Resolve 'Merge conflict during pull' workflow**: You are a Git Command Troubleshooter. Role: Merge Conflict Specialist. Task: Provide a safe, repeatable workflow to resolve a pull-time merge conflict in [repository]. Context: Conflicts occur in [files]. Output format: Steps to merge, resolve, test, and commit changes; include how to configure merge strategy.
**Analyze 'git blame' not showing expected author**: You are a Git Command Troubleshooter. Role: History Auditor. Task: Explain discrepancies in git blame output for [path]. Context: File shows author attribution different from expected [author]. Output format: Diagnosis steps, commands to verify history, and corrective actions.
**Debug 'git stash' application errors**: You are a Git Command Troubleshooter. Role: Stash Specialist. Task: Resolve issues applying/creating a stash in [repository]. Context: Stash list includes [stash], and applying stash [stash] fails with [error]. Output format: Commands to inspect stash contents, apply with options, and preserve work.
**Handle 'ssh_authentication failed' while using SSH agent**: You are a Git Command Troubleshooter. Role: SSH Agent Lead. Task: Fix SSH_AUTHENTICATION failures when using an agent. Context: Agent reports [agent_status], key [key]. Output format: Commands to refresh agent, add keys, and test connection.
**Troubleshoot Windows path length issues with Git**: You are a Git Command Troubleshooter. Role: Windows Specialist. Task: Resolve path length issues on Windows for a Git repo. Context: Long paths exceed [limit] and crash operations. Output format: Commands to enable long paths, adjust core.longpaths, and verify results.
**Diagnose 'You have not concluded your merge' messages**: You are a Git Command Troubleshooter. Role: Message Interpreter. Task: Resolve 'not concluded' merge message in [repository]. Context: Merge state appears in [branch]. Output format: Steps to finish the merge, commit, or abort safely; include checks for conflicting files.
**Resolve 'invalid path' characters in Windows**: You are a Git Command Troubleshooter. Role: Path Compatibility Expert. Task: Address 'invalid path' errors due to invalid characters in Windows paths. Context: Affected files include [paths]. Output format: Commands to clean paths, adjust filenames, and test repository operations.
**Clear Git credentials cache issues**: You are a Git Command Troubleshooter. Role: Credential Manager. Task: Clear and refresh Git credentials cache for a repo in [environment]. Context: Cache state [state], credentials helper [helper]. Output format: Commands to clear cache, re-authenticate, and verify access.
**Fix 'fatal: Authentication failed' with token**: You are a Git Command Troubleshooter. Role: Token Auth Specialist. Task: Resolve token-based authentication failures for HTTPS. Context: Token [token_id] used for remote [remote]; token scopes [scopes] are required. Output format: Steps to renew token, configure cache, and verify push/pull.
**Troubleshoot 'git rev-parse --abbrev-ref HEAD' returns wrong results**: You are a Git Command Troubleshooter. Role: Reference Resolver. Task: Correct an incorrect HEAD reference when running rev-parse. Context: Output shows [branch_name] but workspace indicates [actual_branch]. Output format: Commands to inspect HEAD, refs, and fix misalignment.
**Debug 'git rebase' conflicts**: You are a Git Command Troubleshooter. Role: Rebase Coach. Task: Resolve conflicts arising during an interactive rebase in [repository]. Context: Conflicts occur at steps [n]. Output format: Step-by-step conflict resolution commands, rebase continuation, and verification.
**Resolve 'upstream has diverged' guidance**: You are a Git Command Troubleshooter. Role: Divergence Advisor. Task: Provide strategy to resolve upstream divergence for [local_branch] and [upstream_branch]. Context: Divergence by [n] commits. Output format: Recommend rebase vs merge, with exact commands and checks.
**Clean up corrupted index file**: You are a Git Command Troubleshooter. Role: Integrity Specialist. Task: Repair a corrupted index in [repository]. Context: index corruption indicated by [error]. Output format: Commands to rebuild index, re-add files, and verify repository health.
**Troubleshoot 'git gc' and repository health**: You are a Git Command Troubleshooter. Role: Maintenance Expert. Task: Run maintenance tasks and diagnose issues from garbage collection in [repository]. Context: gc reports [log]. Output format: Safe gc commands, prune strategy, and verification steps.
**Verify Git hooks execution**: You are a Git Command Troubleshooter. Role: Hook Validator. Task: Ensure hooks execute correctly for a repository in [path]. Context: Hook [hook_name] runs with [interpreter]. Output format: Commands to test hooks, simulate scenarios, and fix permission or path issues.
**Reset local repository to match remote**: You are a Git Command Troubleshooter. Role: Sync Specialist. Task: Align local repository with remote state for [repository]. Context: Local HEAD differs from remote HEAD by [n] commits. Output format: Safe reset/checkout sequence, fetch steps, and verification.
**Restore deleted files from Git history**: You are a Git Command Troubleshooter. Role: History Recovery Expert. Task: Recover deleted files in [repository]. Context: File [path] was deleted in commit [hash]. Output format: Commands to restore from history, verify restored content, and commit restoration.
**Resolve 'pathspec did not match any file(s)' errors**: You are a Git Command Troubleshooter. Role: Path Resolver. Task: Fix pathspec errors during add/checkout actions in [repository]. Context: Path [path] does not exist in current HEAD. Output format: Commands to verify path existence, case sensitivity checks, and correct path usage.
**Diagnose 'fatal: merge-base' failure**: You are a Git Command Troubleshooter. Role: Merge Strategy Expert. Task: Resolve a failing merge-base computation between [branchA] and [branchB]. Context: Common ancestor not found due to history rewrite. Output format: Commands to reset or align histories and re-run merge.
**Reproduce issue with environment variables**: You are a Git Command Troubleshooter. Role: Environment Specialist. Task: Reproduce an issue by setting environment variables for a repository [repository]. Context: ENV vars include [VAR1=value1, VAR2=value2]. Output format: Steps to reproduce, expected outputs, and how to isolate environment-related factors.
**Confirm repository remotes configuration**: You are a Git Command Troubleshooter. Role: Remote Configuration Expert. Task: Validate remote configurations for a repository. Context: Remotes include [remote1] and [remote2], fetch/push URLs [urls]. Output format: Commands to list remotes, verify URLs, and fix misconfigurations.
**Troubleshoot 'git fetch --all' performance**: You are a Git Command Troubleshooter. Role: Performance Advisor. Task: Improve performance of git fetch --all for a large repo. Context: Repository has [n] remotes and [m] refs. Output format: Tuning steps, commands to prune stale refs, and caching strategies.
**Resolve 'couldn't read the password' prompts**: You are a Git Command Troubleshooter. Role: Credential Manager. Task: Resolve password prompts during HTTPS operations. Context: Helper returns [helper], and prompts appear for user input. Output format: Reconfigure credentials, token-based auth, and test commands.
**Validate branch protection rules**: You are a Git Command Troubleshooter. Role: Policy Auditor. Task: Check and validate branch protection rules for a repository. Context: Rules include [requirement] and [status]. Output format: Commands to view settings, test push restrictions, and propose safe changes.
**Debug 'git show' output differences**: You are a Git Command Troubleshooter. Role: Show Output Analyst. Task: Compare 'git show' outputs across commits to understand differences for [path]. Context: Differences observed between commits [a] and [b]. Output format: Commands to generate consistent diff output and verify formatting.
**Fix 'Operation not permitted' on macOS**: You are a Git Command Troubleshooter. Role: macOS Compatibility Expert. Task: Resolve 'Operation not permitted' errors on macOS for Git actions. Context: Path [path] triggers OS-level denial. Output format: System checks, permission changes, and safe git commands.
**Resolve conflicts with rebase -i**: You are a Git Command Troubleshooter. Role: Interactive Rebase Specialist. Task: Resolve conflicts during an interactive rebase in [repository]. Context: Rebase steps include [list]. Output format: Commands to mark commits as resolved, continue rebase, and verify history integrity.
**Assess 'unmerged paths' counts**: You are a Git Command Troubleshooter. Role: Merge Quality Analyst. Task: Assess and resolve unmerged paths after a merge in [repository]. Context: Unmerged paths count is [n]. Output format: Commands to resolve, check status, and verify clean merge.
**Investigate 'binary file changed' warnings**: You are a Git Command Troubleshooter. Role: Binary Handling Expert. Task: Address warnings about binary file changes in [repository]. Context: Binary file [path] shows changes between [commitA] and [commitB]. Output format: Commands to verify binary diffs, configure diff tools, and handle binary merges.
**Restore commit from reflog**: You are a Git Command Troubleshooter. Role: History Recovery Expert. Task: Restore a lost commit via reflog in [repository]. Context: Reflog shows recent entries including [hash]. Output format: Commands to reset checkout to the desired commit and verify changes.
**Diagnose 'hint: Waiting for your editor to close' issues**: You are a Git Command Troubleshooter. Role: Editor Interaction Specialist. Task: Diagnose editor-related wait prompts during commit in [repository]. Context: Editor is set to [editor], and the issue occurs on [OS]. Output format: Commands to bypass editor, configure core.editor, and commit safely.
**Troubleshoot 'git mv' rename conflicts**: You are a Git Command Troubleshooter. Role: Rename Conflict Expert. Task: Resolve conflicts or failures when renaming/moving files with git mv in [repository]. Context: Conflicts arise due to [path] constraints. Output format: Step-by-step commands and verification checks.
**Confirm Git user.name and user.email are correct**: You are a Git Command Troubleshooter. Role: Identity Validator. Task: Verify and adjust user.name and user.email for a repository. Context: Current identity shows [name] <[email]>, desired identity is [desired_name] <[desired_email]. Output format: Commands to view/set config and test commits.
**Manage large file storage integration prompts**: You are a Git Command Troubleshooter. Role: LFS Workflow Expert. Task: Manage Git LFS integration prompts in [repository]. Context: LFS pointers reference [oid] and [size], and storage provider is [provider]. Output format: Commands to configure, track, and fetch LFS content; include checks for bandwidth.
**Resolve 'remote: Repository not found' on GitLab**: You are a Git Command Troubleshooter. Role: GitLab Integrations Specialist. Task: Fix 'remote: Repository not found' when using GitLab. Context: Repo path [path], access token [token]. Output format: Steps to verify project visibility, permissions, and correct remote URL.
**Analyze 'git log --graph' readability**: You are a Git Command Troubleshooter. Role: Visualization Expert. Task: Improve readability of a graph in git log --graph for [repository]. Context: Output shows [complexity]. Output format: Commands to customize graph formatting, skip merges, and annotate important commits.
**Troubleshoot 'git cherry-pick' conflicts**: You are a Git Command Troubleshooter. Role: Cherry-Pick Coach. Task: Resolve conflicts during cherry-pick in [repository]. Context: Target commit [hash] conflicts with [branch]. Output format: Step-by-step conflict resolution and validation commands.
**Fix 'repository is in read-only mode' errors**: You are a Git Command Troubleshooter. Role: Access Control Expert. Task: Address read-only repository errors in [system]. Context: Repo state shows read-only flag or permissions issue. Output format: Commands to adjust permissions and verify changes.
**Reset origin to fix broken history**: You are a Git Command Troubleshooter. Role: History Stabilizer. Task: Reset origin state to align with remote history in [repository]. Context: History has diverged due to [rewrite]. Output format: Safe reset steps, fetch commands, and verification checks.
**Troubleshoot 'git apply' patch failures**: You are a Git Command Troubleshooter. Role: Patch Expert. Task: Resolve failures when applying patch files in [repository]. Context: Patch [patch_path] fails with [error]. Output format: Commands to inspect patch, test with --index, and apply cleanly.
**Debug 'git bisect' steps**: You are a Git Command Troubleshooter. Role: Bisect Coach. Task: Run a bisect session to locate a bug in [repository]. Context: Bad commit is believed to be between [start] and [end]. Output format: Step-by-step bisect commands, how to mark good/bad, and how to finish with a fix.
**Address 'could not fetch refs' during clone**: You are a Git Command Troubleshooter. Role: Clone Reliability Expert. Task: Resolve 'could not fetch refs' during clone operation. Context: Source is [repo_url], network is [network_type]. Output format: Commands to retry clone, verify network, and handle shallow clones.
**Confirm Git's default push behavior**: You are a Git Command Troubleshooter. Role: Push Policy Advisor. Task: Confirm default push behavior and adjust if needed for [repository]. Context: Remote is [remote], expected behavior is [behavior]. Output format: Commands to view push.default setting and configure a consistent workflow.
**Resolve 'remote end disconnected' errors**: You are a Git Command Troubleshooter. Role: Connectivity Specialist. Task: Fix remote end disconnects during git operations. Context: Remote is [remote], network shows [latency]. Output format: Commands to modify transport settings, increase timeout, and validate connectivity.
**Investigate 'packfile' errors in fetch**: You are a Git Command Troubleshooter. Role: Packfile Expert. Task: Troubleshoot packfile-related errors during fetch in [repository]. Context: Error message mentions [pack_error]. Output format: Steps to verify pack files, clean cache, and re-fetch.
**Validate .git/config integrity**: You are a Git Command Troubleshooter. Role: Config Auditor. Task: Check integrity of .git/config for a repository. Context: Configuration shows [section] with [value]. Output format: Commands to parse and repair config, and test commands.
**Troubleshoot 'git rev-list' performance**: You are a Git Command Troubleshooter. Role: Performance Engineer. Task: Improve performance of git rev-list for large histories. Context: Repo has [n] commits; rev-list runs slow. Output format: Options to filter, use --max-count, and test performance.
**Handle case-sensitive filesystem issues**: You are a Git Command Troubleshooter. Role: Cross-Platform Specialist. Task: Address issues caused by case-insensitive vs case-sensitive filesystems in [repository]. Context: A file named [filename] differs only by case. Output format: Steps to normalize, tests to prevent duplicates, and commands to fix case in filenames.
**Resolve 'fatal: write error' when creating files**: You are a Git Command Troubleshooter. Role: IO Hazard Analyst. Task: Investigate 'fatal: write error' when Git creates files in [repository]. Context: Disk space [space], permissions [perm], or filesystem [fs]. Output format: Commands to check disk, quotas, and ensure safe writes.
**Restore from stash across branches**: You are a Git Command Troubleshooter. Role: Stash Mobility Expert. Task: Apply a stash created on one branch to another branch in [repository]. Context: Stash index contains [stash], target branch is [branch]. Output format: Steps to apply stash safely, verify changes, and handle conflicts.
**Understand 'fatal: refusing to merge unrelated histories'**: You are a Git Command Troubleshooter. Role: History Integration Specialist. Task: Explain and resolve unrelated histories when merging in [repository]. Context: Repositories [src] and [dst] have no common ancestor. Output format: Suitable strategies, commands, and test steps.
**Diagnose 'git shortlog' aggregation problems**: You are a Git Command Troubleshooter. Role: Log Aggregation Expert. Task: Fix aggregation issues with git shortlog for [repository]. Context: Shortlog shows missing authors [authors]. Output format: Commands to verify commits, authorship, and re-run the aggregation.
**Verify SSH config for multiple identities**: You are a Git Command Troubleshooter. Role: SSH Config Specialist. Task: Configure SSH to work with multiple identities for a repository. Context: Identities include [id1] and [id2]. Output format: Commands to configure ~/.ssh/config and test connections.
**Debug 'git ls-files' listing errors**: You are a Git Command Troubleshooter. Role: Inventory Verifier. Task: Resolve listing errors from git ls-files in [repository]. Context: Command returns [error]. Output format: Commands to check index, path patterns, and file tracking.
**Resolve 'reference is not a tree' in checkout**: You are a Git Command Troubleshooter. Role: Tree Integrity Expert. Task: Resolve 'reference is not a tree' during checkout in [repository]. Context: Checkout target [ref] is not a tree. Output format: Steps to inspect refs, recover from reflog, and perform a safe checkout.
**Clean up stale remote-tracking branches**: You are a Git Command Troubleshooter. Role: Branch Hygiene Specialist. Task: Prune stale remote-tracking branches for a repository. Context: Remotes include [remote_list]. Output format: Commands to prune, fetch, and verify refs.
**Validate signed commits and verification**: You are a Git Command Troubleshooter. Role: Security Auditor. Task: Validate GPG signed commits and verification status in [repository]. Context: Verification shows [status]. Output format: Commands to manage signing keys, enable verification, and handle unsigned commits.
**Resolve 'branch has no upstream branch' guidance**: You are a Git Command Troubleshooter. Role: Upstream Guide. Task: Provide guidance for a branch with no upstream in [repository]. Context: Local branch [branch] lacks upstream. Output format: Commands to set upstream, fetch, and test push/pull.
**Troubleshoot Windows git bash path issues**: You are a Git Command Troubleshooter. Role: Windows Bash Expert. Task: Resolve path and environment issues for Git Bash on Windows. Context: PATH contains [paths], and you encounter [error]. Output format: Commands to adjust PATH, run Git in a clean shell, and verify path resolution.
**Debug 'git show --stat' differences**: You are a Git Command Troubleshooter. Role: Show Statistics Analyst. Task: Investigate inconsistencies in 'git show --stat' output for [path]. Context: Difference between commits [a] and [b] shows [diff]. Output format: Commands to reproduce, compare, and annotate file changes.
**Inspect 'git clean' dry-run results**: You are a Git Command Troubleshooter. Role: Cleanup Planner. Task: Inspect what git clean would remove without deleting files in [repository]. Context: Dry-run output shows [files]. Output format: Commands to safely prune unused files and verify with a real run if appropriate.
**Resolve 'fatal: cannot modify header' in pack files**: You are a Git Command Troubleshooter. Role: Packfile Safety Analyst. Task: Fix header modification errors in pack files for a repository. Context: Pack error mentions [pack_error]. Output format: Steps to verify pack integrity, recover using backup, and prevent recurrence.
**Audit repository permissions and access**: You are a Git Command Troubleshooter. Role: Access Auditor. Task: Audit permissions and access to a repository in [organization]. Context: User roles [roles], repo [repo], access token [token]. Output format: Commands to verify ACLs, adjust access, and test with read/write permissions.
**Analyze 'git reflog' history accuracy**: You are a Git Command Troubleshooter. Role: History Auditor. Task: Analyze reflog entries for accuracy in [repository]. Context: Reflog shows [hashes], and you suspect missing entries. Output format: Commands to compare reflog with commit history and recover references.
**Reconcile detached HEAD state safely**: You are a Git Command Troubleshooter. Role: Branch State Expert. Task: Handle scenarios where HEAD is detached in [repository]. Context: Detached at [commit_hash]. Output format: Safe steps to reattach to a branch, test build, and verify history.
**Troubleshoot Git LFS pointer issues**: You are a Git Command Troubleshooter. Role: LFS Troubleshooter. Task: Resolve issues with Git LFS pointers in [repository]. Context: Pointer file at [path] references [oid] and [size]. Output format: Commands to fetch LFS content, verify storage, and fix pointer metadata.
**Optimize 'git status --porcelain' output**: You are a Git Command Troubleshooter. Role: Status Optimizer. Task: Improve readability and usefulness of porcelain output in [repository]. Context: Current status shows [state]. Output format: Commands to customize status output and filters for automation.
**Resolve 'merge commit was not created' anomalies**: You are a Git Command Troubleshooter. Role: Merge Anomaly Specialist. Task: Resolve cases where a merge appears not to create a merge commit. Context: Expected [type] merge did not occur after [operation]. Output format: Commands to verify merge history, re-run merge, and ensure correct commit creation.
**Create a reproducible test case for Git issue**: You are a Git Command Troubleshooter. Role: Test Engineer. Task: Create a minimal, reproducible test case for a Git issue described as [description]. Context: Repository layout [layout], commands to reproduce [reproduce_steps]. Output format: A compact test plan with a script and expected outputs to share with a team.

Best Practices

Leverage these prompts to build repeatable troubleshooting playbooks. Always replace placeholders with concrete values, validate outputs, and share clear, auditable steps. Emphasize safety and non-destructive methods where possible.

Common Mistakes to Avoid

Avoid vague prompts, missing placeholders, and commands that could cause data loss without explicit user consent. Do not assume repository state; always verify before executing destructive steps.

FAQ

Question

What are these prompts for?

Question

Do I need to fill in all placeholders?

Question

Can I use these prompts with any Git hosting service?

Question

How should I verify the outputs?

Question

Are the prompts safe for beginners?