Basically, git commit "records changes to the repository" while git push "updates remote refs along with associated objects". So the first one is used in connection with your local repository, while the latter one is used to interact with a remote repository.

Here is a nice picture from Oliver Steele, that explains the Git model and the commands:

Read more about git push and git pull on Pushing and pulling (the article I referred to first).

Answer from tanascius on Stack Overflow
🌐
Earth Data Science
earthdatascience.org › home
First steps with git: clone, add, commit, push | Earth Data Science - Earth Lab
September 12, 2017 - Learn basic git commands, including clone, add, commit, and push.
Discussions

Whats the purpose of a git commit VS git push?
Some programmers like to have a clean commit history, so after they make all the commits like "A small fix", "Correction to the fix", "It works this time" etc, they squash commits and rewrite them so they make sense. Also, one might not want to have their commits on the server before it's finished so it can be rebased and corrected without force pushing. More on reddit.com
🌐 r/learnprogramming
28
48
February 6, 2023
using-git - incremental_games
Make changes in my master branch related to the issue and make sure everything works. It's important to only work on one issue at a time. ... git commit -m "Fixed bug foo, closes #1" - Commit the change locally. GitHub has a nice feature that will allow your commit messages to close issues. This is great for cross referencing as well. git push ... More on reddit.com
🌐 r/incremental_games
What is this? Got it while `git push origin master` today!
66K subscribers in the git community. More on reddit.com
🌐 r/git
16
19
June 20, 2017
Latest Commit Is Not What Gets Pushed. Very Confused, Started Git Yesterday, Can't Find Guidance That I Actually Understand : git
Latest Commit Is Not What Gets Pushed. Very Confused, Started Git Yesterday, Can't Find Guidance That I Actually Understand (self.git) ... Post a comment! ... Use of this site constitutes acceptance of our User Agreement and Privacy Policy. © 2023 reddit inc. More on beta.reddit.com
🌐 r/git
🌐
Graphite
graphite.com › guides › git-add-commit-push
Git add, commit, and push
Finally, git push transfers those snapshots from your local repository to a remote repository, making them visible to your team. In other words, think of git add as preparing your changes, git commit as finalizing them into a checkpoint in your project’s history, and git push as publishing that checkpoint for others to pull.
🌐
Git
git-scm.com › cheat-sheet
Git Cheat Sheet
git checkout <commit> <file> OR git restore <file> --source <commit> git remote add <name> <url> git push origin main · git push · git push -u origin <name> git push --force-with-lease · git push --tags · git fetch origin main · git pull --rebase · git pull origin main OR git pull ·
🌐
Reddit
reddit.com › r/learnprogramming › whats the purpose of a git commit vs git push?
r/learnprogramming on Reddit: Whats the purpose of a git commit VS git push?
February 6, 2023 -

Just to be clear, I know what git add, commit, and push all do. When I write code and I solved some bug, what I do is

git add .
git commit -m "this thing finally works'
git push origin main

I never do a commit that I don't push right after. And that's because I don't get why I should commit what I don't intend to push. And if I don't intent to push, why commit? Just to be clear, I know HOW these commands work. I don't understand their WHY.

Find elsewhere
🌐
Medium
frankgwarman.medium.com › the-first-pull-commit-and-push-with-git-fb620b0e630b
The first Pull, Commit, and Push with Git! | by Frank Warman | Medium
June 20, 2023 - The git commit command only commits to your local branches. You will not be able to interact with these online, yet. Pushing your local commit to the remote server will complete the process!
🌐
GitLab
docs.gitlab.com › topics › git › commit
Stage, commit, and push changes | GitLab Docs
You can stage all your changes and commit them with one command: git commit -a -m "<comment that describes the changes>" Be careful your commit doesn’t include files you don’t want to record to the remote repository. As a rule, always check the status of your local repository before you ...
🌐
Graphite
graphite.com › guides › git-commit-vs-push
Understanding the differences between `git commit` and `git push`
git commit is a local operation; it affects only your local repository and does not interact with the remote repository. Until they're pushed, commits exist only on your local machine.
🌐
JetBrains
jetbrains.com › help › pycharm › commit-and-push-changes.html
Commit and push changes to Git repository | PyCharm Documentation
February 16, 2026 - When you're ready, click Commit or Commit and Push (Ctrl+Alt+K) to push the changes to the remote repository immediately after the commit. You will be able to review the current commit as well as all other commits before they are pushed to the ...
🌐
Medium
chancecornell.medium.com › how-to-commit-and-push-to-git-d53004bcc1e9
How to commit and push to Git.. When using Git with your projects… | by Chance Cornell | Medium
June 15, 2021 - How to commit and push to Git. When using Git with your projects, there are three things that we need to do. Pull, Commit, Push. We will talk about how to do each of those next. If we continue to do …
🌐
JetBrains
jetbrains.com › help › clion › commit-and-push-changes.html
Commit and push changes to Git repository | CLion Documentation
February 16, 2026 - When you're ready, click Commit or Commit and Push (Ctrl+Alt+K) to push the changes to the remote repository immediately after the commit. You will be able to review the current commit as well as all other commits before they are pushed to the ...
🌐
GeeksforGeeks
geeksforgeeks.org › git › difference-between-git-commit-and-git-push
Difference Between "git commit" and "git push"? - GeeksforGeeks
July 29, 2024 - Documentation: Commit messages serve as a log that documents the progress and changes in the project. ... git push uploads contents from your local repository to a remote repository.
🌐
JetBrains
jetbrains.com › help › idea › commit-and-push-changes.html
Commit and push changes to Git repository | IntelliJ IDEA Documentation
February 16, 2026 - When you're ready, click Commit or Commit and Push (Ctrl+Alt+K) to push the changes to the remote repository immediately after the commit. You will be able to review the current commit as well as all other commits before they are pushed to the ...
🌐
Atlassian
atlassian.com › git › tutorials › syncing › git-push
Git Push | Atlassian Git Tutorial
First, it makes sure your local ... a good opportunity to clean up your commits before sharing them. Then, the git push command sends all of the commits on your local main to the central repository....
🌐
Kev Quirk
kevquirk.com › git-commit-and-push-script
A Script to Automate Git Add, Commit & Push - Kev Quirk
I'm typing the post in Typora; so being able to flip to the command line and enter a single command, would be great. Since I use an M1 Macbook Air, which is basically Unix under the hood, I can use good old BASH to do this. So I used the following script (thanks to StackOverflow): #!/bin/bash read -p "Commit message: " desc git add . && \ git commit -m "$desc" && \ git push
🌐
JetBrains
jetbrains.com › help › go › commit-and-push-changes.html
Commit and push changes to Git repository | GoLand Documentation
February 16, 2026 - When you're ready, click Commit or Commit and Push (Ctrl+Alt+K) to push the changes to the remote repository immediately after the commit. You will be able to review the current commit as well as all other commits before they are pushed to the ...
🌐
Git
git-scm.com › docs › git-push
Git - git-push Documentation
I.e. create a base tag for versions of the upstream code that you’ve seen and are willing to overwrite, then rewrite history, and finally force push changes to master if the remote version is still at base, regardless of what your local remotes/origin/master has been updated to in the background. Alternatively, specifying --force-if-includes as an ancillary option along with --force-with-lease[=<refname>] (i.e., without saying what exact commit the ref on the remote side must be pointing at, or which refs on the remote side are being protected) at the time of "push" will verify if updates from the remote-tracking refs that may have been implicitly updated in the background are integrated locally before allowing a forced update.
🌐
Medium
medium.com › @speaktoharisudhan › git-add-git-commit-git-push-git-clone-git-branch-git-git-communications-8fcfac467748
git add || git commit || git push || git clone || git branch || .git || git communication || Best Practices | by Harisudhan.S | Medium
June 5, 2025 - This pushes our commits to the main or master branch of the remote named origin. It ensures that your teammates have access to the latest version of the project. git push is how our local work becomes visible and collaborative in a shared repository.