In Git, what is the difference between commit and push?
-
A
Both only stage files without saving them
-
B
Commit uploads to a remote; push saves locally
-
C
Both send changes straight to the remote
-
D
Commit saves locally; push uploads to a remote
Correct answer
Correct answer
D. Commit saves locally; push uploads to a remote
20 views
Explanation
git commit records a snapshot in your local repository. git push sends those commits to a remote such as GitHub, so teammates can pull them.
Reference
Asked in: NTS, Technical Interviews
Doubts & discussion
Not sure why the answer is D? Ask here and get an explanation.
Ask a doubt about this MCQ