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

GIT Interview Question

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

GIT Interview Question

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

Interview Questions

@Dimple Kumari
What is Git?

Git is a Distributed Version Control system (DVCS). It


can track changes to a file and allows you to revert back
to any particular change.
Its distributed architecture provides many advantages
over other Version Control Systems (VCS) like SVN one
major advantage is that it does not rely on a central
server to store all the versions of a project’s files.

@Dimple Kumari
What is the command to write a commit
message in Git?

Use:
git commit -a
-a on the command line instructs git to commit the new content
of all tracked files that have been modified. You can use
git add <file>
or
git add -A
before git commit -a if new files need to be committed for the
first time.

@Dimple Kumari
What is difference between Git vs SVN?

The main point in Git vs SVN debate boils down to


this: Git is a distributed version control system
(DVCS), whereas SVN is a centralized version
control system.

@Dimple Kumari
What's the difference between a pull request
and a branch?

A branch is just a separate version of the code.


A pull request is when someone take the
repository, makes their own branch, does some
changes, then tries to merge that branch in (put
their changes in the other person's code
repository).

@Dimple Kumari
What is the difference between git pull and git fetch?
In the simplest terms, git pull does a git fetch followed by a git
merge.
When you use pull, Git tries to automatically do your work for
you. It is context sensitive, so Git will merge any pulled commits
into the branch you are currently working in. pull automatically
merges the commits without letting you review them first. If you
don’t closely manage your branches, you may run into frequent
conflicts.
When you fetch, Git gathers any commits from the target branch
that do not exist in your current branch and stores them in your
local repository. However, it does not merge them with your
current branch. This is particularly useful if you need to keep
your repository up to date, but are working on something that
might break if you update your files. To integrate the commits
into your master branch, you use merge.

@Dimple Kumari
How does the Centralized Workflow work?
The Centralized Workflow uses a central repository to serve as the
single point-of-entry for all changes to the project. The default
development branch is called master and all changes are committed
into this branch.

Developers start by cloning the central repository. In their own local


copies of the project, they edit files and commit changes. These new
commits are stored locally.

To publish changes to the official project, developers push their


local master branch to the central repository. Before the developer
can publish their feature, they need to fetch the updated central
commits and rebase their changes on top of them.
Compared to other workflows, the Centralized Workflow has no
defined pull request or forking patterns.

@Dimple Kumari
What is Git fork? What is difference between
fork, branch and clone?

A fork is a remote, server-side copy of a repository,


distinct from the original. A fork isn't a Git concept
really, it's more a political/social idea.
A clone is not a fork; a clone is a local copy of some
remote repository. When you clone, you are actually
copying the entire source repository, including all the
history and branches.
A branch is a mechanism to handle the changes within a
single repository in order to eventually merge them with
the rest of code. A branch is something that is within a
repository. Conceptually, it represents a thread of
development.
@Dimple Kumari
Let’s connect!

💼 𝐋𝐢𝐧𝐤𝐞𝐝𝐈𝐧 — https://www.linkedin.com/in/dimple-kumari/
🔗 𝐌𝐞𝐝𝐢𝐮𝐦 — https://medium.com/@dimplekumari0228
✍️ 𝐂𝐨𝐝𝐞𝐩𝐞𝐧 — https://codepen.io/DIMPLE2802

@Dimple Kumari

You might also like