Last week we shared our top tips for using Github and this week we’re looking at Git! A VCS (Version Control System) is an essential tool for modern development and collaboration and at trivago we use Git as our distributed version control system library.
As a well known and mature tool, it allows us to put “our mark in history” with ease and simplicity, while letting us decentralize our code base fostering collaboration among all teams.
This week we’re sharing some of our day to day tips on using Git. Automation, better TUI (Terminal User Interfaces), or just that missing Github-like diff output in your terminal – we make Git nicer and more fun to use everyday!
Tip #1 Fancier diffs
Looking for a better, fancier `git diff` output?
Enter diff-so-fancy. You’ll get improved colors, word-level diff highlights and much more.
Tip #2 Git terminal user interface
Prefer a TUI instead of a GUI for your daily Git?
Give “Tig” a try. It provides all the commands you’ll need at your fingertips in your terminal, right when you need it.
Tip #3
Did you make two or more unrelated changes in the same file? You can put them into different commits with git add --patch
. It will go through all changed sections and ask you if they should be staged or not.
Tip #4
Ever got confused by “rev” and “ref”? A reference points to one commit. Tags and branches are refs. Revision is a different word for commit. When a git asks for a rev it can be a hash, reference, or more. Some examples:
Tip #5
Ever got stuck in Vim while committing from the command line? While great, some people prefer a more visual approach. Change the editor git uses and try the -w flag of your editor.
Thanks for subscribing. We wish y’all a great weekend. 🥳
Yours,
trivago