QuizzesCore Workflow — init, add, commit, log — Concept Check
intermediate
git

Core Workflow — init, add, commit, log — Concept Check

Questions on Core Workflow — init, add, commit, log. The daily Git loop: initialise a repo, stage changes precisely with git add, commit with a meaningful message, and explore history with git log. Mastering these five commands covers 80% of day-to-day Git usage.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Core Workflow — init, add, commit, log — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.You have initialized a new Git repository and made changes to several files. You want to commit only specific changes from one file. Which command should you use?

    • Agit add -p
    • Bgit status
    • Cgit add .
    • Dgit commit -m
  2. 2.After cloning a repository, you want to see the URL of the remote repository. Which command will you use?

    • Agit clone --url
    • Bgit remote -v
    • Cgit init --remote
    • Dgit fetch --origin
  3. 3.You committed changes with a typo in the commit message. You haven't pushed yet. How can you correct it?

    • Agit commit --amend
    • Bgit log --edit
    • Cgit reset --hard
    • Dgit revert HEAD
  4. 4.A developer uses 'git add .' to stage changes. What is a potential downside?

    • AUnintentionally staging unwanted changes
    • BEnsuring only specific files are staged
    • CAutomatically committing changes
    • DImproving commit precision
  5. 5.You want to see a visual representation of the branch history. Which command should you use?

    • Agit log --author
    • Bgit log --oneline --graph --all
    • Cgit log -p
    • Dgit log --stat
  6. 6.A teammate suggests using 'git add' to save changes. Why is this incorrect?

    • A'git add' reverts to the last commit
    • B'git add' discards unstaged changes
    • C'git add' commits changes directly
    • D'git add' stages changes, it doesn't save them
  7. 7.You want to filter commit history by changes made in the last two weeks. Which command helps you achieve this?

    • Agit log --author='2 weeks ago'
    • Bgit log --grep='2 weeks ago'
    • Cgit log --stat='2 weeks ago'
    • Dgit log --since='2 weeks ago'
  8. 8.What is the best practice for writing a commit message subject line?

    • ADescribe changes in past tense
    • BWrite a detailed explanation
    • CInclude all file names changed
    • DUse imperative mood, ≤72 characters