git linkedin assessment answers
1. You find that your project has a tag and branch both named push-notifications, which causes confusion when trying to print out a given reference. How can you specify which branch you want to look at?
- Use git show push-notifications.
- Use git show refs/push-notifications.
- Use git show head/refs/push-notifications
- Use git show refs/head/push-notifications
2. What is the difference between using the git stash and git stash pop commands?
- git stash saves changes to multiple branches, while qit stash pop removes a commit from the repo history.
- git stash removes a commit from the repo history, while git stash pop saves changes to multiple branches.
- git stash removes the most recent commit, while git stash pop saves current changes.
- git stash creates a stash entry, while git stash pop places a saved state from the stash list onto the working directory.
3. You would like to restore some previously stashed work to a new branch How can you do that?
- Use qit checkout -b.
- Use git branch <stash hash>.
- Run git stash branch <branch name>.
- Add the stashed commits to the current commit, then create a new branch.
4. You have changed your mind about adding broccoli to your project. How should you remove it?
- git remove
- git clean -f
- git clean
- git remove broccoli
5. Which statement is true of the git push command?
- Tags are pushed to the remote repository with their respective commits.
- Only annotated tags are automatically pushed to the remote repository with a commit.
- By default, a push doesn’t send tags to the remote repository.
- Commits can be tagged only when they are created.
6. After staging a series of changes to the index, which command could you use to review them prior to a commit?
- qit diff –HEAD
- git diff –cached
- qit status -v -v
- qit diff
7. What does the git stash drop command do?
- deletes the stash
- lists everything in the stash
- throws away the oldest stash entry
- removes the most recent stash entry
8. How can you display a list of files added or modified in a specific commit?
- Run git commit –info with the commit hash.
- Use the diff-tree command with the commit hash.
- Find the commit in the remote repository, as that’s the only place where that kind of information is stored.
- Access the commit stash data with git stash.
9. What command creates a new branch from the currently checked-out branch?
- qit checkout -b <nameOfBranch>
- qit -b checkout <nameOfBranch>
- qit branch
- qit checkout <nameOfBranch>
10. Which command correctly creates a lightweight tag?
- qit tag v3.8.1 –annotate -m “<tagMessage>”
- git tag –light “v3.8.1”
- qit tag -1 v3.8.1
- git tag v3.8.1
11. How does Git internally manage branches?
- by creating a debug log that stores repository changes
- by creating a pointer to the most recent snapshot/commit for the branch
- by creating a data array of branches in the same repository
- by creating a data dictionary of code changes
12. You stashed three sets of changes but cannot remember the contents of the first stash entry. What command would you use to see the details of the changes in the first of the three stash entries?
- git stash show -p
- git stash list
- git stash show -p stash@{1}
- git stash show -p stash@{2}
13. How would you create a custom shortcut or command across your Git environment?
- Create an alias using the git config command.
- Assign a shortcut or command using git options file.
- Use the git custom-key command.
- Run git hotfix with the shortcut name.
14. After making some major changes to your code, you are a little nervous about committing. What command would you use to review the commit prior to making it?
- git commit –verify
- git commit –preview
- git commit –dry-run
- qit notes show
15. You want to perform a git reset but cannot recall all of the available options. What command would you use to see a description of them?
- git options reset
- git -h reset
- git help reset
- git reset help