0% found this document useful (0 votes)
5 views7 pages

Git Commands and Version Control Basics

The document contains a series of questions and answers related to Git commands and concepts in Distributed Version Control Systems. It covers topics such as staging files, committing changes, merging branches, and the purpose of version control. Each question is accompanied by the correct answer and a reference page number for further reading.

Uploaded by

harissiddiqui235
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Git Commands and Version Control Basics

The document contains a series of questions and answers related to Git commands and concepts in Distributed Version Control Systems. It covers topics such as staging files, committing changes, merging branches, and the purpose of version control. Each question is accompanied by the correct answer and a reference page number for further reading.

Uploaded by

harissiddiqui235
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Distributed Version Control (ACCP-7144)

Q.1. Which Git command would you use to stage only modified files in the current directory,
excluding new files?

A. git add -u B. git stage-modified

C. git add -m D. git update

Correct Answer:
Reference: Pg . 25

Q.2. You accidentally committed a file with sensitive information to your repository. What is the best
course of action to remove it from the commit history?

A. git revert B. git reset --soft

C. git filter-branch --tree-filter D. git stash

Correct Answer:
Reference: Pg. 38

Q.3. What advantage does a Distributed Version Control System (DVCS) such as Git offer over a
Centralized Version Control System (CVCS)?

A. Centralized management of changes B. Full repository history on each client

C. Simplified setup and configuration D. No requirement for collaboration tools

Correct Answer:
Reference: Pg. 10 (Heading Benefits)

Q.4. After working on a branch for a while, you want to see the changes you've made compared to
the current state of the branch before staging them. Which command should you use?

A. git log B. git diff

C. git status D. git fetch

Correct Answer:
Reference: Pg. 28 (Heading git diff)

Page 1 of 7
Distributed Version Control (ACCP-7144)

Q.5. What is the primary purpose of a Version Control System (VCS)?

B. To track and manage changes to software


A. To improve computer performance
code

C. To enhance graphic design capabilities D. To secure computer networks

Correct Answer:
Reference: Pg. 5 (Heading Introduction to VCS)

Q.6. Which type of VCS allows each client to have a full copy of the repository?

A. Local Version Control Systems (LVCS) B. Centralized Version Control Systems (CVCS)

C. Distributed Version Control Systems (DVCS) D. Networked Version Control Systems (NVCS)

Correct Answer:
Reference: Pg. 7 (Heading 3)

Q.7. What command is used to initialize a new Git repository in a Local directory?

A. git start B. git init

C. git clone D. git Create

Correct Answer:
Reference: Pg. 23 , 24

Q.8. What is a commit in Git?

B. A snapshot of the repository at a specific


A. A new branch creation
point in time

C. A process to merge two branches D. A method to clone a repository

Correct Answer:
Reference: Pg. 26 (Heading git commit)

Page 2 of 7
Distributed Version Control (ACCP-7144)

Q.9. Which of the following commands is used to clone an existing repository from GitHub?

A. git pull <repository-url> B. git clone <repository-url>

C. git fetch <repository-url> D. git copy <repository-url>

Correct Answer:
Reference: Pg. 24

Q.10. Identify the branching strategy that is typically used to quickly address critical issues in the
production environment.

A. Feature Branching B. Release Branching

C. Hotfix Branching D. Development Branching

Correct Answer:
Reference: Pg. 54 (Heading Hotfix Branching)

Q.11. What is a fast-forward merge in Git?

A. A merge where conflicts are automatically B. A merge where the base branch pointer is
resolved moved forward to match the target branch

D. A merge that discards changes from one of


C. A merge that involves creating a new commit
the branches

Correct Answer:
Reference: Pg. 56 (Heading merging strategies)

Q.12. Which command is used to display all branches in a Git repository?

A. git show-branch B. git branch -a

C. git checkout -b D. git log –branches

Correct Answer:
Reference: Pg. 28 , 29

Page 3 of 7
Distributed Version Control (ACCP-7144)

Q.13. What is the significance of meaningful commit messages in version control?

B. They serve as documentation helping


A. They improve code performance
understand the codebase

C. They increase network security D. They enhance graphic rendering capabilities

Correct Answer:
Reference: Pg. 6

Q.14. Which command updates the main branch with the latest changes from the remote repository
before merging?

A. git fetch B. git merge

C. git pull D. git rebase

Correct Answer:
Reference: Pg. 31(Heading Use of git pull)

Q.15. If you want to see a log of all the commits on the current branch, which command would you
use?

A. git log --oneline B. git commits

C. git history --list D. git status –log

Correct Answer:
Reference: Pg. 27

Q.16. What does the 'git add .' command do?

A. Stages all changes in the current directory B. Stages only newly created files in the current
and its subdirectories for the next commit directory

C. Adds all files to a new branch D. Clones a repository into the current directory

Correct Answer: A
Reference: Pg. 32

Page 4 of 7
Distributed Version Control (ACCP-7144)

Q.17. What is the function of the 'git push' command?

B. To upload local repository changes to a


A. To save changes to the local repository
remote repository

D. To merge changes from the remote


C. To create a new branch in the local repository
repository into the local branch

Correct Answer:
Reference: Pg. 32

Q.18. Which command is used to create a new branch in Git?

A. git checkout B. git clone

C. git branch D. git commit

Correct Answer:
Reference: Pg. 28 , 29

Q.19. What is the purpose of branching in Git?

A. Integrate changes from multiple branches B. Resolve merge conflicts

C. Allow independent development of features


D. Delete outdated branches
or fixes

Correct Answer:
Reference: Pg. 40

Q.20. Which of the following commands in Git is used to list all branches in a repository?

A. git list-branches B. git branch

C. git show-branches D. git display-branches

Correct Answer:
Reference: Pg. 29

Page 5 of 7
Distributed Version Control (ACCP-7144)

Q.21. What is the purpose of the '.git' directory created by the 'git init' command?

A. It stores the entire history of changes and


B. It holds the working files of the project
configurations for the repository

D. It stores the temporary files generated


C. It contains the list of remote repositories
during commits

Correct Answer:
Reference: Pg. 24

Q.22. Which command would you use to delete a branch named 'feature' in Git?

A. git branch -r feature B. git remove-branch feature

C. git delete-branch feature D. git branch -d feature

Correct Answer:
Reference: Pg. 29

Q.23. What role does the 'fetch' command play in Git's workflow?

A. It merges changes from a remote repository B. It downloads updates from a remote


into the local repository repository without merging them

C. It creates a new branch from an existing one D. It commits changes to the local repository

Correct Answer:
Reference: Pg. 44

Q.24. Which command should be used to see differences between the latest commit and the current
working directory?

A. git show B. git diff HEAD

C. git compare D. git status –diff

Correct Answer:
Reference: Pg. 28

Page 6 of 7
Distributed Version Control (ACCP-7144)

Q.25. After making some changes, you decide to see the difference between your current working
directory and the last commit. Which Git command should you use?

A. git compare B. git diff

C. git status D. git log

Correct Answer:
Reference: Pg. 28

Q.26. What is a repository in the context of Version Control Systems such as Git?

A. A snapshot of changes at a specific point in B. A storage space where a project and its
time history of changes are kept

C. A separate line of development within a D. A process of switching between different


project branches

Correct Answer:
Reference: Pg. 8

Page 7 of 7

You might also like