CompTIA Linux+ (XK0-005) — Question 144
A Linux administrator is adding a new configuration file to a Git repository. Which of the following describes the correct order of Git commands to accomplish the task successfully?
Answer options
- A. pull -> push -> add -> checkout
- B. pull -> add -> commit -> push
- C. checkout -> push -> add -> pull
- D. pull -> add -> push -> commit
Correct answer: B
Explanation
The correct sequence is 'pull -> add -> commit -> push' because you first need to update your local repository with 'pull', then stage your new file with 'add', commit the changes with 'commit', and finally push the new commit to the remote repository with 'push'. The other options either include commands in the wrong order or omit necessary steps, making them incorrect.