Worksheetsgit quiz 2
Total questions: 10
Worksheet time: 5mins
Why would you use a pre-receive hook in your remote repository?
To execute a script when a remote receives a push that is triggered before any refs are updated.
To fire a script after updates are made to the remote repository
To debug all commit tags and release versions.
You wouldn't, you would use it in the local repository.
What option can you use to apply git configurations across your entire git environment?
--global
--all
--master
--update
How could you squash multiple commits together without using git merge --squash?
rebasing
you can't. git merge --squash is the only git command for that operation
If you cloned an existing git repository, what would happen?
A copy of the repository would be created on your local machine.
A new copy would overwrite the central repository
A copy of the repository would be created on the hosting platform
Suppose you needed to see a list of all files that had been modified or added to a specific commit over the course of a project. How would you accomplish this?
Use the diff-tree command with the commit hash.
Find the commit in the remote repository, as that's the only place that kind of information is stored.
Run git commit --info with the commit hash.
Access the commit stash data with git stash.
What files is the following .gitignore programmed to leave out?
All files with a .swift, .txt, or metadata file extension, as well as the entire build directory.
Only the build directory
All files in the build directory, as well as files ending with .txt or .metadat
Only files with .swift and .txt extensions.
After you make changes to a tracked file, you run the following command. What does this command do?
git commit -a -m "refactor code base"
Add all modified files to the staging area, then commits them with a message.
commits all new files with a message
adds all new files to the staging area
Nothing, you can't use multiple options in the same command.
After checking your git status you get the following output, which shows the file bet-notes.js in the commit but also unstated. How can this situation occur?
change to be committed:
(use "git reset HEAD <file> ..." to un-stage)
modified: beta-notes.js
Changes not staged for commit:
(use "git add <file>.." to update what will be committed)
(use "git checkout --<file>..." to discard changes in working directory)
modified: beta-notes.js
beta notes.js was staged, then modified afterwards, creating two different versions of the file
there were two copies of beta-notes.js but one was deleted.
two copies of beta-notes.js were created, but only one is being tracked.
there are two tracked copies of beta-notes.js, but one was removed from the commit.
Where are files stored before they are committed to the local repository?
Staging area
git documents
git cache
saved files
Which statement is true with git push command.
all tags are pushed to the remote
just one pushed to the remote.
