Recently I have been helping to create content to onboard new developers. One of the topics I prepared was Git. I have been using git for more than 12 years, and while doing research I was surprised to learn new things. So I decided to share some useful links with everyone.
First things first, in April Git turned out 15 years, so happy Birthday!
What’s git and how it changed the way we code. And check this quick article on how to get started with Git.
Super complete git cheatsheet. If you are looking for a printable version, check Github PDF cheatsheet.
If you are looking for some tutorials to learn the basics check BitBucket tutorials and an interactive way to learn branching.
You need autocomplete for the terminal. Check this tutorial on how to set it up
Also, I am lazy and I hope you too, so consider having some aliases for common commands. You can use something like git-alias or add your own to your terminal profile. Here are some of the ones I use:
alias gs=”git status” alias gpull=”git pull --rebase” alias gm=”git commit -m”
While most of the time I use the terminal, sometimes I reach for a UI editor. Here is a list of the top 10 UI clients. I have used Sourcetree a lot in the past.
I found this article and blowed my mind. I use git diff a lot before making commits (just to make sure I am not adding anything unnecessary). In Better git diffs with FZF Rafael Mendiola shows how you can improve the git diff experience, navigate through files and see previews on the right! NOTE: the exact command on the post did not work for me, but I used this instead:
fd() { git diff $@ --name-only | fzf -m --ansi --preview "git diff $@ --color=always -- {-1}" }
If you use VS code, then it is worth it to check GitLens extension.
Some Github pro tips. I am planning to try OctoTree soon.
Also if you use Github intensively check this list of recommended Github integrations for 2020.
Lastly, 2 advanced commands that can help you in your darkest moments:
I want to end with a funny story. While we were doing prep for the presentation, I was showing a quick slide on what Git is and someone asked me: What does Git stands for? Honestly, I did not know so I did some research:
Git is not an acronym, in slang “git” means “a stupid person”. Linus Torvalds when he created the first version name it “the stupid content tracker” and that is how Git was born!
Enjoy!!
Catch up with me on X (twitter):@juan_allo
---
@2024 Juan Manuel Allo Ron. All Rights reserved