• +91 9723535972
  • info@interviewmaterial.com

GIT Interview Questions and Answers

Related Subjects

GIT Interview Questions and Answers

Question - 31 : - What is a distributed VCS?

Answer - 31 : -

These are the systems that don’t rely on a central server to store a project file and all its versions.

In Distributed VCS, every contributor can get a local copy or “clone” of the main repository.

As you can see in the above diagram, every programmer can maintain a local repository which is actually the copy or clone of the central repository which is present on their hard drive. They can commit and update their local repository without any hassles.

With an operation called “pull”, they can update their local repositories with new data from the central server and “pull” operation affects changes to the main repository from their local repository.

Question - 32 : - What is the difference between Git and Github?

Answer - 32 : -

Git is a version control system of distributed nature that is used to track changes in source code during software development. It aids in coordinating work among programmers, but it can be used to track changes in any set of files. The main objectives of Git are speed, data integrity, and support for distributed, non-linear workflows.

GitHub is a Git repository hosting service, plus it adds many of its own features. GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, basic task management tools for every project.

Question - 33 : - What are the benefits of using Version Control System?

Answer - 33 : -

  • With the Version Control System(VCS), all the team members are allowed to work freely on any file at any time. VCS gives you the flexibility to merge all the changes into a common version.
  • All the previous versions and variants are neatly packed up inside the VCS. You can request any version at any time as per your requirement and you’ll have a snapshot of the complete project right at hand.
  • Whenever you save a new version of your project, your VCS requires you to provide a short description of the changes that you have made. Additionally, you can see what changes are made in the file’s content. This helps you to know what changes have been made in the project and by whom.
  • A distributed VCS like Git allows all the team members to have a complete history of the project so if there is a breakdown in the central server you can use any of your teammate’s local Git repository.

Question - 34 : - What language is used in Git?

Answer - 34 : -

Instead of just telling the name of the language, you need to tell the reason for using it as well. I will suggest you to answer this by saying:

Git uses ‘C’ language. GIT is fast, and ‘C’ language makes this possible by reducing the overhead of run times associated with high-level languages.

Question - 35 : - What is a commit message?

Answer - 35 : -

The command that is used to write a commit message is “git commit -a”.
Now explain about -a flag by saying -a on the command line instructs git to commit the new content of all tracked files that have been modified. Also, mention you can use “git add ” before git commit -a if new files need to be committed for the first time.

Question - 36 : - How can you fix a broken commit?

Answer - 36 : -

In order to fix any broken commit, use the command “git commit --amend”. When you run this command, you can fix the broken commit message in the editor.

Question - 37 : - How can you create a repository in Git?

Answer - 37 : -

This is probably the most frequently asked question and the answer to this is really simple.

To create a repository, create a directory for the project if it does not exist, then run the command “git init”. By running this command .git directory will be created in the project directory.

Question - 38 : - What is ‘bare repository’ in Git?

Answer - 38 : -

A “bare” repository in Git contains information about the version control and no working files (no tree) and it doesn’t contain the special .git sub-directory. Instead, it contains all the contents of the .git sub-directory directly in the main directory itself, whereas the working directory consists of :

  • A .git subdirectory with all the Git related revision history of your repository.
  • A working tree, or checked out copies of your project files.

Question - 39 : - What is a ‘conflict’ in git?

Answer - 39 : -

Git can handle on its own most merges by using its automatic merging features. There arises a conflict when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other. Conflicts are most likely to happen when working in a team environment.

Question - 40 : - How is git instaweb used?

Answer - 40 : -

‘git instaweb’ is used to automatically direct a web browser and run a webserver with an interface into your local repository.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners