In this article, I explain why Git by itself is not enough.
Git is not enough. Git is an amazing version control system, and all developers should be using at least some sort of version control system. However, traditional version control like Git is not enough.
My main issue with relying solely on Git is that it requires you to explicitly commit your changes rather than doing it automatically. I can think of too many instances where myself or another developer were working on a particular piece of code, only to lose progress for one reason or another, or want to go back to a previous version of the code, and because the code was not committed to Git yet, the changes were gone. IDEs usually do have local history functionality, but it's not necessarily great. For example, if your IDE crashes, the built-in local file history that your IDE usually comes with may end up being corrupted (these features can be surprisingly finicky, likely because the files used by them usually consist of large amounts of binary data rather than smaller individual copies of plain-text files), or your IDE may never have had it in the first place, and you're out of luck if you want to go back to a previous version of code. Another example would be a newer developer using git reset --hard
without understanding how it works, and accidentally losing all of their changes. I've seen it happen to newer developers, and it's not fun. Of course, Git does provide previous versions of code, but only what you commit - what if you forgot to commit (or stash) your changes? It can happen to anyone.
This is where something like the Sublime Text package Local History or VSCode package Local History become incredibly useful. Being able to have a copy of your files every single time you save the file, not just when you explicitly commit your changes to Git is incredibly useful and has saved myself and quite a few of my developer friends as well. The great thing about at least some of these plugins is that you can change the directory where the backup files are saved, so you can even save them to separate external drives, or even network drives rather than just relying on your internal drive which would be a single point of failure. Although, even simply saving a plain-text copy of every file you're working on to your internal drive is usually good enough combined with other solid backup principles and is certainly better than relying on an IDE's temperamental local history functionality.
I noticed that while Sublime Text and VSCode have packages for this plain-text file copy backup functionality, there are various popular IDEs out there that don't have any similar functionality. I decided to get to work, and I went and created some plugins myself using Java for some of the most popular IDEs. On my GitHub profile, you'll find various SaveBackup plugins I've written. For example, here are the ones I've written for Eclipse, NetBeans, and all JetBrains IDEs (IntelliJ IDEA, PhpStorm, WebStorm, etc) supporting version 2018.2 to the latest version.
Git is a fantastic version control system, and it's amazing at what it does. However, relying on just Git can be very dangerous and can cause problems for you when you least expect it. The peace of mind provided by the great plugins I've listed above is awesome, and it's certainly a great start. Being able to go back to a certain saved copy of any file you've worked on is amazing. A complete, combined approach is the best solution to ensuring you never accidentally lose your changes.