Why Use Git?

What is Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. As i mentioned Git is a distributed version control system, meaning your local copy of code is a complete version control repository. These fully-functional local repositories make it is easy to work offline or remotely. You commit your work locally, and then sync your copy of the repository with the copy on the server. This paradigm differs from centralized version control where clients must synchronize code with a server before creating new versions of code.



Git’s flexibility and popularity make it a great choice for any team. Many developers and college graduates already know how to use Git. Git’s user community has created many resources to train developers and Git’s popularity make it easy to get help when you need it. Nearly every development environment has Git support and Git command line tools run on every major operating system.

Now, let’s understand what is Version Control.

Version Control is the management of changes to documents, computer programs, large websites and other collection of information.

There are two types of VCS (Verion Control System):

  • Centralized Version Control System (CVCS)
  • Distributed Version Control System (DVCS)

Centralized VCS

Centralized version control system (CVCS) uses a central server to store all files and enables team collaboration. It works on a single repository to which users can directly access a central server.

Please refer to the diagram below to get a better idea of Centralized version control system (CVCS):

The repository in the above diagram indicates a central server that could be local or remote which is directly connected to each of the programmer’s workstation. Every programmer can extract or update their workstations with the data present in the repository or can make changes to the data or commit in the repository. Every operation is performed directly on the repository.

Distributed VCS

These systems do not necessarily rely on a central server to store all the versions of a project file. In Distributed VCS, every contributor(programmer) has a local copy or “clone” of the main repository i.e. everyone maintains a local repository of their own which contains all the files and metadata present in the main repository.

Please refer to the diagram below to get a better idea of Distributed VCS

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

They can update their local repositories with new data from the central server (Distributed VCS) by an operation called “pull” and affect changes to the main repository by an operation called “push” from their local repository.

Basic Operations

The following is a summary of basic git operations:

git add

Puts current working files into the stage (aka index or cache)

git checkout

Replaces the current working files with files from a branch.

git checkout -b

Creates a new local branch from the current branch’s tip.

git clone

Clone an existing repository into a new directory.

git commit

Commits staged changes to a local branch

git commit -a

Commits all modified files to a local branch (shorthand for “git add” followed by “git commit” for each modified file)

git pull

Fetches remote changes on the current branch into the local clone, and merges them into the current working files.

git push

Uploads changes from all local branches to the respective remote repositories.

git reset

Makes the current branch point to some specific revision or branch.

git reset –hard

Makes the current branch point to some specific revision or branch, and replaces the current working files with the files from that branch.

 

Why Use Git?

30 thoughts on “Why Use Git?

  • November 24, 2019 at 12:31 am
    Permalink

    I have recently started a web site, the info you offer on this website has helped me tremendously. Thank you for all of your time & work.

  • November 23, 2019 at 6:29 am
    Permalink

    Greetings! Very helpful advice on this article! It is the little changes that make the biggest changes. Thanks a lot for sharing!

  • November 13, 2019 at 7:40 pm
    Permalink

    Hi! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup. Do you have any solutions to stop hackers?

  • November 6, 2019 at 6:39 pm
    Permalink

    Heya i’m for the first time here. I found this board and I find It truly useful & it helped me out much. I hope to give something back and help others like you aided me.

  • November 5, 2019 at 7:19 am
    Permalink

    Thank you for the good writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! By the way, how could we communicate?

  • November 3, 2019 at 7:36 pm
    Permalink

    An interesting discussion is worth comment. I think that you should write more on this topic, it might not be a taboo subject but generally people are not enough to speak on such topics. To the next. Cheers

  • October 19, 2019 at 1:17 am
    Permalink

    There are actually a number of particulars like that to take into consideration. That is a great point to convey up. I offer the thoughts above as general inspiration however clearly there are questions like the one you deliver up the place the most important factor will likely be working in sincere good faith. I don?t know if finest practices have emerged round issues like that, but I am positive that your job is clearly recognized as a fair game. Each girls and boys feel the affect of just a moment’s pleasure, for the rest of their lives.

  • October 8, 2019 at 3:59 am
    Permalink

    I’d have to examine with you here. Which is not one thing I usually do! I take pleasure in reading a post that may make folks think. Additionally, thanks for permitting me to comment!

  • October 7, 2019 at 9:33 pm
    Permalink

    I loved as much as you will receive carried out proper here. The comic strip is attractive, your authored subject matter stylish. nevertheless, you command get got an impatience over that you wish be delivering the following. sick no doubt come further until now once more since exactly the similar just about very regularly within case you shield this increase.

  • October 5, 2019 at 5:39 am
    Permalink

    Glad to be one of several visitors on this awing web site : D.

  • October 4, 2019 at 1:11 pm
    Permalink

    Just what I was searching for, regards for posting.

  • September 24, 2019 at 6:47 pm
    Permalink

    Good write-up, I’m regular visitor of one’s website, maintain up the nice operate, and It’s going to be a regular visitor for a long time.

  • September 17, 2019 at 4:14 am
    Permalink

    Great post. I am facing a couple of these problems.

  • July 28, 2019 at 12:18 pm
    Permalink

    An interesting discussion is price comment. I believe that you should write more on this topic, it won’t be a taboo subject however usually individuals are not sufficient to talk on such topics. To the next. Cheers

  • June 2, 2019 at 3:06 am
    Permalink

    I was just searching for this information for some time. After six hours of continuous Googleing, at last I got it in your web site. I wonder what is the lack of Google strategy that do not rank this type of informative websites in top of the list. Generally the top web sites are full of garbage.

  • May 19, 2019 at 1:59 pm
    Permalink

    Oh my goodness! an amazing article dude. Thank you However I am experiencing situation with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting similar rss drawback? Anybody who knows kindly respond. Thnkx

  • March 16, 2019 at 7:20 pm
    Permalink

    Hello, I wish for tto subscribe for this website to obtan moat recent updates, therefore where
    cann i do it please assist.

  • March 16, 2019 at 6:36 pm
    Permalink

    It’s going to be ending of mine day, however before ending I
    am reading this wonderful paragraph to improve my know-how.

  • March 16, 2019 at 4:27 pm
    Permalink

    Hi there, just became alert too your blog theough Google,
    and fouynd that it’s really informative. I am going to watch out for brussels.
    I willl be grateful iff you continue this in future.
    A lot of people will be benefited from your writing.

    Cheers!

  • March 16, 2019 at 3:22 pm
    Permalink

    Ι know thіs site gives quality deрendent content and extra stuff, is there
    any other web page which gives these thіngs in quality?

  • March 16, 2019 at 2:51 pm
    Permalink

    Hello! I simply wish to give you a big thumbs up for thee
    great ijfo you have got right here on this post. I am returning
    too your webb site for mre soon.

  • March 16, 2019 at 2:41 pm
    Permalink

    What’s uρ, all the time i used to ϲhеck blоg pօsts
    here in the earⅼy hours in the dɑylight, as i enjoy
    to gain knowledge of morre and more.

  • March 16, 2019 at 2:11 pm
    Permalink

    I believe that is one of the such a lot significant information for me.
    And i’m glad reading your article. But wanna commentary on few common things, The
    website taste is ideal, the articles is in point of fact excellent :
    D. Good job, cheers

  • March 13, 2019 at 8:56 am
    Permalink

    Hey very nice website!! Guy .. Beautiful .. Superb .. I’ll bookmark your blog and take the feeds also¡KI’m satisfied to seek out numerous helpful information here in the put up, we need work out more strategies on this regard, thank you for sharing. . . . . .

  • December 24, 2018 at 1:07 pm
    Permalink

    You make some insightful ideas-but I believe you may be lacking clarity. I would like to see you add some more detail, because you are a very eloquent blogger and I get immense value from reading your posts.|

    • December 26, 2018 at 6:16 am
      Permalink

      Thanks for your message.

      I definitely improve my strategy.

Comments are closed.

Show Buttons
Hide Buttons