• +91 9723535972
  • info@interviewmaterial.com

GIT Interview Questions and Answers

Related Subjects

GIT Interview Questions and Answers

Question - 71 : - What do you understand about the Git merge conflict?

Answer - 71 : -

A Git merge conflict is an event that occurs when Git is unable to resolve the differences in code between the two commits automatically. 

Git is capable of automatically merging the changes only if the commits are on different lines or branches.

Question - 72 : - How do you resolve conflicts in Git?

Answer - 72 : -

Here are the steps that will help you resolve conflicts in Git:

  • Identify the files responsible for the conflicts.
  • Implement the desired changes to the files 
  • Add the files using the git add command.
  • The last step is to commit the changes in the file with the help of the git commit command.

Question - 73 : - What is the functionality of git ls-tree?

Answer - 73 : -

The git ls-tree command is used to list the contents of a tree object.

Question - 74 : - What is the process to revert a commit that has already been pushed and made public?

Answer - 74 : -

There are two processes through which you can revert a commit:

1. Remove or fix the bad file in a new commit and push it to the remote repository. Then commit it to the remote repository using:

git commit –m “commit message”

2. Create a new commit to undo all the changes that were made in the bad commit. Use the following command:

git revert

Question - 75 : - What does git clone do?

Answer - 75 : -

Git clone allows you to create a local copy of the remote GitHub repository. Once you clone a repo, you can make edits locally in your system rather than directly in the source files of the remote repo

Question - 76 : - What is Git stash?

Answer - 76 : -

Let’s say you're a developer and you want to switch branches to work on something else. The issue is you don’t want to make commits in uncompleted work, so you just want to get back to this point later. The solution here is the Git stash. 

Git stash takes your modified tracked files and saves it on a stack of unfinished changes that you can reapply at any time. To go back to the work you can use the stash pop.

Question - 77 : - What does the git reset --mixed and git merge --abort commands do?

Answer - 77 : -

git reset --mixed is used to undo changes made in the working directory and staging area.

git merge --abort helps stop the merge process and return back to the state before the merging began.

Question - 78 : - What do you understand about the Staging area in Git?

Answer - 78 : -

The Staging Area in Git is when it starts to track and save the changes that occur in files. These saved changes reflect in the .git directory. Staging is an intermediate area that helps to format and review commits before their completion.

Question - 79 : - What is Git Bisect and how do you use it?

Answer - 79 : -

The Git Bisect command performs a binary search to detect the commit which introduced a bug or regression in the project’s history.

Syntax: git bisect

Question - 80 : - How do you find a list of files that has been changed in a particular commit?

Answer - 80 : -

The command to get a list of files that has been changed in a particular commit is:

git diff-tree –r {commit hash}

  • -r flag allows the command to list individual files
  • commit hash lists all the files that were changed or added in the commit.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners