To create a git hist alias in your Bash profile that:
- prints the history of the whole directory if no arguments are specified, and
- if a file or directory is specified, it shows the history of that,
you can add the following lines to your ~/.bash_profile
or ~/.bashrc
file:
# define a Bash function called git hist
git hist() {