cPanel® Blog

Git Version Control series: Introducing Gitweb

This is the third in a series of blog posts around Git and a new feature coming in version 72, Git Version Control. You can see the first post: What is Git? Last week we showed you the new Git Version Control interface. Keep watching for a new one every Wednesday! 


If you follow our feature request site, you already know about our upcoming feature, Git Version Control. We’re designing it to make hosting repositories as easy for developers as a “Hello World!” script.

Alongside our feature, we’re also shipping a great application that’s developed by Git: Gitweb. It’s a fantastic tool for exploring your repositories from within a simple interface. (Remember, if you need help with some of the Git-specific terms in this post, check out Git’s gitglossary.)

What is Gitweb?

Gitweb makes finding information a whole lot easier than doing it on the command line. It’s comparable to some of the features included with paid Git hosting, without that pesky “paying for it” part.

Gitweb organizes your repository’s information into reports. Summary reports give you the high-level data. Detailed reports let you “drill down” into the specifics. When you navigate between commit-specific reports, Gitweb keeps everything within that context. You can also search within repository information and within the files themselves.

Gitweb may be especially helpful if you’re using our new feature to manage deliverable code. You could show changes, like website designs, to your clients without worrying about unwanted edits. All they’d need is access to a cPanel account.

Explore your repository

Gitweb’s simplest functionality allows you to browse your working tree. In oversimplified terms, the “working tree” is Git’s name for the file structure for a commit. The default shows you information from the HEAD commit, but you can also view previous versions. You can view this without Gitweb, but sometimes it’s more convenient to have it all at your fingertips.

Let’s say you want to check the contents of a file several commits ago. Without Gitweb, you’d check out that commit and then use a command-line text editor (or other tool). With Gitweb, you just locate the commit, view the working tree, and click on the file you want. Git and Gitweb call this a “blob,” but all you really need to know is that it’s the file contents.

Compare versions

Maybe just viewing a file as it was in a specific commit isn’t telling you everything you need to know. Maybe you need to evaluate line-by-line changes that came into the project recently. Maybe you need to figure out when something was added or deleted. You can view this from the command line, but it can be hard to work with. You’ll have to find what you need in a wall of not-so-pretty text, and digging deeper means running more commands.

Gitweb lets you view a comparison of two commits (a “diff“) from a couple of different reports. When you’re tracking down changes, diffs are your best bet. You can view the diff for the entire working tree or just one file, and you can compare each commit against the HEAD commit or any other commit in the project.

You can even switch between report formats. View changes side-by-side or inline, whichever suits your mood.

Investigate your project’s history

Sometimes, a diff only leads to more questions. Gitweb gives you access to some of Git’s most powerful historical tools to help you answer those questions.

You can find reports for:

  • The history of changes to individual files, so that you only have to sift through the relevant commits.
  • The branch’s logs, so that you can quickly reference recent commits in both short and long formats.
  • Each commit, so that you can view the commit message and other relevant information. That includes each commit’s author, so that you know who to blame.

If you don’t want to wait for our Git Version Control feature, you can use the default Gitweb interface with most existing repositories. Simply run git instaweb and Gitweb will open in your browser. It won’t look quite like what you’re seeing here, though, We’ve done a little bit of customization.

If you already use Git, we hope that this feature will knock your socks off! If you don’t, we’re hoping we can help you start!

Want to be involved in the development process? Post your ideas, comments, and questions on the feature request.