Basic Git Questions
Level : Beginner
Which files should we usually ignore in a version control system?
- A. Files that contain secret tokens, personal preferences, or editor settings
- B. Files that are binary, such as executables, images, and videos
- C. Files that contain personal preferences and application configurations
- D. We should track all files in the Git version control system.
Answer is : A
Secret we do not send to the git
How can we keep an empty folder in a Git repository?
- A. By setting a configuration in Git to track folders
- B. By creating a blank hidden file in the target folder
- C. By running the
git status
command - D. By adding more commits
Answer is : B
show lessWhere does Git store the repository for each project?
- A. In the home directory
- B. In a remote server
- C. In the
.git
folder in each working project folder - D. In Git’s application folder
Answer is : C
Show lessWhat does the git add command do?
- A. It stores the changes in the repository.
- B. It marks the changes that will be added in the next commit.
- C. It unstages the changes
- D. It commits partial changes in the repository.
Answer is : B
show lessHow can we delete the entire Git history?
- A. $ git rm -fr
- B. $ git push -f
- C. $ rm -fr .git
- B. $ rm -am .git
Answer is : C
show lessWhy don’t we always use git commit -am
?
- A. Using
git add
andgit commit
separately allows us to commit all file changes into the version control system. - B. The
git status
command is a quick, one-line operation for committing current changes. - C. Separating
git add
andgit commit
allows developers to carefully review the changes before committing. - D. The
git commit -am
command allows committing changes without providing a commit message.
Answer is : C
show lessHow can we stage untracked changes in Git?
- A. git add <filename>
- B. $ git track <filename>
- C. $ git commit <filename>
- D. $ git stage <filename>
Answer is : A
show lessHow can we view a clear branch history in the git log
command to get an overview of the commit history?
- A. $ git log –oneline –graph
- B. $ git log –oneline
- C. $ git log –graph
- D. $ git log –decorate
Answer is : A
show less