re: Productivity 101: Git Aliases for Lazy Developers VIEW POST

re: Why put git aliases in the .bashrc file? This implies a specific shell, in a specific OS (or set of). I have aliases in my .bashrc, but none of th...

I think a lot of devs like a single source of truth for all of their aliases, regardless of the tools the aliases interact with. Both approaches are absolutely acceptable. No need to "bash" anybody else ;)


It's the OO dev in me - Single Responsibility Principle. ;)

Could you not apply that same principle to a .bash_profile with all your system's aliases?

Of course, but I wouldn't put things like this into .bash_profile - .bashrc is preferred (for me). I'm not always in a login shell.

To me, git configuration, like shortcuts & PGP keys (that I shared with the OP) should be in the .gitconfig file, so if I'm looking to change them, that's the first place I'd look (on someone else's system/login).

CLI shortcuts, such as renaming "git" to "g" are correct in .bashrc - and indeed, you could reference git aliases from bash aliases, but at some stage, I think we descend into acronym hell. gpf expanding to git push -f would be OK, but I've seen some bad examples too.

code of conduct - report abuse