What is Git?

Git is a free and open source distributed versioning control system that keeps track record of code changes during the software development, suppose you are working in an organization and you are writing some code, so how will you manage that code or We can say how will you keep a track record of your changes that you have done on your code along with It helps in coordinating work among programmers. So, Git is used for managing a track record of code changes.

What is Version Control?

Version Control means the management of changes, it is not necessary that the versioning should be only for code. Versioning can be done for any kind of document, it could be a text file, an image or a video.

Features Of Version Control
Major features of Version control are as follows:-

  1. We can fetch/pull our changes out of a remote server repository
  2. We can commit/push changes back to our remote server very quickly and efficiently.
  3. Merging and Branching

What is Distributed Version Control?

Suppose you are working in an organization as a developer on a very huge project, and there are some more developers working in the same project. So whatever changes will be done by you or some other developer those changes will be mirrored on each and every system of developers working on that project instead of relying on changes on a single place, that’s what distributed versioning is.

git version

Advantages of GIT

  1. Feature Branch Workflow
  2. Distributed Development
  3. Pull Requests
  4. Faster Release Cycle

GIT Operations

Some basic git operations that are generally used are mentioned below:-

  1. Initialize:It is used to convert an existing project to a Git repository or initialize a new, empty repository.
  2. Clone:Creating exact version of remote repository in local system environment.
  3. Add:Add command, which adds changes in the working directory to the staging area.
  4. Commit:Commit is used to save your changes to the local repository.
  5. Push:Push is used to upload local repository content to a remote repository.
  6. Pull:Pull command is used to update our local system repository with respect to our remote repository.
  7. Checkout:Checkout helps to switch between different branches.
  8. Delete: Delete helps us to delete a particular branch or tag.
  9. Tag:Tag is used in Git contexts for marking or freezing a specific version
  10. Stash:Git stash temporarily stashes the changes you’ve made to your working repository so you can work on something else, and then come back and re-apply them later on.

What is Staging?

Staging is a step or a process that comes before the commit step i.e. git commit. Actually git commit is performed in two steps: staging and actual commit. So as long as the change set is in the staging area, git allows us to modify those changes according to our need and requirement which can include editing those changes or completely remove those changes.

Types of Source Code Management tool:-

There are various types of source code management tool available, let’s have a look on small comparison between git and svn(sub-version)

GIT SVN
Git is decentralized/distributed. You have a local repository i.e a copy of a remote repository in which you can commit. In Svn you always have to connect to a central repository for check-in.
Branches are references to a certain commit. They can be created, deleted, and changed at any time, it won’t affect other commits. Different branches can be created inside a main repository as nested directory. These directories can be merged with master branch further.
Git generally becomes slow when it comes to deals with large binary files that change frequently Svn can handle large binary files easily.
Git creates only .git directory. Svn creates .svn directory in each folder.
Repository cloning is possible in Git Repository cloning is not possible in SVN.
To protect from repository corruption (due to any issue either network issues or disk failures) Git supports cryptographically hashed contents. Not Applicable

Why Git is used in organizations?

Git is used in organizations because:-

  1. It maintains who performs the merge.
  2. It knows when the merge was done.
  3. It maintains actual time stamp of the changes.
  4. It can switch between branches on same code base.
  5. It automatically remembers the revision of merges.
  6. Any time we can rollback any revision from history based on need.
Subscribe Now