Git Online Quiz

Welcome to our beginner-level Git quiz! Git is a widely used version control system that allows multiple developers to work together and manage changes to projects over time. This quiz comprises 25 multiple-choice questions that will test your understanding of the basic operations and concepts of Git. Whether you're just starting out with Git or looking to reinforce your fundamental knowledge, these questions will help you grasp the essentials needed to manage your projects efficiently.

1. What is Git primarily used for?

a) Project management
b) Version control
c) Building websites
d) Networking computers

2. What does the git clone command do?

a) Creates a new Git repository
b) Copies a Git repository from a remote source
c) Deletes a Git repository
d) Renames a Git repository

3. Which command shows the commit history of a repository?

a) git log
b) git commit
c) git status
d) git show

4. What is the purpose of the .gitignore file?

a) To track files that should be ignored by Git
b) To list contributors to a project
c) To log changes to files
d) To configure project settings

5. How do you create a new branch in Git?

a) git branch new_branch
b) git checkout new_branch
c) git make branch new_branch
d) git new branch new_branch

6. What does the git status command display?

a) The current state of the repository
b) The commit history
c) The contents of a specific file
d) The configuration settings of Git

7. Which command is used to stage files for a commit?

a) git commit
b) git add
c) git stage
d) git save

8. How do you switch to a different branch in Git?

a) git change branch
b) git switch
c) git branch switch
d) git checkout

9. What command merges a branch into the active branch?

a) git merge
b) git combine
c) git join
d) git integrate

10. What is the default branch name in Git?

a) master
b) main
c) root
d) base

11. How do you commit staged changes in Git?

a) git commit -m "Commit message"
b) git commit save
c) git save commit
d) git do commit

12. What does the git pull command do?

a) Sends changes to the remote repository
b) Retrieves updates from the remote repository
c) Deletes changes from the remote repository
d) Copies a remote repository

13. How do you view changes in files before committing?

a) git review
b) git diff
c) git changes
d) git show

14. Which command deletes a branch in Git?

a) git remove branch
b) git delete branch
c) git branch -d
d) git erase branch

15. What is a remote in Git?

a) A repository stored on your local computer
b) A backup of your repository
c) A repository on a network or hosted on the internet
d) A cloned repository

16. How do you save changes without committing them?

a) git hold
b) git wait
c) git stash
d) git pause

17. What command would you use to see who changed specific parts of a file?

a) git who
b) git blame
c) git review
d) git check

18. How do you undo a commit in Git?

a) git revert
b) git undo
c) git back
d) git return

19. What does git push do?

a) Downloads changes from the remote repository
b) Saves new commits to the remote repository
c) Pulls changes from a branch
d) Deletes commits from the remote repository

20. What is a fork in Git?

a) A command to delete branches
b) A personal copy of another user's repository
c) A merge conflict
d) A type of commit

21. What is the purpose of the git config command?

a) To change Git installation settings
b) To configure user-specific information
c) To delete configuration settings
d) To reset your computer’s settings

22. How can you see the configuration settings of your Git repository?

a) git settings
b) git config --list
c) git list settings
d) git show config

23. What is git init used for?

a) Initializing a new Git repository
b) Restarting the Git software
c) Initializing a new branch in the repository
d) Resetting your Git configuration

24. How do you add all changes in your working directory to the staging area?

a) git add .
b) git add all
c) git stage all
d) git commit all

25. What is the benefit of using git branch -m?

a) It merges branches.
b) It moves or renames a branch.
c) It multiplies the commit history.
d) It marks a branch as important.