CompTIA Linux+ (XK0-004) — Question 227
A Linux administrator needs to update a script that is stored in the team's Git repository.
After the administrator clones the repository, which of the following is the BEST method to ensure merging changes in the future will not overwrite other users' commits to the repository?
Answer options
- A. Create a new repository based on the existing repository
- B. Create a new folder with the changes under the administrator's name
- C. Create a new script and commit it to the master branch
- D. Create a new branch and make modifications to the code
Correct answer: D
Explanation
Creating a new branch allows the administrator to make changes without affecting the main codebase, thus preventing overwriting others' commits. The other options either create separate repositories or folders, or involve committing directly to the master branch, both of which can lead to conflicts and loss of collaborative work.