Developers Git Quiz Question and Answers
Q: Git is a _______ tool.
- Centrally Distributed System
- Centralized Version Control System
- Distributed Version Control System
Q: What is the command to create a new branch in git?
- git create branch branchname
- git branch branchname
- git add branch branchname
- git invoke branch branchname
Q: What is the command to switch to a branch in git?
- git checkout branchname
- git move branchname
- git change branch branchname
Q: What is the git command to directly create and move to a new branch
- git checkout -b branchname
- git move branchname
- git change branch branchname
- None of the options
Q: What is the git command to blow away all the changes since last commit
- git checkout filename
- git blowaway filename
- git mod filename
- None of the options
Q: What is the command to delete a branch in git?
- get delete branch branchname
- git branch -d branchname
- git delete branchname
- None of the options
Q: What is the git command to force delete a branch?
- get delete branch branchname
- git branch -d branchname
- git delete branchname
- None of the options
Q: What is the git command to see all the remote branches
- git branch -r
- git view remote branch
- git -v branch
- None of the options
Q: What does the command git add. do?
- Adds all the files to local directory
- Adds all the files to repo
- Adds all the files to staging area
- None of the options
Q: What is the git command to see all the changes since the last commit?
- git status
- git last changes
- git view changes
- git see changes
Q: What is the git command to skip staging and directly commit the changes directly?
- git commit -a -m “message”
- git commit
- git skip stage
- git add changes
Q: In git, after performing several commits, or cloning a repository with an existing commit history, if you want to look back to see what has happened, what command will you use?
- git view history
- git log
- git show commits
- git show history
Q: What is the purpose of git blame is to find?
- Who wrote the feature
- When a file was created
- Who created the file
- The commit and the author of a particular line
Q: The email address of the author can be got instead of the author's name in the result using ___________.
- git blame filename
- git blame -a filename
- git blame -e filename
- git blame -E filename
Q: If you want to see the changes since last commit in a specific file, what command should you use?
- git status
- git log
- git diff filename
- git view changes file name
Q: What is the git command to view all the changes since the last commit?
- git commit
- git stash
- git tempstore
- git store
Q: What is the command to store the uncommitted changes temporarily?
- git commit
- git stash
- git tempstore
- git store
Q: It is a good practice to use present tense in commit messages. True or False?
- True
- False
Q: GIT takes care of access control. True or False?
- True
- False
Q: When I run git fetch from my local repo it will update my local code. True or False?
- False
- True
Q: The command git checkout branch is used for?
- Switches from main branch to the new branch
- Add the new branch
- Commit the new branch
- Delete the new branch
Q: What is a good practice to follow when you want to back up a local branch in git?
- Create another copy
- Push to remote repo
- Move to another PC
- None of the options
Q: What does the following command perform? Git reset –- soft HEAD^
- Move commit to one after current head
- Move commit to one before current head
- Move commit to the first head
- None of the options
Q: What are the primary ways that people collaborate on GitHub?
- Shared repository
- Fork and pull
- Both the option
Q: How to declare that a commit is errorless in git bisect
- git bisect perfect
- git bisect good
- git good bisect
- git bisect errorless
Q: Are git hooks files version controlled? Yes No
- Yes
- No
Q: Which of the following is a server-side hook?
- post-receive
- prepare-commit
- pre-commit
- post-commit
Q: Is it possible to get merge conflict during git cherry-pick? Yes No
- Yes
- No
Q: Which option can be used to change the commit message during git cherry-pick
- -e
- -u
- -n
- -r
Q: Which command is useful to undo a git rebase
- git blame
- git reflog
- git log
- git undo
Q: The reference of the deleted commit can be got using git reflog. True False
- True
- False
Q: The result of the command git blame filename will have the following, except ________.
- updated timestamp
- author's email address
- commit hash
- author's name
Q: Can branches be created inside the Git submodule?
- Yes
- No
Q: On adding a subproject using git submodule add, how many files will be added in the main repository?
- 2
- 3
- 4
- 1
Q: When you run git commit, which hook(s) is/are called?
- pre-commit
- succeeding-commit
- post-commit
- Both pre and post commits
Q: Developer A found that a button, which was working fine earlier is not working in the project. It is not sure which commit introduced this bug! Which of the following Git commands would you suggest?
- Git blame
- Git bisect
- Git search
- Git binary search
Q: Which option is used to remove a single stash entry from a list of stash entries?
- delete
- drop
- remove
- clear
Q: Can a commit be taken from one branch and moved to a different branch in git?
- No
- Yes
Q: A tag in git context is a ________.
- Search String
- Keyword
- Reference to a specific commit
Q: We can reset git bisect using git bisect reset even in the middle of a bisect.
- True
- False
Q: The result of git blame filename will return the original lines of source code in the console.
- True
- False