Unit 3: Basic Git - Practice Quiz
1 What is Git primarily classified as?
2 Who originally created Git?
3
In Git, what is the purpose of the .git directory?
4 Which command allows you to configure your username globally in Git?
git global user "Name"
git config --global user.name "Name"
git init user.name "Name"
git set user.name "Name"
5 What are the three main states that files can reside in within Git?
6 Which command moves a file from the 'Modified' state to the 'Staged' state?
git commit
git push
git add
git move
7
What functionality does git clone provide?
8
What is the function of git status?
9 Which command captures a snapshot of the project's currently staged changes?
git record
git snap
git commit
git save
10 How does Git identify the integrity of the objects (commits, files, etc.) stored in its database?
11 Which command is used to view the commit history?
git past
git log
git review
git history
12 What is the default name of the master branch in modern Git installations (standardized to be more inclusive)?
13 Which file is used to specify intentionally untracked files to ignore?
.gitignore
config.ignore
ignore.git
.gitremove
14 What command creates a new branch named 'feature-x'?
git branch feature-x
git checkout feature-x
git create feature-x
git new feature-x
15 Which command is used to switch to an existing branch?
git branch
git move
git checkout
git switch-to
16 How do you create a new branch and switch to it in a single command?
git switch -n <branch_name>
git branch -c <branch_name>
git checkout -b <branch_name>
git checkout --new <branch_name>
17 Which command merges the specified branch's history into the current branch?
git combine
git merge
git fuse
git join
18 What is a 'Fast-forward' merge?
19 What is 'HEAD' in Git?
20 Which command removes a file from the working directory and the staging area?
git delete
git rm
git remove
rm
21 If you want to view the changes between the working directory and the staging area, which command should you use?
git diff
git diff --staged
git status
git log
22 Which command lists all configured remote repositories?
git remote list
git remote show
git config --list-remotes
git remote -v
23 What is the default name Git gives to the server you cloned from?
24 Which command downloads changes from a remote repository but does NOT merge them into your current work?
git clone
git update
git fetch
git pull
25
The command git pull is effectively a combination of which two commands?
git fetch and git rebase
git clone and git merge
git fetch and git merge
git add and git commit
26 Which command is used to upload local branch commits to the remote repository?
git upload
git fetch
git push
git send
27 How do you add a new remote repository named 'upstream'?
git remote new upstream <url>
git add remote upstream <url>
git remote add upstream <url>
git config remote upstream <url>
28 What feature allows you to save unfinished work without committing it, to clean the working directory?
29 Which command would you use to list the stash stack?
git stash list
git stash view
git stash show
git stash log
30
What is the purpose of git tag?
31
What does git reset --soft HEAD~1 do?
32 What is a 'merge conflict'?
33 Which command creates a new commit that applies the inverse of a specified commit (effectively undoing it history-safe)?
git reset
git undo
git delete
git revert
34
What is the output of git log --oneline?
35 When working with a remote, what does 'tracking branch' mean?
36 Which command is used to delete a local branch safely (only if merged)?
git branch -d <branch_name>
git remove <branch_name>
git delete <branch_name>
git branch -D <branch_name>
37 What is the area called where Git stores the changes before they are committed?
38 Which command displays who modified each line of a file and when?
git blame
git inspect
git authors
git who
39 In the Git workflow, what is the best practice before pushing your changes to a shared remote?
40 How do you apply a specific commit from one branch to another without merging the whole branch?
git pick
git cherry-pick
git grab
git select
41
What does the command git init do?
42 If you modify a file that is already tracked, what is its status before staging?
43 Which command would you use to see the commit history of a specific file?
git status <filename>
git log <filename>
git history <filename>
git diff <filename>
44
What is the primary difference between git reset --hard and git reset --mixed (default)?
--hard changes the commit history, --mixed does not.
--hard modifies the working directory, while --mixed keeps working directory changes.
--hard creates a backup, --mixed deletes files.
45 In the context of Git, what is a 'fork'?
46
What happens if you try to git push but your local history is behind the remote history?
47 Which command is used to rename a file in a way that Git records the move?
git mv
git change
mv then git add
git rename
48 What character is used to separate directories in Git internal paths, regardless of the OS?
/
:
\
|
49
Which command creates a specific tag v1.0 with a message?
git label v1.0
git tag v1.0
git create tag v1.0
git tag -a v1.0 -m "Version 1.0"
50
What is the purpose of the git show command?
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →