When you work with git you can define aliases to make your experience even more productive and elegant. In this short post I’d like to present aliases that I use frequently and how they work. And I’ll start with my favorite:
This command gives you the following output:
This command shows you all branches you recently worked on. That solves the usual problem of me forgetting the names of the branches I worked on.
When you want to switch to the last branch you worked on you can use
git checkout -
The alias is the following:
You can either add the alias to your config by executing
git config --global alias.[alias name] [alias command]. Alternativaly you can edit the `.gitconfig` file in your home folder.
This is a very useful alias. It’ll display all commits from the last 24h. This is the command to execute right before your daily standup to remind you of what you worked on the last day.
This is the alias:
git log --graph command is not very clear and therefore I configured an alias which gives a simple overview of all commits and branches.
In the end the alias is simply a sophisticated version
Skip & Unskip
This is not one alias but actually three of them. Sometimes you have files in the directories of your repository that don’t belong in there but it is also not appropriate to add them to the
.gitignore. In this case you can tell git to ignore these files and don’t put them into the worktree. By doing so you can’t stage them by accident.
The aliases are the following three:
The aliases for these are the following: