Tutorials
Push Changes
Learn how to push your changes to GitHub
Push Changes
Pushing uploads your local commits to your GitHub repository.
What is Pushing?
Pushing sends your local commits to the remote repository (GitHub) so others can see your changes.
Step-by-Step Guide
Step 1: Verify Your Commits
# Check your commits
git log --oneline
# Make sure you're on the right branch
git branchStep 2: Push to GitHub
# Push your branch
git push origin your-branch-name
# Example:
git push origin feature/add-dark-modeFirst Time Pushing a New Branch
# Set upstream and push
git push -u origin your-branch-name
# After this, you can just use:
git pushWhat Happens When You Push?
- Git uploads your commits to GitHub
- Your branch appears on GitHub
- You can now create a pull request
- Others can see and review your changes
Common Scenarios
Scenario 1: First Push
git push -u origin feature/my-feature
# Output:
# Enumerating objects: 5, done.
# Counting objects: 100% (5/5), done.
# Writing objects: 100% (3/3), 300 bytes | 300.00 KiB/s, done.
# Total 3 (delta 0), reused 0 (delta 0)
# To https://github.com/username/repo.git
# * [new branch] feature/my-feature -> feature/my-featureScenario 2: Subsequent Pushes
# After setting upstream
git push
# Output:
# Everything up-to-dateScenario 3: Push After New Commits
# Make more changes
git add .
git commit -m "Add: More improvements"
git pushTroubleshooting
Error: "Updates were rejected"
# Someone else pushed changes
# Pull the latest changes first
git pull origin your-branch-name
# Then push again
git pushError: "No upstream branch"
# Set upstream and push
git push -u origin your-branch-nameError: "Permission denied"
Check:
- Are you pushing to your fork (not the original repo)?
- Is your GitHub authentication set up correctly?
- Do you have write access to the repository?
Verify on GitHub
After pushing:
- Go to your repository on GitHub
- You should see a banner: "your-branch-name had recent pushes"
- Click "Compare & pull request"
Next Steps
Your changes are now on GitHub! Ready to create a pull request. 🚀