XK0-005 · Question #236
A Linux team is using Git to version a set of custom scripts. A team member has made an update to a script and published the changes to the repository. Which of the following is the BEST way to…
The correct answer is D. git pull. To efficiently synchronize a local Git working copy with the latest changes from a remote repository, the git pull command is the most direct method.
Question
A Linux team is using Git to version a set of custom scripts. A team member has made an update to a script and published the changes to the repository. Which of the following is the BEST way to retrieve the latest changes to the administrator's local working copy?
Options
- Agit fetch
- Bgit merge
- Cgit commit
- Dgit pull
How the community answered
(42 responses)- B5% (2)
- C2% (1)
- D93% (39)
Why each option
To efficiently synchronize a local Git working copy with the latest changes from a remote repository, the `git pull` command is the most direct method.
`git fetch` retrieves changes from the remote repository but does not integrate them into the local working copy; it only updates the remote-tracking branches, requiring a subsequent `git merge` or `git rebase`.
`git merge` integrates changes from one branch into another, but it does not fetch the latest changes from the remote repository first, so it would not necessarily bring in new remote commits.
`git commit` records local changes to the local repository, creating a new commit, but it does not interact with the remote repository to retrieve changes.
`git pull` is the command that performs a `git fetch` (retrieving changes from the remote repository) followed by a `git merge` (integrating those changes into the current local branch). This single command updates the administrator's local working copy with all the latest published changes.
Concept tested: Git retrieving remote changes
Source: https://git-scm.com/docs/git-pull
Topics
Community Discussion
No community discussion yet for this question.