Repaso
Español

In Git, what is the difference between commit and push?

Options

  1. They are the same command, written with two different names
  2. commit saves locally; push uploads commits to the remote (Correct option)
  3. push saves locally, and commit uploads to the remote
  4. commit deletes 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.

Key terms

Practice this question in Repaso