• +91 9723535972
  • info@interviewmaterial.com

GIT Interview Questions and Answers

Related Subjects

GIT Interview Questions and Answers

Question - 91 : - How do you define a ‘conflict’ in git?

Answer - 91 : -

If we want to merge a commit there is a change in one place and the same change already exists then while merging the Git will not be able to predict which is the change that needs to be taken precedence.

Question - 92 : - State a way to create a new branch in Git.

Answer - 92 : -

If we want to create a new feature into the main branch, then we can use the command ‘git merge’ or ‘git pull’.

Question - 93 : - What is the regular way for branching in GIT?

Answer - 93 : -

The best way to create a branch in GIT is to have one ‘main’ branch and then create another branch for implementing the changes that we want to make. This is extremely useful when there are a large number of developers working on a single project.

Question - 94 : - What are the constituents of the commit object contain?

Answer - 94 : -

  • the state of a project at a given point of time is contained in a set of files
  • Parent object commit references
  • A 40-character string that uniquely identifies the commit object called a SHAI name

Question - 95 : - Why do we need branching in GIT?

Answer - 95 : -

With the help of branching, we can have our own branch and we can also jump between various branches. We can go to our previous work, at the same time keeping our recent work intact.

Question - 96 : - How to identify if a certain branch has been merged into master?

Answer - 96 : -

  • Git branch –merged master – shows all branches that are merged into master
  • Git branch – merged – shows all branches that are merged into the head
  • Git branch – no-merged –shows all the branches that are not merged

Question - 97 : - What is the difference between git reflog and log?

Answer - 97 : -

The git log is a public record of the commit history for a branch. Reflog, on the other hand, is a private one of the repository’s local commits.

Unlike reflog, the git log is a part of the Git repository and is replicated after a push, fetch, or pull. A developer cannot access a local repository’s reflog without having access to the computer where it is located.

Question - 98 : - How are fork, branch, and clone different from each other?

Answer - 98 : -

Forking creates a copy of the original repository, and it remains in the GitHub account. Whereas, in cloning, the repository is copied to the local machine using Git. Forking is used to propose changes to the repository owners. In cloning, the changes are directly pushed to the original repository, provided the user has write access. A branch occurs within a repository and is a way to keep developing and modifying the software without affecting the main project.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners