How-To

Mar 22, 2023

Git Squash Tutorial: How to Combine Git Commits for a Clear and Organized Commit History

A while back I wrote about managing local git branches with git rebase and I mentioned that I always submit my code changes with one commit only. No matter how many commits I make during my development process in my local branch when I prepare my code for code review and push it to remote, I squash all commits into one single commit, with one single commit message using git rebase.

Nov 08, 2022

Como reverter um commit no git

Existem algumas maneiras diferentes de desfazer as coisas no git, mas para o propósito deste post vamos considerar o seguinte cenário:

Oct 11, 2022

How to revert a commit in git

There are a few different ways to undo things in git but for the purpose of this post we will stick with the following scenario:

Mar 03, 2022

Managing local git branches with git rebase

When you work on a codebase with other people, you need to manage your local branches: you need to ensure that when you push some code and create a merge/pull request on the remote branch, your changes will be easily integrated with the main codebase. And by “easily” I mean preferably without merge conflicts or the dreaded message “your branch is xxx commits behind the target branch”. ?

Jun 30, 2021

A caller id for your python function

Most of you might be too young to know this but there was time that the phone in your house - not in your pocket! - would ring and gasp! you had no idea who was calling! You had to ANSWER the phone to find out. :scream:

May 26, 2021

git stash 101

git is a very useful tool for software development and you only need to know a few commands to get most of the job done. However, you can be a lot more productive if you go beyond the basics.

Oct 14, 2020

Developing inside a Docker container

A few months ago I got a new computer and I have been very intentional about deciding what I install on it. From past experience I know that computers that are used as a development environment tend to get messy in no time since one might install all kinds of libraries, frameworks, dependencies, you name it, and to makes matters worse, you will probably run into version conflicts for any or most of those things. Hardly ever a development environment is a clean environment and I don’t know about you but there are very few things that I find more frustrating than wasting time troubleshooting development environment set up. Let me write the code already!

Sep 02, 2020

Git, GitHub and GitLab. Are they all the same thing?

A few years back when I got serious about learning to program to become a software developer, I remember hearing about version control and getting really confused about git and GitHub (one can add GitLab to this list also!). Are they the same thing? Eventually, I figured it out but this past week in a conversation with a coworker, who is interested in getting into software development, I noticed that they also were confused about this so I decided to write about it.

Mar 26, 2020

How to upgrade Rails

I don’t write much about Rails here but whoa, two posts in a row! Well, it turns out that I thought I should record another lesson I learned while upgrading Rails: how to do it, meaning, what are the practical steps one should take to upgrade Rails?

Mar 08, 2019

Display nested dictionary content sorted by key in Python

Given a nested dictionary like this: dog_breeds = { 'Labrador Retriever': {'life_span': 14, 'male_weight': '36 Kg', 'female_weight': '32 Kg'}, 'Beagle': {'life_span': 15, 'male_weight': '11 Kg', 'female_weight': '10 Kg'}, 'German Shepherd': {'life_span': 13, 'male_weight': '40 Kg', 'female_weight': '32 Kg'}, 'Jack Russell Terrier': {'life_span': 16, 'male_weight': '8 Kg', 'female_weight': '8 Kg'}, 'Rottweiler': {'life_span': 10, 'male_weight': '60 Kg', 'female_weight': '48 Kg'} } here’s a way to display its content sorted by key: