Git Interview Questions and Answers
by Venkatesan M, on May 26, 2017 2:59:57 PM
Q1. What is Git?Ans: Git is one of the most popular frameworks for source code control. It has been widely adopted in the open source community and many corporations use Git as their source control framework of choice. it is very fast and very flexible, while being straightforward to use.
Q2. What is GIT stash?
Ans:In case if you are in the middle of something/task and need to jump over to the other job, and at the same time you don’t want to lose/destroy your current edits then you can use GIT stash.
Q3. What is the use of ‘git log’?
- ‘git log’ Show commit logs
- we can find specific commits in your project history / metadata repository – by author, date, content or history ‘git log’ is used.
Q4. What is SourceTree (ST)?
Ans: There are two ways to work with Git: from the command line or from a graphical user interface (GUI). SourceTree is the most popular cross-platform GUI for Git.
Q5. What is ‘git add’ is used for?
- ‘git add’ adds file changes in your existing directory to your index.
- ‘git add’ Add file contents to the index
Q6. What are the differences between ‘git pull’ and ‘git fetch’?
- Git pullautomatically merges the commits without letting you review them first.
- Git fetchstores them in your local repository but it not merge them with your current branch.
- git fetch similar to git pull but it does not merge the changes.
Q7. What is another option for merging in git?
- git merge, Join two or more development histories together
git rebase, Reapply commits on top of another base tip
- Rebasing” is an alternative to merging the branch in git.
Q8. What language is used in GIT?
Ans:GIT is fast, and ‘C’ language makes this possible by reducing the overhead of runtimes associated with higher languages.
Q9. What is a ‘conflict’ in git?
Ans:A ‘conflict’ arises when the commit that has to be merged has some change in one place, and the current commit also has a change at the same place. Git will not be able to predict which change should take precedence.
Q10. What is ‘bare repository’ in GIT?
Ans: To co-ordinate with the distributed development and developers team, especially when you are working on a project from multiple computers ‘Bare Repository’ is used. A bare repository comprises of a version history of your code.