Skip to content

Git Workshop Quiz (40 Questions) #1

Description

@GregOnNet

1. What is Git?

  • ✅ A version control system
  • A nickname for GitHub
  • A remote repository platform
  • A programming language

2. Git is the same as GitHub.

  • ✅ False
  • True

3. What is the command to get the installed version of Git?

  • ✅ git --version
  • git help version
  • gitVersion
  • getGitVersion

4. What is the command to initialize Git on the current repository?

  • ✅ git init
  • initialize git
  • git start
  • start git

5. Git automatically adds new files to the repository and starts tracking them.

  • ✅ False
  • True

6. Which option should you use to set the default user name for every repository on your computer?

  • ✅ --global
  • --all
  • --A
  • No need to specify, that is the default

7. What is the command to set the user email for the current repository?

  • ✅ git config user.email
  • git email.user
  • git config email

8. What is the command to configure a merge tool in Git?

  • ✅ git config --global merge.tool
  • git merge-tool set
  • git config merge
  • git set merge.tool

9. What is the command to add all files and changes of the current folder to the staging environment?

  • git add
  • git add --files
  • ✅ git add --all

10. What is the command to stage a specific file named index.html?

  • ✅ git add index.html
  • git stage index.html
  • git add file index.html
  • git commit index.html

11. What is the command to get the current status of the Git repository?

  • ✅ git status
  • git getStatus
  • --status
  • git config --status

12. What is the command to unstage a file that was added to the staging area?

  • ✅ git reset index.html
  • git remove index.html
  • git unstage index.html
  • git delete index.html

13. What is the command to discard changes in a file and restore the last committed version?

  • ✅ git checkout -- index.html
  • git revert index.html
  • git reset --all
  • git undo index.html

14. What is the command to temporarily save changes without committing them?

  • ✅ git stash
  • git save-temp
  • git hold
  • git pause

15. What is the command to commit the staged changes?

  • ✅ git commit
  • git save
  • git snapshot
  • git com

16. What is the command to commit with the message "New email"?

  • ✅ git commit -m "New email"
  • git commit -log "New email"
  • git commit message "New email"
  • git commit -mess "New email"

17. What is the command to view commit history?

  • ✅ git log
  • git history
  • git --full-log
  • git commits

18. What is the command to see available options for the commit command?

  • ✅ git commit -help
  • gitHelp commit
  • git commitHelp
  • git commit readme

19. Git commit history is automatically deleted:

  • ✅ Commit history is never automatically deleted
  • Every 2 weeks
  • Every year
  • Every month

20. In Git, a branch is:

  • ✅ A separate version of the main repository
  • Nothing, it is a nonsense word
  • A small wooden stick you can use to type commands
  • A secret part of Git config

21. What is the command to create a new branch named "new-email"?

  • ✅ git branch new-email
  • git newBranch "new-email"
  • git branch new "new-email"
  • git add branch "new-email"

22. What is the command to switch to the branch "new-email"?

  • ✅ git checkout new-email
  • git branch -move new-email
  • git checkout branch new-email
  • git branch new-email

23. What option creates a branch if it does not exist when switching?

  • ✅ -b
  • -newbranch
  • -new
  • -all

24. What is the command to list all local branches?

  • ✅ git branch
  • git list branches
  • git show branches
  • git branches

25. What is the command to merge the branch "new-email" into the current branch?

  • ✅ git merge new-email
  • git add new-email
  • git commit -merge new-email

26. What is the difference between git merge and git rebase?

  • git merge deletes history, git rebase keeps it
  • ✅ git merge creates a merge commit, while git rebase rewrites commit history
  • git rebase only works on remote branches
  • There is no difference

27. What is the purpose of git rebase?

  • ✅ To move or reapply commits on top of another base branch
  • To delete old commits permanently
  • To merge two repositories into one
  • To create a new remote repository

28. What is the command to clone a repository from a remote URL?


29. What does git clone do?

  • ✅ Creates a local copy of a remote repository
  • Deletes the remote repository
  • Only downloads files without history
  • Creates a new empty repository

30. What is the command to add a remote repository as "origin"?


31. What is the command to push to the remote origin?

  • ✅ git push origin
  • git remote commit
  • git remote push
  • git merge remote

32. What is the command to fetch changes from the remote repository "origin"?

  • ✅ git fetch origin
  • git status remote origin
  • git get log origin
  • git origin help

33. Git Pull is a combination of:

  • ✅ fetch and merge
  • add and commit
  • branch and checkout

34. What is the command to show differences with branch "new-email"?

  • ✅ git diff new-email
  • git log new-email
  • git status new-email
  • git changes new-email

35. What is the command to delete the branch "new-email"?

  • ✅ git branch -d new-email
  • git gone new-email
  • git delete branch new-email
  • git delete new-email

36. You accidentally committed changes to the main branch but meant to commit to a new branch. What should you do?

  • Delete the commit and start over
  • ✅ Create a new branch from the current state and reset main to the previous commit
  • Push the changes and fix it later
  • Rename the main branch

37. You want to combine multiple commits into a single commit before pushing. What command should you use?

  • git merge
  • ✅ git rebase -i
  • git squash
  • git commit --combine

38. You pulled changes and now have a merge conflict. What is the correct next step?

  • Run git pull again
  • Delete the conflicting files
  • ✅ Resolve the conflicts manually and commit the result
  • Restart the repository

39. You want to undo the last commit but keep the changes in your working directory. What command should you use?

  • git revert HEAD
  • ✅ git reset --soft HEAD~1
  • git reset --hard HEAD~1
  • git delete last commit

40. You want to safely undo a commit that has already been pushed to a shared repository. What command should you use?

  • ✅ git revert
  • git reset --hard
  • git commit --undo
  • git remove commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions