For several years now, Git has been a standard tool for every software developer. And rightfully so: Git has huge potential to improve the quality of your software development process! But much of that potential, quite sadly, remains unused. Only few teams are getting the most out of Git, for a couple of reasons.This is a guest post from Tower, a popular Git client for Mac and Windows.
The Problems with Git
Git is undoubtedly a main reasons why software development has become much more powerful and collaborative in the last couple of years. But besides these wonderful benefits, Git also comes with its challenges.(1) Complexity: Git is known (and almost feared) for its high complexity. Even after you’ve mastered the steep initial learning curve, many features remain difficult to use on a daily basis.(2) Advanced Features: Tightly connected to (1), many developers don’t have the time or motivation to go beyond the absolute basics: very often, the classic “commit, pull, and push” is all that’s being used. And understandably so: a developer’s day only has so many hours, and learning Git’s advanced features might not be a top priority. The predicament, however, is clear: Git has a lot to offer, but only if you take some time to discover and learn its more advanced features!(3) Productivity: Many Git commands require complex sets of parameters. Others are simply cumbersome and complicated by nature. Anyone who’s ever used Interactive Rebase, for example, knows that it’s (a) an extremely powerful tool but also (b) quite difficult to use.Using Git – despite all of its wonderful powers and potential – can often be a frustrating, time-consuming, and error-prone business. Let’s look at some ideas on how to deal with these problems!
A Better Way to Work with Git
I strongly believe that, in a lot of cases, the use of a graphical user interface can make a world of difference. But as co-founder of Tower, a popular desktop GUI for Git, I am naturally biased. Therefore, while trying to demonstrate – as objectively as possible – that Tower can be a great solution to the above problems, I will also offer additional, alternative ideas to deal with them!
Mastering Git’s Complexity
As already said, Git can be quite overwhelming – especially for beginners. Luckily, there are helpful (and free) learning resources available that can help through those early days:
Git Cheat Sheet: The most important commands (along with common options and parameters) on a single page, ready to be printed out and placed on your desk.
A desktop GUI like Tower is another way to keep Git’s complexity at bay. A good example is when you have to undo a mistake: Git offers lots of different commands and tools to undo mistakes. But, like always, you have to know these commands and how to use them!In Tower, we recently implemented CMD+Z as a keyboard shortcut: just like in your text editor, you can press it at any time to undo your most recent action. This is extremely powerful, because it works independent of what command you executed! A failed merge operation, an accidentally deleted branch or a push that happened to early… undoing all of these mistakes is as easy as pressing “CMD+Z”!
Learning Git’s Advanced Features
If you want to take the quality of your software development to the next level, you won’t get around Git’s advanced features. Just a couple of examples:
Interactive Rebase is incredibly valuable if you want to keep a clean and readable commit history. The ability to correct commit messages or even reorder, combine, and split commits is a real game changer.
Staging and discarding chunks or even individual lines in your changes helps you create more granular commits. And this, in turn, helps you stick to one of the Golden Rules of Version Control: only put changes from a single topic into one commit!
Git’s Reflog is a great safety net: it’s where Git logs all crucial actions, e.g. when you checkout, merge, commit, or cherry-pick. Knowing how to use this log can help you undo mistakes and recover lost data.
The “First Aid Kit for Git” is a wonderful (and free) little video series that covers all of these tools in 2-3 minutes each.If you’re using a desktop GUI like Tower, you will have easy access to these more advanced (and often: more complicated) features. Here’s an example of how simple it is to access Interactive Rebase via Tower:
Becoming More Productive with Git
Finally, if your goal is to become more productive with Git, I firmly believe there’s no way around a desktop GUI like Tower. The following examples are all things that Git on the Command Line simply cannot deliver; sometimes, a GUI not only “replicates” functionality from the CLI, but it adds new abilities on top:
No more passwords, tokens, SSH keys: Using Tower, you can stop wrestling with passwords, tokens, usernames, and SSH keys. After you’ve connected your GitHub / GitLab / Bitbucket / Azure DevOps accounts in Tower, cloning and interacting with a remote repository is just a matter of some clicks.
A better understanding of your changes: In a recent update, we completely overhauled Tower’s internal Diff Viewer. Now, it can highlight inline changes, allow you to show or hide whitespace changes, and display a file in its entirety. And on top of all this, it’s now completely customizable with themes!
Automations for the boring stuff: Tower takes much of the routine work off your hands. To take just two examples: (1) you don’t need to manually fetch updates from the remote server anymore and (2) neither do you need to remember stashing uncommitted changes before you pull/merge/switch branches. Tower takes care of these things for you, automatically!
Finally, here’s what some of our users say about Tower:If you want to give Tower a try, just download it from our website and test it 30 days for free.And if you want to find out more about how Waydev can help you, schedule a demo.Author: Tobias Günther, @gntr