Theodo apps

Mastering Git Like a Pro: Essential Tools and Techniques

In an ideal world, every commit that you make should represent one atomic change. But why do I describe this world as ideal? Shouldn’t Git help the programmer achieve this goal and thus gain in efficiency?

The fact is that as powerful as Git is under the hood, remembering the syntax of the commands to use is anything but obvious. Even with aliases configured, some operations require several lines of command!

The purpose of this article is to share with you some of the tools and techniques that I discovered since I began that exciting journey of being a programmer, helping you to stop seeing Git as a pain but as an ally.

I’m first going to show you some of the commands I use on a daily basis, then a software which will allow you to speed up your Git productivity, and finally tools to streamline your use of Git 🤯

In this article, I'll assume you know the basics of Git. If not, save it for later when you need help with tasks that seem simple but are actually frustrating!

My useful day-to-day commands

In this section, I will share with you some unknown Git commands that save me a huge amount of time every day.

gwip, or save your work in progress

Imagine: you’re at the end of the day, but you haven’t finished the work on your branch. You haven’t matched all the requirements, or worse, your code is buggy and your tests doesn’t work! In good conscience, you cannot push a commit for your current work, but you want it to be saved on the Git server because you spent time on it.

The solution is very easy to use, and it as a name: gwip!

When you type ++code>gwip++/code> inside your Git folder, you will stage all your changes, add a work in progress (WIP) commit message, and disable the CI/CD pipeline for this commit (your work is not finished, so no need to consume resources for your commit!).

Then, to undo it the next morning, just type ++code>gunwip++/code> inside your Git folder: your WIP commit will be undone, and all the files will return as unstaged 🙂

To enable it, just add these two aliases inside your ++code>.bashrc++/code>/++code>.zshrc++/code> file:

++pre> ++code>

alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'

alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'

++/code> ++/pre>

Note that the aliases ++code>gwip++/code> and ++code>gunwip++/code> are already provided by the Oh My Zsh Git plugin. Therefore, if you have this plugin enabled, there is no need to add the previous lines to your ++code>.bashrc++/code>/++code>.zshrc++/code> file.

Moreover, the two mains limitations of the ++code>git stash++/code> command disappear with gwip (your stashed changes aren’t synced to the Git server, and your stash history is shared between all the branches of your repo).

gwip demonstration
Look at the state of files that have not yet been committed (left panel) and the status of the Git graph (middle panel) when I type ++code>gwip++/code>/++code>gunwip++/code>

autofixup, or easily edit the content of a previous commit

To err is human, and it has already happened to me to forgot something in a previous commit or to make a typo on a variable name. Like any developer, you want to have a clean commit history and to not have a commit like “Fix the previous commit”. If it’s easy to modify the last commit by typing ++code>git commit --amend++/code>, it’s immediately getting more complex when you want to modify an older commit. Your solution: the autofixup!

This command is indecently easy to use: stage the changes you want to add to your previous commit, type ++code>git autofixup++/code> in your terminal, select the commit you want your changes to be added, and that’s all!

For the setup of this command and a detailed explanation of how it works, you can read this article of my colleague Pierre Poupin on Theodo Apps blog.

autofixup demonstration
Look again at the left and middle panels during the autofixup process

Lazygit, one tool to rule them all

What does this amazing tool do?

You’ve probably already realized after committing several changes that an old commit message contained an embarrassing typo. The first time, you said to yourself that it shouldn’t be complicated to modify. Your best Google search will then take you to the official GitHub tutorial about changing a commit message, where you discovered that this operation has six steps!

That’s where Lazygit comes into play. This tool, with almost 50k stars on GitHub (when React Native is at 120k, which shows its popularity), promises us an interface for all those Git operations that seemed so laborious before.

While returning to the example of renaming a past commit, you now have no need to remember complex commands: just click on the commit you want to edit, select the reword option, push your changes, now it’s as simple it should have been!

Lazygit demonstration
The ease with which I change the message of this commit is indecently easy, isn’t it?

The best: in addition to being incredibly complete, Lazygit is a free open-source software, which is moreover very easy to install 🥳

The software is displayed inside the terminal after typing the ++code>lazygit++/code> command in your Git repo. Don’t be frightened by this sentence, because its interface is actually very easy to understand, and can be controlled either with your mouse or your keyboard. In fact, being displayed in the terminal is currently a force, because the software interfaces itself with the same environment you use on a daily basis.

With Lazygit, you’ll now be able to do all the things you’ve always to do with Git but were afraid to do for fear of spending all day!

Here are just a few of the actions facilitated by this incredible software:

  • Stage individual lines
  • Interactive rebase (this the feature that allows you to rewrite your commit history, like reword a previous commit message, squash two previous commits into one, or reorder commits)
  • Cherry-pick (copy and paste of a commit)
  • Bisect (helps you to quickly find the commit which introduces the bug that you rack your brain with)
  • Undo (an easy way to cancel your last action by pressing ++code>z++/code>)
  • Display a commit graph
  • Compare two commits
  • Create a pull request

For more information, feel free to read the official features presentation, which includes numerous animations demonstrating how the software works!

Finally, you should know that Lazygit is a highly customizable software. You can both modify the pager and add commands (command suggestions from the community, such as a Commitizen integration, can be found on this page)!

But how much time will I save with Lazygit?

To convince you of the efficiency of this fabulous tool, here's a comparison of the time it saves me on some complex Git operations, assuming I already know the commands to type in each case (which is rarely the case with Git on CLI!).

Git on CLI Lazygit Time saved
Reword a previous commit message 22s 8s 64 %
Add changes to a previous commit 34s 9s (and 7s with autofixup 🙂) 74 %
Squash two previous commits into one 21s 12s 43 %
Cherry-pick a commit 12s 12s 0 %
Undo last action 16s 5s 69 %

In this way, Lazygit saves me an average of 56 % time on my Git operations. Assuming I don’t know which commands to enter beforehand, my time using Lazygit will not be significantly increased as the software is very intuitive, while my time using Git on CLI will explode as I’ll have to Google the way to do it.

Last but not least, for all those who think that only a few tens of seconds on an operation is negligible, my view is that by reducing the mental workload associated with Git usage, you stay more focused on the heart of your project.

Tools to improve your developer experience with Git

In this final section, I will introduce you tools which work around Git and that help me to streamline my Git usage 🙂

Use Warp

Maybe you already know it: Warp is a modern terminal, boosted with AI. If it is full of qualities, the one I’d like to come back to in this article is its AI autocompletion.

Suppose that you work on a wonderful new feature. You then decide to create a new branch on your local Git repo. At a moment, you want to push it, so you type ++code>git push++/code>. Wait… it doesn’t work! Indeed, your brand new local branch doesn’t exist on the remote and has no upstream, and if you know you have to use a special command in this case, you didn’t remember it. Of course, you can use Lazygit which will abstract all the complexity for you. Better, you can take advantage of this to set up an alias for this command, so that you don’t find yourself in this situation in the future.

But even if it’s great, you don’t want to run Lazygit for such a simple operation, and you don’t already have an alias configured for this operation. That’s where Warp comes in handy, by smartly suggesting the correct command you need to insert to get the job done, without any action on the part of the user!

Warp AI can also suggest a command that you have described to it using a prompt.

Warp demonstration
Warp AI can both correct commands and suggest new ones


Clear commit messages are better. Remember the beginning of this article: “every commit that you make should represent one atomic change at a time”. The commit message should clearly represent this change and follow a standard template to enable other users to quickly see if the commit is about the addition of a new feature, a bug fix, or a refactor.

That’s the whole point of Commitizen. This tool will assist you by offering you several fields to fill in to help build a clear commit message.

Additionally, Commitizen is a versatile tool that can easily meet your needs due to its various adapters. These adapters allow you to skip or customize questions, use emojis, and much more!

Commitizen demonstration
With Commitizen, I'm guaranteed a clear, complete and standard commit message!


That’s all! Thank you for following me so far through this article, which presents my use and my tips to be more efficient with Git. Each developer has different expectations, so everyone will use its favorite tools.

Finally, here are some tools and practices that I didn’t mention in this article. Perhaps for a part II if you feel like it? 🙂

  • Configure Git aliases for basic Git prompts (warmly recommended!)
  • Git Tower, a powerful Git client with a real windowed interface
  • Visual Studio Code source control panel, and some extensions for it that I use every day, helps to save time used intelligently in combination with Lazygit
  • Building custom scripts around GitHub CLI to speed up your Git flow (such as a script to automatically create a PR and a Slack message to request a review)

Développeur mobile ?

Rejoins nos équipes