Git It Done: Mastering Version Control Quiz

  1. Initializing a Repository

    What is the correct command to initialize a new Git repository in the current directory?

    1. A: git start
    2. B: git init
    3. C: git new
    4. D: git begin
    5. E: git initialize
  2. Staging Changes

    Which command stages all modified files in the working directory for the next commit?

    1. A: git commit -a
    2. B: git add .
    3. C: git stage all
    4. D: git push all
    5. E: git commit -am
  3. Creating a Branch

    What is the command used to create a new branch named 'feature-x'?

    1. A: git branch feature-x
    2. B: git checkout -b feature-x
    3. C: git new-branch feature-x
    4. D: git create branch feature-x
    5. E: git branch --new feature-x
  4. Switching Branches

    How do you switch to the 'development' branch?

    1. A: git switch development
    2. B: git checkout development
    3. C: git branch development
    4. D: git change development
    5. E: git use development
  5. Merging Branches

    Assuming you are on the 'main' branch, what command merges the 'feature-y' branch into 'main'?

    1. A: git merge main feature-y
    2. B: git merge feature-y
    3. C: git checkout feature-y u0026u0026 git merge main
    4. D: git merge into main feature-y
    5. E: git merge feature-y main
  6. Resolving Conflicts

    After encountering a merge conflict, what is the typical first step to resolve it?

    1. A: Run git commit --amend
    2. B: Manually edit the conflicting files to resolve the issues
    3. C: Use git revert
    4. D: Delete the conflicting branch
    5. E: Run git clean -f
  7. Cloning a Repository

    What command is used to download a remote repository to your local machine?

    1. A: git pull
    2. B: git fetch
    3. C: git clone
    4. D: git download
    5. E: git get
  8. Pushing Changes

    What command sends your local commits to a remote repository?

    1. A: git send
    2. B: git sync
    3. C: git commit
    4. D: git push
    5. E: git upload
  9. Reverting a Commit

    Which command creates a new commit that undoes the changes introduced by a specific commit?

    1. A: git undo
    2. B: git reset
    3. C: git revert
    4. D: git checkout -- .
    5. E: git remove
  10. Gitignore Files

    What is the primary purpose of a '.gitignore' file?

    1. A: To specify files to be committed to the repository.
    2. B: To specify files to be ignored by Git, preventing them from being tracked.
    3. C: To define user preferences for the Git environment.
    4. D: To store configuration settings for the repository.
    5. E: To track the history of ignored files.