nerdexam
CompTIA

XK0-005 · Question #406

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?

The correct answer is B. pull -> add -> commit -> push. The correct Git workflow for adding a new file follows a logical sequence: (1) pull - sync the local repository with the latest remote changes to avoid conflicts; (2) add - stage the new configuration file for inclusion in the next commit; (3) commit - record the staged changes…

Scripting, Containers, and Automation

Question

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?

Options

  • Apull -> push -> add -> checkout
  • Bpull -> add -> commit -> push
  • Ccheckout -> push -> add -> pull
  • Dpull -> add -> push -> commit

How the community answered

(36 responses)
  • A
    3% (1)
  • B
    89% (32)
  • C
    6% (2)
  • D
    3% (1)

Explanation

The correct Git workflow for adding a new file follows a logical sequence: (1) pull - sync the local repository with the latest remote changes to avoid conflicts; (2) add - stage the new configuration file for inclusion in the next commit; (3) commit - record the staged changes to the local repository with a commit message; (4) push - upload the local commit(s) to the remote repository. Pushing before committing is invalid (nothing to push), and committing before staging (add) means the file won't be included.

Topics

#Git#Version Control#Git Workflow#Linux Administration

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice