This is the third in a series of blog posts around Git and a new feature in version 72, Git Version Control. See the full list of entries in this series at the end of this post!
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.
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.
A note from benny:
Want to be involved in the development process? Post your ideas, comments, and questions on the feature request. You can also join us in our slack or discord channels, post your questions on the cPanel forums or subreddit, or come visit Houston, Texas for the 2018 cPanel Conference, October 1st – 3rd. Need to catch up on the previous posts about Git Version control? Here they are!
- What is Git?
- Introducing the Git Version Control interface
- Introducing Gitweb
- Setting Up Git
- Git Problems and How to Fix Them
- Git Version Control: Soon with Automatic Deployment!