Existem algumas maneiras diferentes de desfazer as coisas no git, mas para o propósito deste post vamos considerar o seguinte cenário: um repositório com cópias locais e remotas vários colaboradores um commit recente que já foi adicionado ao repositório remoto ("merged", pra usar o termo "git" em inglês) mas que precisa ser revertido git revert … Continue reading Como reverter um commit no git
Tag: command line
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: a repository with local and remote copies multi-person collaborators a recent change merged to remote (and potentially deployed) that needs to be reverted git revert to the rescue! ✨ TL; … Continue reading How to revert a commit in git
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 … Continue reading Managing local git branches with git rebase
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 … Continue reading Git, GitHub and GitLab. Are they all the same thing?
Sending docker container logs to a separate file
In a large web application, the backend logs can get quite verbose: requests created, sent, processed, received, etc. The list can grow large very quickly depending on how logs are implemented. You can check the logs from a Docker container using docker logs, no need to exec into the container: docker logs <container_id> You can … Continue reading Sending docker container logs to a separate file
Command line shortcuts
I normally don't use many shortcuts because it's easier to just use my arrows and mouse to navigate than to memorize shortcuts but I am slowly realizing that the time spent on learning a new shortcut pays off. However, my memory is not that great and if I try to memorize multiple things at once, … Continue reading Command line shortcuts
Add a filename in the command line when running a Python script
OR: Run a Python script with arguments You can add arguments to the command line when running python scripts by importing the sys module from Python's standard library and using its argv function. Some examples: A simple script that displays the user name: def main(): name = 'Frodo' print(f'Hello, {name}') if __name__ == "__main__": main() … Continue reading Add a filename in the command line when running a Python script
Customize your terminal prompt with colors
NOTE: the steps below assumes you have a Bash shell. If you are using a Unix machine (Mac or Linux) and are not sure what type oh shell you have, it's probably Bash. In most systems, by default, the prompt in the terminal (or command window) displays the hostname and the working directory but this … Continue reading Customize your terminal prompt with colors
Check which commands you typed in the command line and don’t repeat yourself!
Recently I needed to repeat a series of long~ish commands in the command line but I never quite memorized them so I ended up resourcing to arrow-up-arrow-up-arrow-up </ad nauseum> until I found the command I was looking for. But there is a better and super simple way: history Typing history in the command line will … Continue reading Check which commands you typed in the command line and don’t repeat yourself!
Docker for development: make local files visible to a container with volume mapping
I wrote a very simple right-to-the-point Docker introduction post if you're new to Docker. If you want to see your code changes applied right away to a running Docker container, you need to make sure to run the container using the share volumes tag: -v (or --volume). The -v tag expects as a parameter the … Continue reading Docker for development: make local files visible to a container with volume mapping