Blog Archives

What are ours and theirs merge options in GIT?

In GIT, we get two simple options for resolving merge conflicts: ours and theirs These options tell the GIT which side to favor in merge conflicts. In ours, we run a command like git merge -Xours branchA As the name

Posted in GIT, GIT Interview Questions

How can we ignore merge conflicts due to Whitespace?

GIT provides an option ignore-space-change in git merge command to ignore the conflicts related to whitespaces. The command to do so is as follows: git merge -Xignore-space-change whitespace

Posted in GIT, GIT Interview Questions

What is git blame?

In GIT, git blame is a very good option to find the person who changed a specific line. When we call git blame on a file, it displays the commit and name of a person responsible for making change in

Posted in GIT, GIT Interview Questions

What is a submodule in GIT?

In GIT, we can create sub modules inside a repository by using git submodule command. By using submodule command, we can keep a Git repository as a subdirectory of another Git repository. It allows us to keep our commits to

Posted in GIT, GIT Interview Questions

How will you split a commit into multiple commits?

To split a commit, we have to use git rebase command in interactive mode. Once we reach the commit that needs to be split, we reset that commit and take the changes that have been reset. Now we can create

Posted in GIT, GIT Interview Questions

What is filter-branch in GIT?

In GIT, filter-branch is another option to rewrite history. It can scrub the entire history. When we have large number of commits, we can use this tool. It gives many options like removing the commit related changes to a specific

Posted in GIT, GIT Interview Questions

What are the three main trees maintained by GIT?

GIT maintains following three trees: <li><strong>HEAD</strong>: This is the last commit snapshot.</li> <li><strong>Index</strong>: This is the proposed next commit snapshot.</li> <li><strong>Working Directory</strong>: This is the sandbox for doing changes.</li>

Posted in GIT, GIT Interview Questions

What are the three main steps of working GIT?

GIT has following three main steps in a simple workflow: <li>Checkout the project from HEAD to Working Directory.</li> <li>Stage the files from Working Directory to Index.</li> <li>Commit the changes from Index to HEAD.</li>

Posted in GIT, GIT Interview Questions

What is git grep?

GIT is shipped along with a grep command that allows us to search for a string or regular expression in any committed tree or the working directory. By default, it works on the files in your current working directory.

Posted in GIT, GIT Interview Questions

How can your reorder commits in GIT?

We can use git rebase command to reorder commits in GIT. It can work interactively and you can also select the ordering of commits.

Posted in GIT, GIT Interview Questions