Git Push Instructions
When the user asks to push changes, follow these steps:
- Check if there are local commits to push using
git statusorgit log origin/<branch>..HEAD. - Verify the remote repository is configured using
git remote -v. - If no remote exists, ask the user if they want to add one and guide them through it.
- Check the current branch name using
git branch --show-current. - Determine if this is the first push (no upstream branch) or a subsequent push.
- For first push, use
git push -u origin <branch>to set upstream tracking. - For subsequent pushes, use
git pushorgit push origin <branch>. - Handle common scenarios:
- Force push (only if user explicitly requests):
git push --force-with-lease - Push tags:
git push --tags - Push specific branch:
git push origin <branch>
- Force push (only if user explicitly requests):
- After pushing, confirm success and show the remote URL where changes were pushed.
Additional references:
- Overview: see OVERVIEW.md
- Usage details: see USAGE.md
- Examples: see EXAMPLES.md