What is Git? Git Explained

What is Git?

Git is version control software. Whenever you change Git-managed content, Git records it and stores the history of every change you’ve made. Git was designed for the Linux kernel, and it’s great for software developers. That’s not the end of what it can do, though. You can use it for any project that’s stored as files, like web design or document storage.

No matter how you use Git, any number of people can work on the same project at the same time without traffic jams.

Repositories

Git stores your data in databases called repositories. When you work with Git, you can have a single repository for your project, or you can have a more complicated structure.

A simple Git setup using one repository.

A multi-layer setup with project-specific repositories that merge into a main repository. It’s great for projects that have multiple teams working on different things.

Branches

Branches separate lines of development by “branching” changes off of the main repository’s history.  Git’s pretty flexible when it comes to how you use branches so you can manage them, however, works best for your team. Each person could have their own branch, or everyone might work on the same task-specific branches.

Nope, this isn’t a subway map! Just a peek at how Git branching might look over time.

You aren’t limited to working on a single branch at a time, either. Simple commands allow you to get changes and branches from the remote repository.  You can switch between (in Git, “check out”) those branches and manage them as needed. You can grab your teammates’ changes (in Git, “pulling”) in real time, too so you can incorporate them into your copy of the project as you go.

Commits

After you make changes, you can send them up to the main repository so that everyone can access them. To do this, you need a commit.

Commits package up your changes with author information and other change history. When you commit changes, you also create a commit message to send with them. (Good commit messages make Git really useful. There are some great guides to writing good commit messages.) Once you’ve got everything in your commit, you send (in Git, “push”) your changes to the main repository.

Using Git’s full potential

This post only describes the simplest uses of Git, but there are lots of other features to take advantage of! Among other things, you can easily:

  • Find the differences between two revisions.
  • View a line-by-line change history for a file, so that you can locate specific changes or who the author was.
  • Find log information, such as the commit author, date, and message.
  • Manipulate files and changes before or after you push them.
  • Solve merge conflicts when changes collide.
  • Discover when bugs were introduced through advanced version comparisons (bisecting).

Often, people only use Git on the command line. Soon, however, cPanel’s control panel will let you create and manage repositories and view change history in a friendly interface. A lot of Git’s functionality requires command line knowledge, but don’t worry! It’s easy to learn.

If you have any questions about Git, or if you would like to inquire about adding cPanel/WHM to your server with us (which will include a user friendly interface for managing Git), please contact us at sales@quadranet.com!

Source: K., Sarah. “Git Version Control Series: What Is Git?” CPanel Blog, 16 May 2018, blog.cpanel.com/git-version-control-series-what-is-git/.