DEV Community

Discussion on: Learn Git good practices!

Collapse
 
zanothis profile image
zanothis

On the rare occasions that I've had someone looking at my screen and curious about how I just did something with git, I've been able to explain that I have an alias for it. I can then pull up my aliases to explain the alias they just saw.

Aliases are powerful tools that can give you the power to do more with fewer keystrokes. If there's an alias that I can't remember, I have an alias that lists my aliases (this is still generally faster than looking at the documentation). When I switch branches, it automatically fetches.

They also save valuable space in my head so I don't have to memorize the formatting options for git log --pretty. The flag name there may even be wrong, I don't know and I'll only care the next time I need to format the output of git log.

TL;DR

Aliases are there to increase my productivity and be as memorable as possible, not to be clear.

Collapse
 
pierrelegall profile image
Pierre Le Gall

I understand your point of view, but it's not mine as explained in my previous post.

I prefer to have a gitconfig without alias and to use a « more graphical » Git interface. I use the Git CLI and magit (which is full of default keybindings and integrated into my code editor of choice). This allows me to avoid black magic Git aliases.

If you want to have a pretty git log, the best way is to config your log output like this:

[log]
    abbrevCommit = true
    decorate = true
    date = relative

You can found my gitconfig here, certified alias-free ;p

Thread Thread
 
zanothis profile image
zanothis

I'll give it a look, I'm sure I'll see some settings that I like. I'm probably not going to give up using aliases since I've yet to find a more graphical interface that I like better than the CLI. But if I can find some defaults that allow me to remove an alias or two, it's one less alias to have to worry about.