1. 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?
Answer
Correct Answer:
- git log -S "MaxConnections"
Note: This Question is unanswered, help us to find answer for this one
2. After staging changes to several files, you realize the changes to the confin.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?
Answer
Correct Answer:
Git rm config.properties
Note: This Question is unanswered, help us to find answer for this one
3. What statement best describes Git's concept of HEAD?
Answer
Correct Answer:
A pointer to the most recent commit in the currently checked-out branch
Note: This Question is unanswered, help us to find answer for this one
4. 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?
Answer
Correct Answer:
Git commit --dry-run
Note: This Question is unanswered, help us to find answer for this one
5. What is the difference between git stash pop and git stash apply?
Answer
Correct Answer:
Git stash pop applies the topmost entry in the stash to the working files and removes it from the stash, while git stash apply applies the topmost entry in the stash to the working files but leaves it in the stash.
Note: This Question is unanswered, help us to find answer for this one
6. What type of Git hook could be used to validate that a commit message contains a ticket number?
Answer
Correct Answer:
Commit-msg
Note: This Question is unanswered, help us to find answer for this one
7. What command takes changes from the master branch on the remote repository origin and merges them to the local checked-out branch?
Answer
Correct Answer:
Git pull origin master
Note: This Question is unanswered, help us to find answer for this one
8. What are untracked files?
Answer
Correct Answer:
Files in the working directory that Git does not know about because the have not been staged or committed
Note: This Question is unanswered, help us to find answer for this one
9. What command would you use to stage changes to the index strictly for properties files in the current directory?
Answer
Correct Answer:
Git add *.properties
Note: This Question is unanswered, help us to find answer for this one
10. What is the staging area or index?
Answer
Correct Answer:
An area that stores information about changes that will be included in the next commit
Note: This Question is unanswered, help us to find answer for this one
11. What does the -p option add to the output of the git log command?
Answer
Correct Answer:
It adds patch output that shows a summary listing modified files.
Note: This Question is unanswered, help us to find answer for this one
12. What command takes changes from the master branch on the remote repository orgin and merges then to the local checked-out branch?
Answer
Correct Answer:
Git pull origin master
Note: This Question is unanswered, help us to find answer for this one
13. When Git Workflows contain a long-running branch, what purpose does the long-running branch serve?
Answer
Correct Answer:
Long-running branches correspond to different stages of development and are allways open for topic/feature branches to be pulled into.
Note: This Question is unanswered, help us to find answer for this one
14. What command finds the HEAD of the current branch?
Answer
Correct Answer:
Git show-ref --head
Note: This Question is unanswered, help us to find answer for this one
15. What features do repository managers such as GitHub provide beyond Git?
Answer
Correct Answer:
Repository managers provide an online service for hosting Git repositories that include collaboration features such as pull requests, issue tracking, and peer reviews.
Note: This Question is unanswered, help us to find answer for this one
16. How would you display a histogram showing inserts, deletion, and modifications per file for a specific commit along with its general commit information?
Answer
Correct Answer:
Use git show --stat.
Note: This Question is unanswered, help us to find answer for this one
17. After accidentally deleting a branch in your local repository, how can you recover it?
Answer
Correct Answer:
Find the hash of the branch with the reflog command, then execute git checkout -b .
Note: This Question is unanswered, help us to find answer for this one
18. After checking out a specific commit, you receive a warning message indicating You are in 'detached HEAD' state. What is Git warning you of?
Answer
Correct Answer:
You are not working on the most recent commit of a branch.
Note: This Question is unanswered, help us to find answer for this one
19. How does the -p option change the behavior of the git add command
Answer
Correct Answer:
It allows developers to interactively choose which changes to tracked files are staged and outputs the differences for review.
Note: This Question is unanswered, help us to find answer for this one
20. What is the default setting of git reflog when no subcommands are specified?
Answer
Correct Answer:
Show
Note: This Question is unanswered, help us to find answer for this one
21. How would you delete a remote branch in your repository?
Answer
Correct Answer:
Use git push --delete .
Note: This Question is unanswered, help us to find answer for this one
22. Which statement is true of the git push command?
Answer
Correct Answer:
By default, a push doesn't send tags to the remote repository.
Note: This Question is unanswered, help us to find answer for this one
23. 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?
Answer
Correct Answer:
Git stash show -p stash@{2}
Note: This Question is unanswered, help us to find answer for this one
24. What is the difference between git branch -d and git branch -D?
Answer
Correct Answer:
-d deletes the local branch, while -D deletes the local branch regardless of push and merge status.
Note: This Question is unanswered, help us to find answer for this one
25. You would like to restore some previously stashed work to a new branch. How can you do that?
Answer
Correct Answer:
Run git stash branch .
Note: This Question is unanswered, help us to find answer for this one
26. Your current repository has three branches: master, beta, and push-notifications. You have just finished the notification feature and commit the changes to the push-notification branch, and you want to include them in the beta branch. How can you accomplish this?
Answer
Correct Answer:
Check out the beta branch and run git merge push-notifications.
Note: This Question is unanswered, help us to find answer for this one
27. What command displays the difference between the working tree and the stage/index area, as well as files not tracked by Git?
Answer
Correct Answer:
Git status
Note: This Question is unanswered, help us to find answer for this one
28. What is the difference between git fetch and git pull
Answer
Correct Answer:
Git fetch updates remote tracking branches with changes from a remote repository, while git pull updates remote tracking branches with changes from a remote repository and merges them into their corresponding local branches.
Note: This Question is unanswered, help us to find answer for this one
29. 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?
Answer
Correct Answer:
Git push --force-with-lease
Note: This Question is unanswered, help us to find answer for this one
30. What information do Git reflogs (reference logs) store?
Answer
Correct Answer:
Updates to branch tips and other references in the local repository
Note: This Question is unanswered, help us to find answer for this one
31. After starting to work on a new feature and creating new files in the working directory related to it, the customer determined the feature was no longer required. What command can be used to remove the untracked files from the working directory ?
Answer
Correct Answer:
Git clean -f
Note: This Question is unanswered, help us to find answer for this one
32. How would you configure Git to abort a commit if a smoke test script fails?
Answer
Correct Answer:
Create a pre-commit hook to trigger the script.
Note: This Question is unanswered, help us to find answer for this one
33. Which command can be used to list the branches that have been merged into the currently checked-out branch?
Answer
Correct Answer:
Git branch --merged
Note: This Question is unanswered, help us to find answer for this one
34. What is the difference between using the git stash and git stash pop commands?
Answer
Correct Answer:
Git stash creates a stash entry, while git stash pop places the saved state onto the working directory.
Note: This Question is unanswered, help us to find answer for this one
35. What is version control?
Answer
Correct Answer:
A system that shows, tracks, and controls changes to a set of files over time
Note: This Question is unanswered, help us to find answer for this one
36. What information does the git config file store?
Answer
Correct Answer:
Local and global repository options
Note: This Question is unanswered, help us to find answer for this one
37. What is the difference between a soft reset (git reset --soft) and a hard reset (git reset –hard) ?
Answer
Correct Answer:
A soft reset only changes the commit that HEAD points to, while a hard reset resets the index and working tree to match the specified commit, discarding any changes.
Note: This Question is unanswered, help us to find answer for this one
38. This command is an example of what kind of tag? git tag -a v1.4 -m "ABCD v1.5"
Answer
Correct Answer:
Annotated
Note: This Question is unanswered, help us to find answer for this one
39. What is the difference between Git and SVN?
Answer
Correct Answer:
SVN is a centralized system, while Git is a distributed system.
Note: This Question is unanswered, help us to find answer for this one
40. How does this command alter the currently checked-out branch? git reset --soft HEAD^
Answer
Correct Answer:
It sets HEAD to previous commit and leaves changes from the undone commit in the stage/index.
Note: This Question is unanswered, help us to find answer for this one
41. What conflicts can occur when forcing a push after rebasing?
Answer
Correct Answer:
The remote master branch could have existing changes overwritten.
Note: This Question is unanswered, help us to find answer for this one
42. How would you delete unreachable objects older than a specified time from your project database?
Answer
Correct Answer:
Git prune --expire
Note: This Question is unanswered, help us to find answer for this one
43. Which option on the git log command allows you to limit output to commits made after certain date?
Answer
Correct Answer:
--since
Note: This Question is unanswered, help us to find answer for this one
44. What Git workflow is used by teams that collaborate on a single branch and avoid creating long-lived development branches?
Answer
Correct Answer:
Trunk-Based Development
Note: This Question is unanswered, help us to find answer for this one
45. What is the main issue with using git rebase when working with multiple developers?
Answer
Correct Answer:
Rebase deletes all commit history for the new feature branch.
Note: This Question is unanswered, help us to find answer for this one
46. Which command correctly creates a lightweight tag?
Answer
Correct Answer:
Git tag v3.8.1
Note: This Question is unanswered, help us to find answer for this one
47. If you have several commits for a single feature, what is the most efficient way to restructure your commit history?
Answer
Correct Answer:
Use git squash to consolidate the commits together into a single coherent commit.
Note: This Question is unanswered, help us to find answer for this one
48. 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?
Answer
Correct Answer:
Use git merge --abort.
Note: This Question is unanswered, help us to find answer for this one
49. After modifying some existing files in a repository, you decide to discard the changes. What command can you use?
Answer
Correct Answer:
Git restore
Note: This Question is unanswered, help us to find answer for this one
50. What is a remote repository?
Answer
Correct Answer:
A version of the repository hosted on the internet or network that is pushed to or pulled from by collaborators
Note: This Question is unanswered, help us to find answer for this one
51. 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?
Answer
Correct Answer:
Git help reset
Note: This Question is unanswered, help us to find answer for this one
52. How does Git internally manage branches?
Answer
Correct Answer:
By creating a pointer to the most recent snapshot/commit for the branch.
Note: This Question is unanswered, help us to find answer for this one
53. What happens if you run this command from your master branch? git checkout -b beta-test
Answer
Correct Answer:
A new branch called beta-test will be created and switched to.
Note: This Question is unanswered, help us to find answer for this one
54. 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?
Answer
Correct Answer:
Use git reset myFile.txt.
Note: This Question is unanswered, help us to find answer for this one
55. What command creates a new branch from the currently checked-out branch?
Answer
Correct Answer:
Git checkout -b
Note: This Question is unanswered, help us to find answer for this one
56. What does the git stash drop command do?
Answer
Correct Answer:
Removes the most recent stash entry
Note: This Question is unanswered, help us to find answer for this one
57. After staging a series of changes to the index, which command could you use to review them prior to a commit?
Answer
Correct Answer:
Git diff --cached
Note: This Question is unanswered, help us to find answer for this one
58. What types of tags does Git support?
Answer
Correct Answer:
Lightweight and annotated
Note: This Question is unanswered, help us to find answer for this one
59. How many individual commits can a single repository have?
Answer
Correct Answer:
Any number of commits
Note: This Question is unanswered, help us to find answer for this one
60. What is the difference between initializing a normal repo and a bare repo?
Answer
Correct Answer:
Bare repos do not come with working or checked-out source files.
Note: This Question is unanswered, help us to find answer for this one
61. What is usually the extension of file which has the public key?
Answer
Correct Answer:
Pub
Note: This Question is unanswered, help us to find answer for this one
62. What Language is used in GIT?
Answer
Correct Answer:
C
Note: This Question is unanswered, help us to find answer for this one
63. What does refs store?
Answer
Correct Answer:
SHA-1 value
Note: This Question is unanswered, help us to find answer for this one
64. Which strategy is used by Git for merging two branches?
Answer
Correct Answer:
Recursive
Note: This Question is unanswered, help us to find answer for this one
65. Which version onwards did Git offer reversing a file back to what it looked like when last committed?
Answer
Correct Answer:
1.6
Note: This Question is unanswered, help us to find answer for this one
66. Which option enables inclusion of author name in custom log format?
Answer
Correct Answer:
%an
Note: This Question is unanswered, help us to find answer for this one
67. How does Git think of its data?
Answer
Correct Answer:
Snapshot
Note: This Question is unanswered, help us to find answer for this one
68. Which command gets a copy of an existing Git repository?
Answer
Correct Answer:
Clone
Note: This Question is unanswered, help us to find answer for this one
69. Which of these terms best describes Git?
Answer
Correct Answer:
Distributed Version Control System
Note: This Question is unanswered, help us to find answer for this one
70. Which key press returns a set of suggestions to pick from, when writing a Git command?
Answer
Correct Answer:
Tab
Note: This Question is unanswered, help us to find answer for this one
71. Which of the following is called dumb protocol?
Answer
Correct Answer:
HTTP
Note: This Question is unanswered, help us to find answer for this one
72. Which Git command begins tracking of a new file?
Answer
Correct Answer:
Add
Note: This Question is unanswered, help us to find answer for this one
73. Which of the following is an integration manager?
Answer
Correct Answer:
Benevolent dictator
Note: This Question is unanswered, help us to find answer for this one
74. Which command will list tags with the 1.4.2 series?
Answer
Correct Answer:
Git tag -I 'v1.4.2.*'
Note: This Question is unanswered, help us to find answer for this one
75. Which user should be created first during setting up of SSH?
Answer
Correct Answer:
Git
Note: This Question is unanswered, help us to find answer for this one
76. How many ways are present in Git to integrate changes from one branch into another?
Answer
Correct Answer:
2
Note: This Question is unanswered, help us to find answer for this one
77. What does commit object contain?
Answer
Correct Answer:
An SHA1 name, a 40-character string that uniquely identifies the commit object.
Note: This Question is unanswered, help us to find answer for this one
78. Which setting determines what pager is used when Git pages output?
Answer
Correct Answer:
Core.pager
Note: This Question is unanswered, help us to find answer for this one
79. 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?
Answer
Correct Answer:
"rerere.enabled" isn't enable in the config file.
Note: This Question is unanswered, help us to find answer for this one
80. What command would you use to create a new git repository?
Answer
Correct Answer:
Git init
Note: This Question is unanswered, help us to find answer for this one
81. 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?
Answer
Correct Answer:
Use git stash to save your work and come back later and reapply the stashed commit.
Note: This Question is unanswered, help us to find answer for this one
82. After you've successfully merged two branches and committed the changes, what is the next step in keeping your git structure organized?
Answer
Correct Answer:
Run git rebase to move the current commit to its original location.
Note: This Question is unanswered, help us to find answer for this one
83. What change will the following command make to the staging area files? git rm --cached testfile.js
Answer
Correct Answer:
Testfile.js will be removed from the staging area and its changes no longer tracked.
Note: This Question is unanswered, help us to find answer for this one
84. What command would let you modify your previous commit?
Answer
Correct Answer:
--amend
Note: This Question is unanswered, help us to find answer for this one
85. How would you create a custom shortcut or command across your git environment?
Answer
Correct Answer:
Create an alias usin the git config command.
Note: This Question is unanswered, help us to find answer for this one
86. 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
Answer
Correct Answer:
Git push
Note: This Question is unanswered, help us to find answer for this one
87. Which of the following is true of the git push command?
Answer
Correct Answer:
By default a push doesn't send tags to the remote repository.
Note: This Question is unanswered, help us to find answer for this one
88. In a situation where you have several commits for a single task, what is the most efficient way to restructure your commit history?
Answer
Correct Answer:
Squash the related commits together into a single coherent commit.
Note: This Question is unanswered, help us to find answer for this one
89. What is the operation doing given the Git commands below? Git bisect start git bisect bad 5d41402abc4b2a76b9719d911017c592 git bisect good 69faab6268350295550de7d587bc323d
Answer
Correct Answer:
It performs a binary search using a known bad commit and known good commit to determine which commit introduced a bug
Note: This Question is unanswered, help us to find answer for this one
90. 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?
Answer
Correct Answer:
Git rebase -i
Note: This Question is unanswered, help us to find answer for this one
91. 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?
Answer
Correct Answer:
Use git show refs/heads/push-notifications
Note: This Question is unanswered, help us to find answer for this one
92. Which statement is true when you use the git add -A command?
Answer
Correct Answer:
All new and updated files from the working directory are staged to the index.
Note: This Question is unanswered, help us to find answer for this one
93. Where are files stored before they are committed to the local repository?
Answer
Correct Answer:
Staging area
Note: This Question is unanswered, help us to find answer for this one
94. After you make changes to a local repository, you run the following command. What will this do? git commit -a -m "Refactor code base"
Answer
Correct Answer:
Adds all modified files to the staging area, then commits them with a message
Note: This Question is unanswered, help us to find answer for this one
95. What files is this .gitignore programmed to leave out? #.swift; build/; *.txt; *.metadata;
Answer
Correct Answer:
All files in the build directory, as well as files ending with .txt or .metadata
Note: This Question is unanswered, help us to find answer for this one
96. How can you display a list of files added or modified in a specific commit?
Answer
Correct Answer:
Use the diff-tree command with the commit hash.
Note: This Question is unanswered, help us to find answer for this one
97. If you cloned an existing git repository, what would happen?
Answer
Correct Answer:
A copy of the repository would be created on your local machine
Note: This Question is unanswered, help us to find answer for this one
98. How could you squash multiple commits together without using git merge --squash?
Answer
Correct Answer:
Rebasing
Note: This Question is unanswered, help us to find answer for this one
99. What option can you use to apply git configurations across your entire git environment?
Answer
Correct Answer:
--global
Note: This Question is unanswered, help us to find answer for this one
100. Why would you use a pre-receive hook in your remote repository?
Answer
Correct Answer:
To execute a script when a remote receives a push that is triggered before any refs are updated
Note: This Question is unanswered, help us to find answer for this one
101. Why would the following command be used? Git rebase -i HEAD~10
Answer
Correct Answer:
To run a comparative search of the last 10 commits for differences
Note: This Question is unanswered, help us to find answer for this one
102. 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?
Answer
Correct Answer:
Use git bisect to compare the buggy commit to an early commit that works as expected.
Note: This Question is unanswered, help us to find answer for this one
103. What does the following command do to the git repository? git reset --soft HEAD^
Answer
Correct Answer:
It sets HEAD to the previous commit and leaves changes from the undone commit in the stage/index.
Note: This Question is unanswered, help us to find answer for this one
104. Looking at the following commands, describe what is happening. git checkout feature-user-location; git cherry-pick kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231
Answer
Correct Answer:
The commit is being cherry picked as the new HEAD of the commit history
Note: This Question is unanswered, help us to find answer for this one
105. What will the following command print to the Terminal? Git remote -v
Answer
Correct Answer:
A list of remote repositories and their URLs
Note: This Question is unanswered, help us to find answer for this one
106. Which of the following is true you when you use the following command? git add -A
Answer
Correct Answer:
All new and updated files are staged
Note: This Question is unanswered, help us to find answer for this one
107. 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?
Answer
Correct Answer:
Checkout the beta branch and run git merge push-notification
Note: This Question is unanswered, help us to find answer for this one
108. Describe what these Git commands do to the commit history: Git reset --hard HEAD~5 Git merge --squash HEAD@{1}
Answer
Correct Answer:
The current branch's HEAD is reset back five commits, then prior commits are squashed into a single commit.
Note: This Question is unanswered, help us to find answer for this one
109. What command lets you create a connection between a local and remote repository?
Answer
Correct Answer:
Git remote add new Git remote add origin
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
110. How can you check your current git version?
Answer
Correct Answer:
Git --version
Note: This Question is unanswered, help us to find answer for this one
111. What does git status -s do?
Answer
Correct Answer:
It gives a short status report
Note: This Question is unanswered, help us to find answer for this one
112. Which initializes a new folder?
Answer
Correct Answer:
git init
Note: This Question is unanswered, help us to find answer for this one
113. How can you create or switch to a new branch "feature"?
Answer
Correct Answer:
git checkout -b feature
Note: This Question is unanswered, help us to find answer for this one
114. How do you keep track of remotes attached to a local repository?
Answer
Correct Answer:
git remote
Note: This Question is unanswered, help us to find answer for this one
115. How to undo the last commit ?
Answer
Correct Answer:
git rm classdir git add sourcedir
Note: This Question is unanswered, help us to find answer for this one
116. What is a hash function is used to identify git commits?
Answer
Correct Answer:
SHA-1
Note: This Question is unanswered, help us to find answer for this one
117. Is it possible to define an alias for a git command?
Answer
Correct Answer:
Yes
Note: This Question is unanswered, help us to find answer for this one
118. Is it possible to print git log using custom format?
Answer
Correct Answer:
Yes
Note: This Question is unanswered, help us to find answer for this one
119. Which of the following commands will show the file changes before staging?
Answer
Correct Answer:
git diff
Note: This Question is unanswered, help us to find answer for this one
120. How you can apply the changes introduced by some existing commits?
Answer
Correct Answer:
git cherry-pick <commit>
Note: This Question is unanswered, help us to find answer for this one
Note: This Question is unanswered, help us to find answer for this one
173. What is the option to print a text-base graphic of the commit history when doing 'git log'?
Answer
Correct Answer:
--graph
Note: This Question is unanswered, help us to find answer for this one
174. Which of these commands alters existing commits?
Answer
Correct Answer:
rebase
Note: This Question is unanswered, help us to find answer for this one
175. Which command removes file foo.txt from the index but not from the working directory?
Answer
Correct Answer:
git rm --cached foo.txt
Note: This Question is unanswered, help us to find answer for this one
176. Which command will move the changes from the last commit into in the stage area?
Answer
Correct Answer:
git reset --soft HEAD^
Note: This Question is unanswered, help us to find answer for this one
177. Which command creates a new commit that undoes the changes in the most recent commit?
Answer
Correct Answer:
git revert HEAD
Note: This Question is unanswered, help us to find answer for this one
178. A Git repo can consist how many number of heads
Answer
Correct Answer:
Any number
Note: This Question is unanswered, help us to find answer for this one
179. Which is the command to remove everything from the stash?
Answer
Correct Answer:
git stash clear
Note: This Question is unanswered, help us to find answer for this one
180. `git rebase <upstream>` will:
Answer
Correct Answer:
Replay the changes made in the current branch on top of the changes made in <upstream> (as if the changes in the current branch had been done after the changes in <upstream>)
Note: This Question is unanswered, help us to find answer for this one
181. What is the "git status" option used to output the shortened project status?
Answer
Correct Answer:
-s
Note: This Question is unanswered, help us to find answer for this one
182. Using which command you can apply a certain commit to the current branch, using the commit's SHA1?
Answer
Correct Answer:
cherry-pick
Note: This Question is unanswered, help us to find answer for this one
183. Which command will show what revision and author last modified each line of a file?
Answer
Correct Answer:
git blame
Note: This Question is unanswered, help us to find answer for this one
184. When pushing to a remote server, what is the only type of merge that is accepted by default?
Answer
Correct Answer:
Fast-Forward
Note: This Question is unanswered, help us to find answer for this one
185. How do you add another git repository as a directory of your repository