Photo by veeterzy on Unsplash

Git is a lot of things. But one of the things I like the most about it is that it can be so painful to use, it is funny (as long as I am not the victim). From the classic XKCD comic to the Git Koans, I find those very entertaining. Some are even useful: Oh Shit, Git!.


The .gitignore file, as its name indicates, is a list of files git will not take track. It is the best way to stay organised, particularly because I work with Jupyter notebooks regularly (I do not wish to save the checkpoint folder), I also like to have a file hanging around in the project folder, as well as my virtual environment folder.

The git config Command (or the .gitconfig File)

Running git config --global will generate and "feed" the .gitconfig file.

  • git config --global help.autocorrect 10 to correct typos and run the reviewed version of the command after 1 second (the integer is in 10th of a second).
  • git config --global init.defaultBranch Main to change the default branch name to Main, for example (Master by default)
  • git config --global commit.template ./defaultcommitmessage.txt to use the defaultcommitmessage template every time you commit.
  • git config --global status to see the git status with git st instead of git status. If the autocorrect is activated, git corrects the aliases as well. You can even pipe external applications with !.
  • git config --global core.editor nano to change the default editor to nano, if you are not comfortable with vi.


As seen above, the.gitconfig file can manage aliases, and if managed by git, you will have access to the autocompletion of arguments as well. However, the .bashrc file can also be very convenient to manage those. I, for one, prefer the .bashrc way, and I have the following aliases setup:

alias gad='git add'
alias gco='git commit -m'
alias gdi='git diff'
alias glo='git log'
alias gll='git log --oneline'
alias gls='git log --stat'
alias gpu='git push'
alias gst='git status -sb'
alias gta="gig list |grep $@$" (this alias is to identify which keyword to use for the gitignore file)


git rebase is a powerful command acting on the commits. With it, you can fix a typo in a commit message, split a commit (or merge commits), and it can also move commits between branches. Suffice to say it is a little overwhelming at first!

Final thought

You probably feel like you suck at git… Do not worry. It is not you, it is git! It is one of these tools that takes a long time to master (if at all possible). As you can see from the many humorous articles about git, a lot is going on with the terrible user experience (Right now, I am thinking about the Hobgoblin).

rm -rf /repo
git clone git@...

Data Scientist

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store