InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What is the difference between git stash apply vs git stash pop command? |
| Answer» git stash pop = git stash apply + git stash drop | |
| 2. |
What does git annotate command do? |
Answer»
|
|
| 3. |
What is a detached HEAD and what causes this and how to avoid this? |
|
Answer» Detached HEAD indicates that the currently checked-out repository is not a LOCAL branch. This can be caused by the following scenarios:
|
|
| 4. |
Explain the levels in git config and how can you configure values using them? |
Answer»
|
|
| 5. |
What consists of a commit object? |
|
Answer» A commit object consists of the following COMPONENTS: |
|
| 6. |
Can you tell something about git reflog? |
|
Answer» This command tracks every single change made in the repository references (that can be branches or tags) and also maintains the branches/tags log HISTORY that was either created locally or CHECKED out. Reference logs such as the commit snapshot of when the branch was created or CLONED, checked-out, renamed, or any commits made on the branch are maintained by Git and listed by the ‘REFLOG’ command.
|
|
| 7. |
How would you recover a branch that has already pushed changes in the central repository but has been accidentally deleted from every team member’s local machines? |
|
Answer» We can RECOVER this by CHECKING out the latest commit of this BRANCH in the REFLOG and then checking it out as a NEW branch. |
|
| 8. |
What has to be run to squash multiple commits (last N) into a single commit? |
|
Answer» Squashing MULTIPLE commits to a single one overwrites the HISTORY which is why it is recommended to be done using full caution. This step can be done by RUNNING the command: GIT REBASE -i HEAD~{{N}} where {{N}} represents the number of commits needed to be squashed. |
|
| 9. |
What do the git diff and git status commands do? |
||||
Answer»
|
|||||
| 10. |
Can you tell the difference between Git and GitHub? |
||||||||
Answer»
|
|||||||||
| 11. |
Why do we not call git “pull request” as “push request”? |
| Answer» | |
| 12. |
Can you give differences between “pull request” and “branch”? |
||||
Answer»
|
|||||
| 13. |
Differentiate between git pull and git fetch. |
||||
Answer»
|
|||||
| 14. |
What does git stash apply command do? |
| Answer» | |
| 15. |
What differentiates between the commands git remote and git clone? |
|
Answer» git REMOTE command creates an entry in git CONFIG that specifies a NAME for a particular URL. Whereas git clone creates a new git repository by copying an EXISTING one located at the URL. |
|
| 16. |
What is the command used to delete a branch? |
Answer»
|
|
| 17. |
Tell me something about git stash? |
|
Answer» Git stash can be used in CASES where we need to SWITCH in between branches and at the same time not wanting to lose edits in the current branch. RUNNING the git stash COMMAND basically pushes the current working directory state and index to the stack for future USE and thereby providing a clean working directory for other tasks. |
|
| 18. |
How will you create a git repository? |
| Answer» | |
| 19. |
Why is it considered to be easy to work on Git? |
|
Answer» With the help of git, developers have GAINED many advantages in terms of performing the development process faster and in a more efficient manner. Some of the main features of git which has made it easier to work are:
|
|