Scenario: I prefer Mercurial, but I often have to deal with git repositories, so I end up using both of them on a daily basis. As such, I often print:
hg commit -m "message"
... where instead I want:
git commit -am "message"
... and vice versa.
I would like my bashrc file to be smart enough so that it can detect this confusion by first checking to see if the directory I am in has the ".git" or ".hg" and "fix" directories, the syntax is consistent.
Basically, I think what I'm looking for is a way to override both commands using the bash function (I know how to do this) and somehow check if the first part of the command starts with "hg ci -m" or " git ci -am "(I don’t know this).
I'm not sure if bashrc's aliases / functions can be expanded to this level of expressiveness, but I'm sure I'm not the only one who was bitten by this "confusion", so I wonder if someone has already come up with a solution.
source
share