cPanel Git Version Control is a cPanel feature designed to make hosting Git repositories with cPanel.

Automatic deployment by default is also included to make sure that cloned cPanel-hosted repositories automatically pull new changes.

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.

What is version control?

A version control software keeps track of every modification to the code in a special kind of database.

If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

This is especially useful for teams where someone may be working on a new feature while another developer fixes an unrelated bug by changing code and each developer making their changes in several parts of the file tree.

With Git, you can easily:

  • Find the differences between two revisions.
  • Track every individual change by each contributor and help prevent concurrent work from conflicting.
  • 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).

 

Git Repositories

Git stores your data in databases called repositories.

You can create a repository on your cPanel account, or you can copy (in Git, “clone”) an existing repository. cPanel Git Version Control feature supports both options.

When you work with Git, you can have a single repository for your project, or advanced experienced administrators can have a multi-structured repository.

A simple Git setup using one repository.

A multi-layer setup with project-specific repositories that merge into the main repository. cPanel uses this kind of setup.

It’s great for projects that have multiple teams working on different things.

 

Git 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, it 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 also have repositories or branches that only exist on your cPanel account.

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.

 

 

Git 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 another change history.

When you commit changes, you also create a commit message to send with them. (Good commit messages to 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

Often, people only use Git on the command line.

When this feature is completely deployed, you can create and manage repositories and view change history in a friendly interface.

A lot of Git’s functionality requires good command-line knowledge.

But don’t worry, it’s easy to learn.

Esta resposta foi útil? 1 Utilizadores acharam útil (3 Votos)