In Git, what is the difference between commit and push?
Options
- They are the same command, written with two different names
commitsaves locally;pushuploads commits to the remote (Correct option)pushsaves locally, andcommituploads to the remotecommitdeletes the old files from the repository
Answer
commit saves a snapshot in your LOCAL repository; push uploads your commits to the remote (e.g. GitHub)
Why
git commit records a snapshot of your staged changes with a message, only on your computer.
git push sends your new commits to the shared remote repository so others can get them (git pull).
Typical flow: edit → git add → git commit -m "..." → git push.
Remember
commit = save locally. push = share remotely.