Git Interview Questions and Answers
by Rupa.R, on Sep 10, 2022 4:29:48 PM
1.What is Git?
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.
2.What is GIT stash?
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.
3.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.
4.What is SourceTree (ST)?
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.
5.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
6.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.
7.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.
8.What language is used in GIT?
GIT is fast, and ‘C’ language makes this possible by reducing the overhead of runtimes associated with higher languages.
9.What is a ‘conflict’ in git?
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.
10.What is ‘bare repository’ in GIT?
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.