linkedin-skill-assessments-quizzes

Git

Q1. How can you check your current git version?

Reference

Q2. What command lets you create a connection between a local and remote repository?

Reference

Q3. Describe what these Git commands do to the commit history:

git reset --hard HEAD~5
git merge --squash HEAD@{1}

Explanation:

Reference

Q4. Your current project has several branches; master, beta, and push-notifications. You’ve just finished the notification feature in the push-notification branch, and you want to commit it to beta branch. How can you accomplish this?

Reference

Q5. Which of the following is true when you use the following command?

git add -A

Reference Reference

Q6. What will the following command print to the Terminal?

git remote -v

Reference Reference

Q7. Looking at the following commands, describe what is happening.

git checkout feature-user-location
git cherry-pick kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231

Explanation:

‘git checkout feature-user-location’ switches to the ‘feature-user-location’ branch. ‘git cherry-pick kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231’ applies the changes from the specified commit (‘kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231’) to the current branch (feature-user-location). This effectively copies the commit from its original branch to the feature-user-location branch. So, this sequence of commands is cherry-picking a specific commit onto the feature-user-location branch.

Q8. What does the following command do to the git repository?

git reset --soft HEAD^

Reference Reference

Q9. You find a bug in your project, but can’t locate where it was introduced in the commit history. How would you diagnose this problem?

Reference Reference

Q10. Why would the following command be used?

git rebase -i HEAD~10

Reference Reference

Q11. Why would you use a pre-receive hook in your remote repository?

Reference Reference

Q12. What option can you use to apply git configurations across your entire git environment?

Reference Reference

Q13. How could you squash multiple commits together without using git merge --squash?

Reference Reference

Q14. If you cloned an existing git repository, what would happen?

Reference Reference

Q15. How can you display a list of files added or modified in a specific commit?

Reference Reference

Q16. What files is this .gitignore programmed to leave out?

#.swift
build/

*.txt
*.metadata

Reference

A line starting with # serves as a comment. Hence # .swift does not do anything. See man gitignore.

Q17. After you make changes to a local repository, you run the following command. What will this do?

git commit -a -m "Refactor code base"

Q18. After checking your git status you get the following output, which shows the file beta-notes.js in the commit but also unstaged. How can this situation occur?

Change to be committed:

(use "git reset HEAD <file>..." to unstage)
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

Reference

Q19. Where are files stored before they are committed to the local repository?

Reference

Q20. What commands would you use to force an overwrite of your local files with the master branch?

  git pull --all
  git reset --hard origin/master
  git pull -u origin master
  git reset --hard master
  git pull origin master
  git reset --hard origin/myCurrentBranch
  git fetch --all
  git reset --hard origin/master

Note: - The command pull is fetch followed by either merge or rebase (in this case, merge). We don’t want to merge. Merge would be an action to our repository. We just want to overwrite our local files.

Q21. You find that your project has a tag and branch both named push-notifications, which causes confusion when trying to print out given reference. How can you specify which branch you want to look at?

Reference

Q22. Your team lead needs a list of all commits that will be moved before you perform a rebase. Which command can you use to access that information?

Q23. What is the operation doing given the Git commands below?

git bisect start
git bisect bad 5d41402abc4b2a76b9719d911017c592
git bisect good 69faab6268350295550de7d587bc323d

Q24. In a situation where you have several commits for a single task, what is the most efficient way to restructure your commit history?

Reference

Q25. Which of the following is true of the git push command?

Note: Which statement is true of the git push command?

Reference

Q26. After pushing commits to the remote repository for the first time using the command below, what shorthand command can you use in future?

git push -u origin master

Reference

Q27. How would you create a custom shortcut or command across your Git environment?

Reference

Q28. What is the status of the beta-notes.js file in the following output?

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

Reference

Q29. What command would let you modify your previous commit?

Reference

Q30. What is the best way to characterize the git commit structure?

Reference

Q31. What change will the following command make to the staging area files?

git rm --cached testfile.js

Reference

Q32. After you’ve successfully merged two branches and committed the changes, what is the next step in keeping your git structure organized?

Reference

Q33. While modifying a file, you’re unexpectedly assigned an urgent bug fix on another branch. How can you temporarily save your local work without committing?

Reference

Q34. What command would you use to create a new git repository?

Reference

Q35. While working on a feature branch you try to use “git rerere” to solve a recurring merge conflict but nothing is happening. What could be causing this issue?

Reference

Q36. Which setting determines what pager is used when Git pages output?

Q37. What does commit object contain?

Q38. Which option enables inclusion of committer name in custom log format?

Reference

Q39. How many ways are present in Git to integrate changes from one branch into another?

Q40. Which user should be created first during setting up of SSH?

note: The question is not specific enough to give a definitive answer, as it depends on the specific use case and configuration of the SSH setup.

Q41. Which command will list tags with the 1.4.2 series?

Q42. Which of the following is an integration manager?

Q43. Which Git command begins tracking of a new file?

Reference

Q44. Which of the following is called dumb protocol?

Reference

Q45. Which key press returns a set of suggestions to pick from, when writing a Git command?

Q46. Which of these terms best describes Git?

Reference

Q47. How does Git think of its data?

Reference

Q48. Which option enables inclusion of author name in custom log format?

Q49. Which version onwards did Git offer reversing a file back to what it looked like when last committed?

Q50. Which strategy is used by Git for merging two branches?

Q51. What does refs store?

Reference

Q52. What Language is used in GIT?

Q53. What is usually the extension of file which has the public key?

Reference

Q54. What is the difference between initializing a normal repo and a bare repo?

Q55. How many individual commits can a single repository have?

Q56. What types of tags does Git support?

Reference

Q57. After staging a series of changes to the index, which command could you use to review them prior to a commit?

Q58. What does the git stash drop command do?

Reference

Q59. What command creates a new branch from the currently checked-out branch?

Q60. After mistakenly staging a file named myFile to the index, how would you remove it from the index to exclude it from your next commit?

Q61. What happens if you run this command from your master branch?

git checkout -b beta-test

Q62. How does Git internally manage branches?

Q63. 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?

Q64. What is a remote repository?

Q65. After modifying some existing files in a repository, you decide to discard the changes. What command can you use?

Q66. After starting to merge a feature branch into your master branch, you encounter a merge conflict and decide you do not want to perform the merge. How can you stop the merge and restore to the pre-merge state?

Q67. Which command correctly creates a lightweight tag?

Q68. What is the main issue with using git rebase when working with multiple developers?

Q69. What Git workflow is used by teams that collaborate on a single branch and avoid creating long-lived development branches?

Q70. Which option on the git log command allows you to limit output to commits made after certain date?

Q71. How would you delete unreachable objects older than a specified time from your project database?

Q72. What conflicts can occur when forcing a push after rebasing?

Q73. What is the difference between Git and SVN?

Q74. This command is an example of what kind of tag?

git tag -a v1.4 -m "ABCD v1.5"

Q75. What is the difference between a soft reset (git reset --soft) and a hard reset (git reset –hard) ?

Reference

Q76. Consider the following Git workflow:

image Which of the following options is correct ?

Q77. What information does the git config file store?

Reference

Q78. What is version control?

Q79. What is the difference between using the git stash and git stash pop commands?

Q80. Which command can be used to list the branches that have been merged into the currently checked-out branch?

Q81. How would you configure Git to abort a commit if a smoke test script fails?

Q82. Which use case is NOT a good candidate for a Git hook?

Q83. What information do Git reflogs (reference logs) store?

Q84. You have just completed rebasing your master branch and need to manually update the remote master, even though there is a merge conflict. How can you accomplish this?

Q85. What is the difference between git fetch and git pull

Q86. What command displays the difference between the working tree and the stage/index area, as well as files not tracked by Git?

Q87. You would like to restore some previously stashed work to a new branch. How can you do that?

reference here

Q88. What is the difference between git branch -d and git branch -D?

Q89. 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?

reference here

Q90. How would you delete a remote branch in your repository?

reference here

Q91. What is the default setting of git reflog when no subcommands are specified?

reference here

Q92. How does the -p option change the behavior of the git add command

reference here

Q93. After checking out a specific commit, you receive a warning message indicating You are in ‘detached HEAD’ state. What is Git warning you of?

reference here

Q94. After accidentally deleting a branch in your local repository, how can you recover it?

Reference

Q95. How would you display a histogram showing inserts, deletion, and modifications per file for a specific commit along with its general commit information?

Reference

Q96. What features do repository managers such as GitHub provide beyond Git?

reference

Q97. What command finds the HEAD of the current branch?

reference

Q98. When Git Workflows contain a long-running branch, what purpose does the long-running branch serve?

Note: master is not a short-lived branch, as answer “C” states. Answer “D” is the correct one. Reference

Q99. What command takes changes from the master branch on the remote repository origin and merges then to the local checked-out branch?

Q100. While pushing changes to a remote repository, you receive the following message. How do you resolve this issue?

error: failed to push some refs to 'https://github.com/myrepo/simple.git'
hint: Updates were rejected because the remote contains work that you do not hint: not have locally.

Q101. What does the -p option add to the output of the git log command?

Q102. What is the staging area or index?

Reference

Q103. What command would you use to stage changes to the index strictly for properties files in the current directory?

Q104. What are untracked files?

Reference

Q105. What type of Git hook could be used to validate that a commit message contains a ticket number?

Q106. What is the difference between git stash pop and git stash apply?

Q107. 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?

Q108. What statement best describes Git’s concept of HEAD?

Q109. After staging changes to several files, you realize the changes to the config.properties file are incorrect, and need to be removed from the stage and working directory. What command can you use to remove the staged changes to the file?

Q110. After a recent release with a stack trace, an issue is create that indicates the problem is with a newly added configuration property named MaxConnections. What command can find all commits that add or remove the string MaxConnections?

Q111. Your company has moved its remote repository to GitHub at this location: https://github.com/yourcompany/core-api.git. What command updates the remote repository, named origin, to point to the new remote repository at this location?

Q112. When is the cherry-pick command used?

reference

Q113. How would you describe a forked repository?

reference reference

Q114. How can you exclude untracked files within the working directory from a Git repository?

reference

Q115. What command creates a near-exact copy of the entire repository from a server?

Reference

Q116. What would happen if you ran the git reset testfile.js command?

reference

Q117. What situation can occur when attempting to combine branches containing changes to the same piece of code?

Q118. When Git workflows contain a topic branch, what purpose does the topic branch serve?

Q119. What practice can help reduce the chances of encountering a merge conflict?

Q120. What command can you use to remove untracked files from the working directory?

Note: In Git, when multiple short options are used together, you can combine them into a single option by omitting the space between them. So, git clean -d -f can be combined as git clean -df.

Q121. After making a commit, you notice that you forgot to include changes to the doge.txt file. What command or commands would you use to add the changes to the commit?

  git add doge.txt
  git commit --amend --no-edit
  git commit --amend --no-edit
  git add doge.txt
  git commit --patch --no-edit
  git commit --patch --no-edit

Q122. Which command would remove a file named wrongfile from the current branch of a repository, the index, and working files?

git rm wrongfile
git commit -m "Removed file"
  git forget -rf wrongfile
  git commit -m "Removed file"
  git untrack -rf wrongfile
  git commit -m "Removed file"
  git rm --cached wrongfile
  git commit -m "Removed file"

Reference

Q123. What is the best way to report a bug to a GitHub project?

Explanation: A project’s issues are visible to anyone who has access to the project, so you may find a resolution is already planned or available. Otherwise, you can create and track the issue yourself.

Q124. Suppose you have created a bug fix on a new branch and want it to become part of the next production build generated from the main branch. What should you do next?

Explanation: Pull requests are the correct way to communicate that commits are ready for review and ultimate inclusion on the main branch.

Q125. What is GitHub?

Q126. Git Pull is a combination of?

Reference

Q127. What is the command to set the user email for the current repository?

Reference

Q128. _ will rewind your project to a specific point in time, losing all commits that came after it. _ will keep changes in those rewound commits as local modifications

Q129. Explain the concept of “Git blame” and when it is used in a version control workflow.

Reference

Q130. What is the purpose of C++ move constructor, and when is it automatically generated?

Q131. You have changed your mind about adding broccoli to your project. How should you remove it?

Untracked files:
(use "git add <file>..." to include in what will be committed)
broccoli

Reference

Q132. You’re creating an action for the Github marketplace. why is it importance to create a release?

Q133. You’re looking at a repository page and click a folder name to open it. You have code search on, so you land in the code view. What is the quickest way to find a file on a path in your repo?

Q134. How do you save a search that you use often using GitHub?

Q135. which of these is not a label that github creates by default?

Q136. What is the fastest way to start a search using Github web pages?

Q137. Assigning an issue to a person implies that they ____.

Q138. What does a Template repository do?

Q139. You’re creating an action for the GitHub Marketplace. Why is it important to create a release?

Q140. What are two ways to help Copilot give you more accurate suggestions?

Q141. What is the main purpose of the Chat panel?

Q142. While doing a code review, you want to start an issue by highlighting a function that takes up several lines of code. What is the fastest way to do this in code view?

Q144. You’re organizing a desktop application project. You want to use an overview f your project statuses and be able to drag and drop issues. Which view would you use?

Q145. You’re in the repo for a specific project while working on an app module. You want to look for some of the docs you’ve been working on, which you wrote in markdown. To quickly look in your own repo for all files with a markdown extension, press the slash (/) button on the keyboard while on the repository page and type ___.

Q146. In GitHub Projects, how can you assign an issue to a collaborator?

Q147. Why should you include a descriptive function name when writing code with Copilot?

Q148. You are working on a project that uses a Python library and you want to find an example of how to use a function across all public repositories. Which part of GitHub’s platform would you use?

Q149. Working late on a project, you need to find an issue that was assigned to you. What query do you type?

Q150. you are working on an AI app and need to add information on project tables about the AI model being targeted. What feature allows you to do this?

Q151. What feature does the shortcut /table activate when used inside a GitHub comment section?

Q152. How can you get better suggestions when creating functions?

Q153. What does the RUN command do in a Dockerfile?

Q154. How can you ensure that you are matching an exact combination of words?

Q155. What is the main function of the Entrypoint instruction in a Dockerfile?

Q156. Inside a GitHub action, which keyword do you use to specify the operating system to run jobs?

Q157. How can you get additional context from other files in your code?