ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.3 months ago (distributed domain, exempt) |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://github.com/git-guides/git-push |
| Last Crawled | 2026-04-08 03:15:51 (9 days ago) |
| First Indexed | 2020-05-28 20:05:11 (5 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Git Guides - git push · GitHub |
| Meta Description | GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects. |
| Meta Canonical | null |
| Boilerpipe Text | git push
git push
uploads all local branch commits to the corresponding remote branch.
What Does
git push
Do?
git push
updates the remote branch with local commits. It is one of the four commands in Git that prompts interaction with the remote repository. You can also think of
git push
as
update
or
publish
.
By default,
git push
only updates the corresponding branch on the remote. So, if you are checked out to the
main
branch when you execute
git push
, then only the
main
branch will be updated. It's always a good idea to use
git status
to see what branch you are on before pushing to the remote.
How to Use
git push
After you make and commit changes locally, you can share them with the remote repository using
git push
. Pushing changes to the remote makes your commits accessible to others who you may be collaborating with. This will also update any open pull requests with the branch that you're working on.
As best practice, it's important to run the
git pull
command before you push any new changes to the remote branch. This will update your local branch with any new changes that may have been pushed to the remote from other contributors. Pulling before you push can reduce the amount of merge conflicts you create on GitHub – allowing you to resolve them locally before pushing your changes to the remote branch.
Common usages and options for
git push
git push -f
: Force a push that would otherwise be blocked, usually because it will delete or overwrite existing commits
(Use with caution!)
git push -u origin [branch]
: Useful when pushing a new branch, this creates an upstream tracking branch with a lasting relationship to your local branch
git push --all
: Push all branches
git push --tags
: Publish tags that aren't yet in the remote repository
You can see all of the options with
git push
in
git-scm's documentation
.
Why can't I push?
If you are trying to
git push
but are running into problems, there are a few common solutions.
Check your branch
Check what branch you are currently on with
git status
. If you are working on a protected branch, like
main
, you may be unable to push commits directly to the remote. If this happens to you, it's OK! You can fix this a few ways.
Work was not yet on any branch
Create and checkout to a new branch from your current commit:
git checkout -b [branchname]
Then, push the new branch up to the remote:
git push -u origin [branchname]
Accidentally committed to the wrong branch
Checkout to the branch that you intended to commit to:
git checkout [branchname]
Merge the commits from the branch that you
did
accidentally commit to:
git merge [main]
Push your changes to the remote:
git push
Fix the other branch by checking out to that branch, finding what commit it
should
be pointed to, and using
git reset --hard
to correct the branch pointer
Related Terms
git commit -m "descriptive message"
: Records file snapshots permanently in version history.
git clone [url]
: Clone (download) a repository that already exists on GitHub, including all of the files, branches, and commits.
git status
: Always a good idea, this command shows you what branch you're on, what files are in the working or staging directory, and any other important information.
git pull
: Updates your current local working branch with all new commits from the corresponding remote branch on GitHub.
git pull
is a combination of
git fetch
and
git merge
.
Contribute to this article
on GitHub.
Get started with git and GitHub
Review code, manage projects, and build software alongside 40 million developers.
Sign up for GitHub
Sign in |
| Markdown | [Skip to content](https://github.com/git-guides/git-push#start-of-content)
## Navigation Menu
Toggle navigation
[Sign in](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgit-guides%2Fgit-push)
- Platform
- AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub SparkBuild and deploy intelligent apps](https://github.com/features/spark)
- [GitHub ModelsManage and compare prompts](https://github.com/features/models)
- [MCP RegistryNewIntegrate external tools](https://github.com/mcp)
- DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev environments](https://github.com/features/codespaces)
- [IssuesPlan and track work](https://github.com/features/issues)
- [Code ReviewManage code changes](https://github.com/features/code-review)
- APPLICATION SECURITY
- [GitHub Advanced SecurityFind and fix vulnerabilities](https://github.com/security/advanced-security)
- [Code securitySecure your code as you build](https://github.com/security/advanced-security/code-security)
- [Secret protectionStop leaks before they start](https://github.com/security/advanced-security/secret-protection)
- EXPLORE
- [Why GitHub](https://github.com/why-github)
- [Documentation](https://docs.github.com/)
- [Blog](https://github.blog/)
- [Changelog](https://github.blog/changelog)
- [Marketplace](https://github.com/marketplace)
[View all features](https://github.com/features)
- Solutions
- BY COMPANY SIZE
- [Enterprises](https://github.com/enterprise)
- [Small and medium teams](https://github.com/team)
- [Startups](https://github.com/enterprise/startups)
- [Nonprofits](https://github.com/solutions/industry/nonprofits)
- BY USE CASE
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
- [DevSecOps](https://github.com/solutions/use-case/devsecops)
- [DevOps](https://github.com/solutions/use-case/devops)
- [CI/CD](https://github.com/solutions/use-case/ci-cd)
- [View all use cases](https://github.com/solutions/use-case)
- BY INDUSTRY
- [Healthcare](https://github.com/solutions/industry/healthcare)
- [Financial services](https://github.com/solutions/industry/financial-services)
- [Manufacturing](https://github.com/solutions/industry/manufacturing)
- [Government](https://github.com/solutions/industry/government)
- [View all industries](https://github.com/solutions/industry)
[View all solutions](https://github.com/solutions)
- Resources
- EXPLORE BY TOPIC
- [AI](https://github.com/resources/articles?topic=ai)
- [Software Development](https://github.com/resources/articles?topic=software-development)
- [DevOps](https://github.com/resources/articles?topic=devops)
- [Security](https://github.com/resources/articles?topic=security)
- [View all topics](https://github.com/resources/articles)
- EXPLORE BY TYPE
- [Customer stories](https://github.com/customer-stories)
- [Events & webinars](https://github.com/resources/events)
- [Ebooks & reports](https://github.com/resources/whitepapers)
- [Business insights](https://github.com/solutions/executive-insights)
- [GitHub Skills](https://skills.github.com/)
- SUPPORT & SERVICES
- [Documentation](https://docs.github.com/)
- [Customer support](https://support.github.com/)
- [Community forum](https://github.com/orgs/community/discussions)
- [Trust center](https://github.com/trust-center)
- [Partners](https://github.com/partners)
[View all resources](https://github.com/resources)
- Open Source
- COMMUNITY
- [GitHub SponsorsFund open source developers](https://github.com/sponsors)
- PROGRAMS
- [Security Lab](https://securitylab.github.com/)
- [Maintainer Community](https://maintainers.github.com/)
- [Accelerator](https://github.com/accelerator)
- [GitHub Stars](https://stars.github.com/)
- [Archive Program](https://archiveprogram.github.com/)
- REPOSITORIES
- [Topics](https://github.com/topics)
- [Trending](https://github.com/trending)
- [Collections](https://github.com/collections)
- Enterprise
- ENTERPRISE SOLUTIONS
- [Enterprise platformAI-powered developer platform](https://github.com/enterprise)
- AVAILABLE ADD-ONS
- [GitHub Advanced SecurityEnterprise-grade security features](https://github.com/security/advanced-security)
- [Copilot for BusinessEnterprise-grade AI features](https://github.com/features/copilot/copilot-business)
- [Premium SupportEnterprise-grade 24/7 support](https://github.com/premium-support)
- [Pricing](https://github.com/pricing)
Search or jump to...
# Search code, repositories, users, issues, pull requests...
[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)
# Provide feedback
Cancel
Submit feedback
# Saved searches
## Use saved searches to filter your results more quickly
Cancel
Create saved search
[Sign in](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgit-guides%2Fgit-push)
[Sign up](https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2Fgit-guides%2Fgit-push&source=header)
Resetting focus
You signed in with another tab or window. [Reload](https://github.com/git-guides/git-push) to refresh your session. You signed out in another tab or window. [Reload](https://github.com/git-guides/git-push) to refresh your session. You switched accounts on another tab or window. [Reload](https://github.com/git-guides/git-push) to refresh your session.
Dismiss alert
[Git Guides](https://github.com/git-guides)
[Git](https://github.com/git-guides) [Install](https://github.com/git-guides/install-git) [Init](https://github.com/git-guides/git-init) [Clone](https://github.com/git-guides/git-clone) [Add](https://github.com/git-guides/git-add) [Commit](https://github.com/git-guides/git-commit) [Remote](https://github.com/git-guides/git-remote) [Status](https://github.com/git-guides/git-status) [Pull](https://github.com/git-guides/git-pull) [Push](https://github.com/git-guides/git-push)
[Sign up](https://github.com/join?ref_cta=git_guides_nav_sign_up&ref_loc=git_guides_nav&ref_page=%2Fgit-guides%2Fgit-push&source=git_guides_nav)

# Git Push
```
git push
```
`git push` uploads all local branch commits to the corresponding remote branch.
## What Does `git push` Do?
`git push` updates the remote branch with local commits. It is one of the four commands in Git that prompts interaction with the remote repository. You can also think of `git push` as *update* or *publish*.
By default, `git push` only updates the corresponding branch on the remote. So, if you are checked out to the `main` branch when you execute `git push`, then only the `main` branch will be updated. It's always a good idea to use `git status` to see what branch you are on before pushing to the remote.
## How to Use `git push`
After you make and commit changes locally, you can share them with the remote repository using `git push`. Pushing changes to the remote makes your commits accessible to others who you may be collaborating with. This will also update any open pull requests with the branch that you're working on.
As best practice, it's important to run the `git pull` command before you push any new changes to the remote branch. This will update your local branch with any new changes that may have been pushed to the remote from other contributors. Pulling before you push can reduce the amount of merge conflicts you create on GitHub – allowing you to resolve them locally before pushing your changes to the remote branch.
### Common usages and options for `git push`
- `git push -f`: Force a push that would otherwise be blocked, usually because it will delete or overwrite existing commits *(Use with caution!)*
- `git push -u origin [branch]`: Useful when pushing a new branch, this creates an upstream tracking branch with a lasting relationship to your local branch
- `git push --all`: Push all branches
- `git push --tags`: Publish tags that aren't yet in the remote repository
You can see all of the options with `git push` in [git-scm's documentation](https://git-scm.com/docs/git-push).
## Why can't I push?
If you are trying to `git push` but are running into problems, there are a few common solutions.
### Check your branch
Check what branch you are currently on with `git status`. If you are working on a protected branch, like `main`, you may be unable to push commits directly to the remote. If this happens to you, it's OK! You can fix this a few ways.
#### Work was not yet on any branch
1. Create and checkout to a new branch from your current commit: `git checkout -b [branchname]`
2. Then, push the new branch up to the remote: `git push -u origin [branchname]`
#### Accidentally committed to the wrong branch
1. Checkout to the branch that you intended to commit to: `git checkout [branchname]`
2. Merge the commits from the branch that you *did* accidentally commit to: `git merge [main]`
3. Push your changes to the remote: `git push`
4. Fix the other branch by checking out to that branch, finding what commit it *should* be pointed to, and using `git reset --hard` to correct the branch pointer
## Related Terms
- `git commit -m "descriptive message"`: Records file snapshots permanently in version history.
- `git clone [url]`: Clone (download) a repository that already exists on GitHub, including all of the files, branches, and commits.
- `git status`: Always a good idea, this command shows you what branch you're on, what files are in the working or staging directory, and any other important information.
- `git pull`: Updates your current local working branch with all new commits from the corresponding remote branch on GitHub. `git pull` is a combination of `git fetch` and `git merge`.
[Contribute to this article](https://github.com/github/training-kit/blob/master/git-guides/git-push.md) on GitHub.
### Get started with git and GitHub
Review code, manage projects, and build software alongside 40 million developers.
[Sign up for GitHub](https://github.com/join) [Sign in](https://github.com/login)
## Site-wide Links
### Subscribe to our developer newsletter
Get tips, technical guides, and best practices. Twice a month.
[Subscribe](https://github.com/newsletter)
### Platform
- [Features](https://github.com/features)
- [Enterprise](https://github.com/enterprise)
- [Copilot](https://github.com/features/copilot)
- [AI](https://github.com/features/ai)
- [Security](https://github.com/security)
- [Pricing](https://github.com/pricing)
- [Team](https://github.com/team)
- [Resources](https://resources.github.com/)
- [Roadmap](https://github.com/github/roadmap)
- [Compare GitHub](https://github.com/resources/articles/devops-tools-comparison)
### Ecosystem
- [Developer API](https://docs.github.com/get-started/exploring-integrations/about-building-integrations)
- [Partners](https://partner.github.com/)
- [Education](https://github.com/edu)
- [GitHub CLI](https://cli.github.com/)
- [GitHub Desktop](https://desktop.github.com/)
- [GitHub Mobile](https://github.com/mobile)
- [GitHub Marketplace](https://github.com/marketplace)
- [MCP Registry](https://github.com/mcp)
### Support
- [Docs](https://docs.github.com/)
- [Community Forum](https://github.community/)
- [Professional Services](https://services.github.com/)
- [Premium Support](https://github.com/enterprise/premium-support)
- [Skills](https://skills.github.com/)
- [Status](https://www.githubstatus.com/)
- [Contact GitHub](https://support.github.com/?tags=dotcom-footer)
### Company
- [About](https://github.com/about)
- [Why GitHub](https://github.com/why-github)
- [Customer stories](https://github.com/customer-stories?type=enterprise)
- [Blog](https://github.blog/)
- [The ReadME Project](https://github.com/readme)
- [Careers](https://github.careers/)
- [Newsroom](https://github.com/newsroom)
- [Inclusion](https://github.com/about/diversity)
- [Social Impact](https://socialimpact.github.com/)
- [Shop](https://shop.github.com/)
- ©
2026
GitHub, Inc.
- [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
- [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
[(Updated 02/2024)02/2024](https://github.com/github/site-policy/pull/582)
- [Sitemap](https://github.com/sitemap)
- [What is Git?](https://github.com/git-guides)
- Manage cookies
- Do not share my personal information
- [GitHub on LinkedIn](https://www.linkedin.com/company/github)
- [GitHub on Instagram](https://www.instagram.com/github)
- [GitHub on YouTube](https://www.youtube.com/github)
- [GitHub on X](https://x.com/github)
- [GitHub on TikTok](https://www.tiktok.com/@github)
- [GitHub on Twitch](https://www.twitch.tv/github)
- [GitHub’s organization on GitHub](https://github.com/github)
English
- [English](https://github.com/git-guides/git-push)
- [PortuguĂŞs (Brasil)](https://github.com/git-guides/git-push)
- [Español (América Latina)](https://github.com/git-guides/git-push)
- [日本語](https://github.com/git-guides/git-push)
- [한ęµě–´](https://github.com/git-guides/git-push)
You can’t perform that action at this time. |
| Readable Markdown | ```
git push
```
`git push` uploads all local branch commits to the corresponding remote branch.
What Does `git push` Do?
`git push` updates the remote branch with local commits. It is one of the four commands in Git that prompts interaction with the remote repository. You can also think of `git push` as *update* or *publish*.
By default, `git push` only updates the corresponding branch on the remote. So, if you are checked out to the `main` branch when you execute `git push`, then only the `main` branch will be updated. It's always a good idea to use `git status` to see what branch you are on before pushing to the remote.
How to Use `git push`
After you make and commit changes locally, you can share them with the remote repository using `git push`. Pushing changes to the remote makes your commits accessible to others who you may be collaborating with. This will also update any open pull requests with the branch that you're working on.
As best practice, it's important to run the `git pull` command before you push any new changes to the remote branch. This will update your local branch with any new changes that may have been pushed to the remote from other contributors. Pulling before you push can reduce the amount of merge conflicts you create on GitHub – allowing you to resolve them locally before pushing your changes to the remote branch.
Common usages and options for `git push`
- `git push -f`: Force a push that would otherwise be blocked, usually because it will delete or overwrite existing commits *(Use with caution!)*
- `git push -u origin [branch]`: Useful when pushing a new branch, this creates an upstream tracking branch with a lasting relationship to your local branch
- `git push --all`: Push all branches
- `git push --tags`: Publish tags that aren't yet in the remote repository
You can see all of the options with `git push` in [git-scm's documentation](https://git-scm.com/docs/git-push).
Why can't I push?
If you are trying to `git push` but are running into problems, there are a few common solutions.
Check your branch
Check what branch you are currently on with `git status`. If you are working on a protected branch, like `main`, you may be unable to push commits directly to the remote. If this happens to you, it's OK! You can fix this a few ways.
Work was not yet on any branch
1. Create and checkout to a new branch from your current commit: `git checkout -b [branchname]`
2. Then, push the new branch up to the remote: `git push -u origin [branchname]`
Accidentally committed to the wrong branch
1. Checkout to the branch that you intended to commit to: `git checkout [branchname]`
2. Merge the commits from the branch that you *did* accidentally commit to: `git merge [main]`
3. Push your changes to the remote: `git push`
4. Fix the other branch by checking out to that branch, finding what commit it *should* be pointed to, and using `git reset --hard` to correct the branch pointer
Related Terms
- `git commit -m "descriptive message"`: Records file snapshots permanently in version history.
- `git clone [url]`: Clone (download) a repository that already exists on GitHub, including all of the files, branches, and commits.
- `git status`: Always a good idea, this command shows you what branch you're on, what files are in the working or staging directory, and any other important information.
- `git pull`: Updates your current local working branch with all new commits from the corresponding remote branch on GitHub. `git pull` is a combination of `git fetch` and `git merge`.
[Contribute to this article](https://github.com/github/training-kit/blob/master/git-guides/git-push.md) on GitHub.
### Get started with git and GitHub
Review code, manage projects, and build software alongside 40 million developers.
[Sign up for GitHub](https://github.com/join) [Sign in](https://github.com/login) |
| Shard | 174 (laksa) |
| Root Hash | 6325672905007345774 |
| Unparsed URL | com,github!/git-guides/git-push s443 |