Tools & Tech

The Git Cheat Sheet

Git is one of the most popular Version Control Systems out there, you can think of it as a way to take snapshots (commits in Git nomenclature) of your code in a specific state and time, just in case you mess things up later and want to go back to a stable version of your code. It’s also a great way to collaborate if you combine it with GitHub.

Git is free and open source. You can download it from the official website. Once it’s installed you should be able to run Git commands on your terminal.

A couple of things you should know before starting to use Git:

  • When you want to keep track of the files in a project you put them inside a repository. A repository is basically a directory in which version control is enabled and always vigilant of what you put in there. It will know whenever any changes are made to those files, and it will help you keep track of them.
  • Each commit has an identifier in case you need to reference it later, this ID is called SHA and it’s as string of characters.
  • A working directory contains all the files you see on your project directory.
  • The staging index is a file in the Git directory that stores the information about what is going to be included in your next commit.

Create or Clone a repository

Create or clone a repository on the current directory.

  • Create repository from scratch: git init
  • Clone an existing repository: git clone <>...
  • Clone repository and use different name: git clone <>... new_name

Display information

  • Determine a Repo’s status: git status
  • Display a Repo’s commits: git log
  • Display a Repo’s commits in a compact way: git log --oneline
  • Viewing Modified Files: git log --stat
  • Viewing file changes: git log -p
  • Viewing file changes ignoring whitespace changes: git log -p -w
  • Viewing most recent Commit: git show
  • Viewing A Specific Commit: git show <SHA of commit>


“Staging” means moving a file from the Working Directory to the Staging Index.

  • Staging Files: git add <file1> <file2> … <fileN>
  • Unstaging files: git rm --cached <file>...
  • Stage all the files: git add .


Take files from the Staging Index and save them in the repository.

  • Commit staged files: git commit This command will open the code editor. Inside the code editor you must supply a commit message, save the file and close the editor.
  • Commit files without opening the code editor: git commit -m "Commit message"

Git Diff

  • See changes that have been made but haven’t been committed yet: git diff


Tags are used as markers on specific commits. These are really useful to assign a version to the code.

  • Add tag to the most recent commit: git tag -a <tag(v1.0)>
  • Add tag to specific commit: git tag -a <tag(v1.0)> <SHA of commit> -a is used to create an annotated tag, which includes extra information such as the date of creation and the person who made it. It is usually considered a good practice to add this flag.
  • Display all tags in the repository: git tag
  • Deleting A Tag: git tag -d <tag-name>


When a commit is made in a repository it’s added to the branch you’re currently on. By default a repository has a branch called master. Specially when experimenting with new features on your code, it is often useful to create a separate branch that acts as a safe isolated environment from your last commit. You can switch between branches and the commits will only be added to the one you’re currently on.

  • List all branches: git branch
  • Create new branch: git branch <branch-name>
  • Delete branch: git branch -d <branch-name> You cannot delete a branch you’re currently on. You cannot delete a branch if it contains any commits that aren’t on any other branch.
    • To force deletion: git branch -D <branch-name>
  • Switch between branches: git checkout <branch-name>
  • Add branch on a specific commit: git branch <branch-name> <SHA of commit>
  • Start branch at the same location as the master branch: git branch <branch-name> master
  • See all banches at once: git log --oneline --decorate --graph --all


When a merge is performed, the other branch’s changes are brought into the branch that’s currently checked out.

  • Perform merge: git merge <branch to merge in>

Correcting stuff

  • Modify last commit message: git commit --amend

Revert a commit

This will create a new commit that reverts or undos a previous commit.

  • Undo the changes made in a commit: git revert <SHA of commit>

Reset a commit

This will erase commits.

  • Reset commit: git reset <reference to commit>

Depending on the flag you add you’ll obtain a different result:

  • --hard flag to erase commits
  • --soft flag to move the committed changes to the staging index
  • --mixed flag to unstage committed changes

If you want to learn more about Git, Udacity offers this great course that covers all the basics and many more concepts in depth (for free!). I did this course myself and it served as an inspiration to make this summary about some of the main concepts I learned and now use in my projects.

Hope you got some value from this post 😊 see you in the next one!

Tools & Tech

Here’s Why You Should Buy a Kindle

Looking back at all the presents that I’ve ever been given in the course of my life, the Kindle I received for my graduation has been one of the most game changing. This little gadget has transformed the way I consume books. By reducing the friction of reading it has helped me read more frequently, and most importantly it has made me a more productive reader.

In this post I’ll be discussing the main features that make this device a must have for readers. Note: This list is not ordered by relevance.

  1. Instant word translation: ‘When reading on Kindle you get the meaning directly from the dictionary just by clicking any word. You’ll also get results from Wikipedia and Google Translate when connected to Wi-Fi. This a key feature for me as I usually read in English (which is not my native language) so I don’t have to reach for the phone whenever I don’t know the meaning of a word.
  2. Read in any light condition: Before Kindle when I tried to read on the bus on the way back home it was already too dark and I couldn’t see a thing. Now I use the adjustable light of Kindle which makes it easy to read in low-light conditions without damaging my eyes.
  3. Easy one-handed reading: I read whenever I have the chance, and that sometimes means reading while I’m having breakfast. Before Kindle I ended up grabbing the book one-handed in a weird way so I could eat breakfast with the other hand. Fortunately, those days are long goneπŸ˜‚. Now I can uphold it anywhere as if it were a phone.
  4. Buy instantaneously: Even though I love going to libraries on the search of the next book I must say that being able to buy a book anytime is a big plus, specially for whenever you don’t find a book so easily or in a certain language.
  5. Save paper: If you care about the environment, this one’s for you🌱. You can reduce your paper usage by reading on Kindle. Let’s try not to contribute to deforestation as much as we can πŸ’š.
  6. A portable library: I guess this is the obvious one, but also the most impactful for those who travel. In a Kindle you can bring a ton of books always with you without worrying about how you’re gonna fit them in the suitcase.
  7. Water resistant: It’s not like you want to read in the shower, but it feels safer to know that even if you’re outside while it’s pouring the Kindle is going to be fine.
  8. Notes and highlights: Being able to highlight and add side notes to the books I’m reading has been a huge game changer. I usually read non-fiction and enjoy highlighting the main ideas, export and check them later.
  9. Progress info: Kindle gives you information about how much time or pages are left until you finish a chapter/book.
  10. Cheaper books: Kindle books are usually cheaper than the hardback ones.
  11. Battery life: At Amazon they claim “A single battery charge lasts weeks, not hours.” and this is entirely true, I use it every day and lasts a surprisingly long time.
  12. Snippets and recommended highlights: As Amazon says, “With Word Wise, you can see simple definitions and synonyms displayed inline above more difficult words while you read.” You can actually choose the level of difficulty for which you want to receive these instant definitions.
Word Wise definitions and synonyms on Kindle.

Additionally, there’s another feature that shows which are most highlighted quotes of the books. Note: you’ll need Wi-Fi connection to use these features.

13. Goodreads sync: If you’re a book nerd you might have heard about this social network. With Kindle it’s easy to synchronize the book progress with your Goodreads account and write reviews directly from it.

These were the main points I could come up with, but I’m sure there are more.

Of course, you don’t get that “feeling of reading a hardback book”, but for me the aforementioned benefits far outweigh the lack of that sensation. Kindle has highly improved my reading experience and overall, it has made a better reader.

Hope this post was helpful in some way. See you in the next post 😊