Linux and Command-Line Basics

You ran git commit in Git, but the commit does not yet appear in the GitHub repository shared by the team. Which of the following is the reason?

  1. Agit commit only registers changes in the staging area, and git add is needed to record them
  2. BSending committed changes to the shared repository requires running git pull
  3. Cgit commit records in the local repository, and git push is needed to send it to the remote
Show answer and explanation

Answer: C. git commit records in the local repository, and git push is needed to send it to the remote

Git is a distributed version control system in which each developer has the whole repository locally, and git commit records changes in that local repository. To send them to a remote repository such as GitHub, git push is run; conversely, git pull (or git fetch and git merge) brings new remote commits into the local repository. This is why commits can be made without a network connection and pushed together later. If someone else has pushed first, you may be asked to bring in their changes first.

  • A. The roles of git add and git commit are reversed. add stages and commit records.
  • B. git pull brings remote changes into the local repository; sending local commits is done with git push.
  • C. Correct. commit records locally, and push sends to the remote.
Practice this topic Back to topic

Books on Linux and Command-Line Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Linux and Command-Line Basics questions

  1. "build/" was written in the .gitignore of a project managed with Git, but changes to build/out.log, which was committed earlier, keep appearing in git status. Which of the following is the reason?
  2. Which of the following correctly pairs standard Linux directories with what is placed in them?
  3. Which of the following correctly describes the /proc directory on Linux?
  4. The directory /home/alice/data exists, and the current directory is /home/alice/work. Which of the following is the directory shown when "cd ../data" is run and then "pwd"?
  5. In the home directory, "ls" shows only notes.txt, while "ls -a" shows ".", "..", ".bashrc" and "notes.txt". Which of the following correctly explains this result?