GIT Interview Questions
GIT is a distributed version of source code management (SCM) and control system that has an emphasis to handle both large and small projects with maximum speed and improved efficiency. If you just landed a job in this field and you do not know what to expect from the interview, maybe a few questions that are frequently asked during the interviews might help you walk to the room with confidence. In this article we have prepared you some of these git interview questions.
We have also provided you with answers for each and every question so you don’t need to leave the site looking for answers. Check them out :
1. What command can you use to write a commit message?
Answer: The command that is normally used to write a commit message is the git command –a. This command usually instructs the git to commit the new content of the modified tracked files. If the files needs to be committed for the first time, you can make use of the git add file> before you use the –a command.
2. What is the difference between GIT and SVN?
Answer : This is a question that you should have the answers on your fingertips because there is a very high probability that it is going to be asked during your interview. And the following are some of the differences between the two.
- Git is not preferred when it comes to handling extremely large files while SVN can be able to handle multiple projects that are stored in the same repository.
- Git do not support commits across many tags or branches while SVN allows the creation of folders at any location that is in the repository layout.
- Git are unchangeable but SVN allows committers to treat a tag as a branch and can also create many revisions under the tag root.
3. List the advantages of using GIT.
Answer : Using git has many advantages and some of them include but not limited to the following:
- Git is highly available.
- Helps deal with data redundancy and replication.
- Git can practically be used by any sort of a project.
- Git is collaboration friendly.
- Enhances superior network performance and not forgetting that it enhance better utilization of the disk.
- There is only one git in each and every repository.
4. What language do git use?
Answer : GIT employs the use of C language and this plays a great role in reducing the overhead of runtimes that are normally associated with other higher languages like C++. This also makes git faster.
5. What is contained in the commit object?
Answer: The commit object normally do contain a set of files that represents the state of project at a certain point of time. The commit object also do contain the reference to parent commit objects and finally it also contain an SHAI name which is a 40 character string that is uniquely identifies the commit object.
6. Why is GIT better than subversions?
Answer: Since GIT is an open source version control system, it allows one to run versions of a project and it shows the changes that were made to the code over time. GIT also allows one to keep backtrack when it is necessary and undo the changes that you had made. Different developers can checkout as well as upload the changes and the change that has been made can be attributed to a specific developer.
7. What is GIT stash?
Answer: Git stash is the one responsible of taking the current state of working directory plus index and then puts that stack to be used later and that’s give you a clean working directory. This simply means that if you are for example in middle of a thing and then you need to change and do another job at the same time and you still don’t want to lose your current proceedings of the other job, you can simply use the git stash and when you can view the proceedings later.
8. What is git drop?
Answer: If you are done with the item you stashed to the git stash and you want to get rid of it. All you need is make use of git drop command. By making use of the same, it is going to remove the stash item that was added last and if you want to remove any specific item, you can add an argument for that.
9. What does a git clone do?
Answer: The git clone has a function of creating a copy of existing git repository. This is a way that is used by many programmers since it is fast and very efficient when it comes to getting a copy of central repository. It is as it sounds, cloning the repository to get a “look alike” of the same.
10. What is the function of git config?
Answer: The git config command has the function of setting configurations options when one is installing git. The behavior of repository, the preferences and the user info among others can be defined through the command, git config.
11. How can you create a repository in git?
Answer: If you want to create repository for a project in git and it does not exist, what you will need to do is create a directory for the project and then run the command git init. When you run the command git init, the directory will be created in the project directory. And by the way the folder does not have to be empty in order to create the repository.
12. What is head in git and how many heads can there be created in a repository?
Answer: A head is basically a reference to the commit project. In each and every repository there is usually a head that goes by the name master. As for the number of heads that the created repository can be there on a repository, it can contain any number of the heads.
GIT Interview Questions And Answers PDF
You can also download GIT interview questions and answers pdf from the link below :
Hope the above will help you in preparing for git interviews.