CS FundamentalsModerateWipro · Accenture pattern

What is the difference between git fetch and git pull?

  1. A. git fetch merges remote changes; git pull only downloads them
  2. B. git fetch only downloads remote commits into remote-tracking branches; git pull fetches and then merges (or rebases) them into the current branch
  3. C. git fetch works only on tags; git pull works on branches
  4. D. They are identical aliases

Correct answer: B. git fetch only downloads remote commits into remote-tracking branches; git pull fetches and then merges (or rebases) them into the current branch

git pull = git fetch + git merge (or git rebase with --rebase). git fetch never touches your working branch, which makes it the safe way to look before integrating.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic