0% found this document useful (0 votes)
164 views

Top Answers To Git Interview Questions

Git is a distributed version control system that allows for collaboration. It offers advantages over centralized systems like SVN such as distributed access without a central server, faster performance, and easier collaboration. Key concepts in Git include the staging area which allows reviewing and formatting changes before committing, branching to work independently without affecting the main branch, and resolving conflicts that occur when merging branches with differing changes to the same code.

Uploaded by

ejazalm
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
164 views

Top Answers To Git Interview Questions

Git is a distributed version control system that allows for collaboration. It offers advantages over centralized systems like SVN such as distributed access without a central server, faster performance, and easier collaboration. Key concepts in Git include the staging area which allows reviewing and formatting changes before committing, branching to work independently without affecting the main branch, and resolving conflicts that occur when merging branches with differing changes to the same code.

Uploaded by

ejazalm
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Top Answers to Git Interview Questions

1. What are the main differences between Git and SVN?


Criteria Git SVN
Type of version control Distributed Centralized
Access to networks Not mandatory Mandatory
Global revision number Not available Available
Content Cryptographic SHA-1 Hash No hashed content
Here we list some of the most important differences between Git and SVN:

When it comes to handling large files, Git is not preferred but SVN can handle
multiple projects in the same repository
Git does not have �commits� across multiple branches but SVN lets you create the
folders on any location in the repository layout
You cannot commit changes in Git but SVN lets you create a tag as a branch and you
can create multiple revisions under a root tag
2. What are the advantages of using GIT?
Here are some of the most important advantages of Git:

Data redundancy and data replication is possible


It is a highly available service
For one repository you can have only one directory of Git
The network performance and disk utilization are excellent
It is very easy to collaborate on any project
You can work on any sort of project within the Git
3. What language is used in GIT?
C is the programming language that is used for creating Git which ensures that the
overheads are reduced.

Watch this Git Tutorial Video

Learn for free ! Subscribe to our youtube Channel.

4. What are the advantages of Git over SVN?


Since Git is an open source version control system it lets you run multiple
versions of your project so that it shows the changes that are made to the code
over time and if needed you can keep a track of the changes that you have made.
This means that large number of developers can make their own changes and upload
those changes so that the changes can be attributed to the particular developers.

5. What is the meaning of �Index� or �Staging Area� in GIT?


When you are making the commits you can make changes to it, format it and review it
in the intermediate area known as �Staging Area� or �Index�.

6. What is GIT stash?


The Git stash will take the working directory in the current state and index it to
put on the stack at a later stage so that what you get is a clean working
directory. This means that if you are in the middle of some task and need to get a
clean working directory and simultaneously you want to keep all your current edits
then you can use the Git stash.

7. What is GIT stash drop?


When you are finished with working on the stashed item or want to remove the list
then you can use the Git stash drop. This will ensure that the item that is last
added by default or any particular item can be removed from the argument.

8. How to identify if a certain branch has been merged into master?


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

9. What is the use of a Git clone?


The Git clone command lets you copy the existing Git repository. If you want to get
a copy of the central repository then the best way to do it is using �cloning�.

Learn DevOps from Experts! Enrol Today

10. What is the function of �git config�?


The �Git config� is a great way to configure your options for the Git installation.
Using this command you can define the repository behavior, preferences and user
information.

11. What are the constituents of the commit object contain?


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
12. What is the process for creating a repository in Git?
If you want to create a repository in Git then you need to run the command �git
init�. With this command .git repository you can create a directory in the project
directory.

13. What is �head� in git and how many heads can be created in a repository?
The reference to a commit object is called as the �head�. Every repository has a
�Master� which is the default head. There can be multiple heads in a repository.

14. Why do we need branching in GIT?


With the help of branching you can have your own branch and you can also jump
between the various branches. You can go to your previous work while at the same
time keeping your recent work intact.

15. What is the regular way for branching in GIT?


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 you want to make. This is
extremely useful when there are a large number of developers working on a single
project.

16. State a way to create a new branch in Git?


If you want to create a new feature into the main branch then you can use the
command �git merge� or �git pull�.

17. How do you define a �conflict� in git?


If you want to merge a commit there is a change in one place and 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.

18. How to resolve a conflict in Git?


If you want to resolve a conflict in Git then you need to edit the files for fixing
the conflicting changes and then you can run �git add� to add the resolved files
and after that you can run the �git commit� for committing the repaired merge.

You might also like