- What is Git?
a. A version control system
b. A programming language
c. A software suite
d. An operating system
Answer: a
- Who developed Git?
a. Linus Torvalds
b. Richard Stallman
c. Bill Gates
d. Steve Jobs
Answer: a
- What is a repository?
a. A location where code is stored
b. A person who manages code
c. A type of code
d. A software program
Answer: a
- What is a branch?
a. A separate version of the code
b. A type of commit message
c. A way to share code with others
d. A type of tag
Answer: a
- What is a commit?
a. A change made to the code
b. A type of pull request
c. A way to merge code
d. A feature request
Answer: a
- What is a pull request?
a. A way to propose changes to the code
b. A way to revert changes
c. A way to merge changes
d. A way to delete code
Answer: a
- What is a merge conflict?
a. A problem that occurs when two or more people make changes to the same code
b. A type of error
c. A type of commit message
d. A way to share code with others
Answer: a
- What is a tag?
a. A way to mark a specific point in the code’s history
b. A type of commit message
c. A way to merge code
d. A way to delete code
Answer: a
- What is a stash?
a. A way to save changes without committing them
b. A way to delete code
c. A way to revert changes
d. A way to share code with others
Answer: a
- What is a remote?
a. A separate repository that is not on the local machine
b. A person who manages code
c. A type of code
d. A software program
Answer: a
- What is the difference between git clone and git fork?
a. Git clone makes a copy of the repository on your local machine, while git fork creates a copy on GitHub/GitLab.
b. Git clone creates a copy of the repository on GitHub, while git fork creates a copy on your local machine.
c. Git clone and git fork both do the same thing.
d. Git clone creates a new branch, while git fork creates a new repository.
Answer: a
- What is the command to initialize a new Git repository?
a. git init
b. git clone
c. git pull
d. git push
Answer: a
- What is the command to add a file to the staging area?
a. git add filename
b. git commit
c. git push
d. git pull
Answer: a
- What is the command to commit changes?
a. git commit -m “commit message”
b. git add filename
c. git push
d. git pull
Answer: a
- What is the command to push changes to a remote repository?
a. git push
b. git pull
c. git add filename
d. git commit -m “commit message”
Answer: a
- What is the command to create a new branch?
a. git branch new_branch_name
b. git checkout new_branch_name
c. git merge new_branch_name
d. git clone new_branch_name
Answer: a
- What is the command to switch to a different branch?
a. git checkout branch_name
b. git branch new_branch_name
c. git merge branch_name
d. git clone branch_name
Answer: a
- What is the command to merge one branch into another?
a. git merge branch_name
b. git clone branch_name
c. git add filename
d. git push
Answer: a
- What is the command to view the commit history?
a. git log
b. git branch
c. git clone
d. git commit
Answer: a
- What is the command to revert changes?
a. git revert
b. git reset
c. git checkout
d. git pull
Answer: a
- What is the command to undo the last commit?
a. git reset HEAD~1
b. git revert HEAD~1
c. git checkout HEAD~1
d. git commit –amend
Answer: a
- What is the difference between git pull and git fetch?
a. Git pull fetches changes and merges them, while git fetch only fetches changes.
b. Git pull only fetches changes, while git fetch fetches and merges changes.
c. Git pull and git fetch do the same thing.
d. Git pull and git fetch are not actual Git commands.
Answer: a
- What is the command to view the changes made to a file?
a. git diff filename
b. git log
c. git branch
d. git clone
Answer: a
- What is the command to create a tag?
a. git tag tag_name
b. git push
c. git pull
d. git add filename
Answer: a
- What is the command to delete a branch?
a. git branch -d branch_name
b. git clone branch_name
c. git add filename
d. git commit -m “commit message”
Answer: a
- What is the command to view the status of the repository?
a. git status
b. git log
c. git branch
d. git clone
Answer: a
- What is the command to view the remote repositories?
a. git remote -v
b. git clone
c. git add filename
d. git commit -m “commit message”
Answer: a
- What is the command to rename a file?
a. git mv old_filename new_filename
b. git add filename
c. git commit -m “commit message”
d. git push
Answer: a
- What is the command to undo changes made to the staging area?
a. git reset filename
b. git add filename
c. git commit -m “commit message”
d. git push
Answer: a
- What is the command to view the changes made to the repository?
a. git diff
b. git log
c. git branch
d. git clone
Answer: a
- What is the command to view the list of remote branches?
a. git branch -r
b. git log
c. git status
d. git clone
Answer: a
- What is the command to fetch changes from a remote repository?
a. git fetch
b. git pull
c. git push
d. git clone
Answer: a
- What is the command to view the list of tags?
a. git tag
b. git branch
c. git log
d. git clone
Answer: a
- What is the command to view the difference between two branches?
a. git diff branch_1..branch_2
b. git merge branch_1 branch_2
c. git pull branch_1 branch_2
d. git push branch_1 branch_2
Answer: a
- What is the command to move a commit from one branch to another?
a. git cherry-pick commit_hash
b. git merge branch_1 branch_2
c. git checkout branch_name
d. git push
Answer: a
- What is the command to rebase a branch?
a. git rebase branch_name
b. git merge branch_name
c. git add filename
d. git push
Answer: a
- What is the command to view the current branch?
a. git branch
b. git clone
c. git log
d. git status
Answer: a
- What is the command to view the list of commits for a specific file?
a. git log filename
b. git branch
c. git checkout
d. git push
Answer: a
- What is the command to undo changes to a specific file?
a. git checkout filename
b. git reset filename
c. git add filename
d. git push
Answer: a
- What is the command to delete a tag?
a. git tag -d tag_name
b. git push
c. git pull
d. git add filename
Answer: a
- What is the command to change the commit message?
a. git commit –amend
b. git reset
c. git revert
d. git push
Answer: a
- What is the command to delete untracked files?
a. git clean -f
b. git reset
c. git revert
d. git add filename
Answer: a
- What is the command to set up a Git repository with a remote?
a. git remote add remote_name remote_url
b. git push
c. git pull
d. git add filename
Answer: a
- What is the command to add multiple files to the staging area?
a. git add .
b. git add *
c. git add filename1 filename2
d. git add -a
Answer: a
- What is the command to view the list of contributors to the repository?
a. git shortlog
b. git branch
c. git log
d. git clone
Answer: a
- What is the command to view the version number of Git?
a. git –version
b. git version
c. git branch
d. git clone
Answer: a
- What is the command to discard changes made to a file?
a. git checkout filename
b. git reset filename
c. git add filename
d. git push
Answer: a
- What is the command to view the list of files in the working directory?
a. ls
b. git ls
c. git list
d. git dir
Answer: a
- What is the command to discard changes made to the entire repository?
a. git reset –hard
b. git revert
c. git add .
d. git push
Answer: a
- What is the command to stash changes without committing them?
a. git stash
b. git reset
c. git revert
d. git push
Answer: a
Latest posts by Ashwani Kumar (see all)
- Top 10 DevOps Trainers in the world - October 7, 2023
- What is Cookies and Why it is Used? - May 24, 2023
- TOP trends of transitions in TikTok - May 10, 2023