What is Git? - Definition & Usage

Instructor: Martin Gibbs

Martin has 16 years experience in Human Resources Information Systems and has a PhD in Information Technology Management. He is an adjunct professor of computer science and computer programming.

The lesson will cover Git, a free but powerful version control tool. Developers can check out work, maintain history of changes, and ensure that revisions are made correctly and to the correct files. Git fosters collaboration and productivity.

Better 'Git' Going and Get 'Git!'

In the computer world, 'Git' is not an insult or a misspelling. To our British friends, we apologize, but in this context, Git refers to version control software. It is also Free versioning software. It is a tool for computer programmers and software developers to ensure that their code is safe from being over-written, and that proper versioning is in place.

So What is Versioning?

If you've ever tried to share a document with others in a team or work group, you have most likely experienced some frustration: Documents wind up unsaved; added information is lost; someone saves a copy over the top of your latest additions; etc.

The same is true for software development: If multiple programmers are working on a large project, there is a very real possibility that they will overwrite a colleague's information. Perhaps Programmer A has written a bug-fix for an application, but Programmer B has a cool new feature to add to it: Programmer A edits the code, and Programmer B then pastes her code over the top of what Programmer A just fixed.

Enter version control.

Version control ensures that each new addition/revision is assigned a version number and tracked accordingly. For example, Twitter 1.0 may allow 140-character text messages; 1.5 may introduce the Favorite concept; and 2.0 may introduce a major feature, such as Direct Messaging. Another useful feature is check in/check out.

Like a brick-and-mortar library, good versioning software provides a check in/check out feature. Programmer A, from the example above, will check out the code to modify; if Programmer B tries to edit that same section of code, she would receive an error. So how does this work in Git?

Version Control, Git-Style

Files are shared in repositories (digital storage areas). A programmer clones (or 'checks out,' as from a library) a copy of the software code from the repository. This is saved locally to what Git refers to as a staging directory. The programmer then works on the code, but all of the updates are saved to this local working directory. When the changes are complete, then the code is pushed out to the repository, or 'checked in.'


Clone: Think of a library checkout: The code is pulled from the remote server to a local directory.

Pull: Updates are brought down from the main server down to the local directory.

Commit: This is basically a save; committing the changes to your local repository.

Push: Or, check-in. This puts the changes back onto the remote repository.

The following example shows how the flow works in Git.

git operations flow

Source: By Daniel Kinzler (Own work) No InterWiki reference defined in properties for Wiki called "GFDL (http"!, via Wikimedia Commons

Sample commands

Here are a few Git commands. The following are practical applications of the concepts described above.

Check out a repository

git clone /path/to/repository

(For connecting to a remote server, use: git clone username@host:/path/to/repository)

Add file(s) to a staging area

git add <filename>

Commit files added with 'git add' plus any changes

git commit -a

Push the changes back to the repository

git push origin master

Create tags/versions

Use this to denote major versions or new release:

'git tag 2.0.0 <commitID>'

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account