I have Git Bash on Windows and want to customize things with dotfiles. I'm new to all of this so thank you for any help and patience.
I am trying to follow the answers from Git for Windows: .bashrc or equivalent configuration files for Git Bash shell, but I think they are outdated with respect to the default install folder/file structure; for example, I can't find any .bashrc
or .bash_profile
files (except for the Shell file in screenshot below, maybe that is it?). I think the pertinent files are in profile.d
I have git version 2.36.0.windows.1
An example entry in the .alias
file might be something like alias mydir='C:/Users/name/Documents'
, and I'd like to be able to type cd mydir
into the Git Bash prompt.
This is what the installed folder looks like:
And this is what the ~/profile.d
folder looks like:
Open to recommendations, but after researching, I think I want to set up a folder called ".dotfiles" with a text file called ".alias" and another text file called ".functions" (i.e., ~/.dotfiles/.alias
and ~/.dotfiles/.function
). I want to have these as separate files rather than editing the text files from the installation in C:\Program Files\Git\etc\profile.d
.
I have two questions on this:
Where should the
~/.dotfiles
folder be located? InC:\Program Files\Git
?How do I add/activate all of the text files in my
~/.dotfiles
folder automatically in every session? I don't understand the syntax nor where this would go (maybe inC:\Program Files\Git\etc\profile.d\bash_profile.sh
?)
EDIT This is the content of C:\Program Files\Git\etc\profile.d\bash_profile.sh
:
# add ~/.bash_profile if needed for executing ~/.bashrc
if [ -e ~/.bashrc -a ! -e ~/.bash_profile -a ! -e ~/.bash_login -a ! -e ~/.profile ]; then
printf "\n\033[31mWARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile.\033[m\n\n"
echo "This looks like an incorrect setup."
echo "A ~/.bash_profile that loads ~/.bashrc will be created for you."
cat >~/.bash_profile <<-\EOF
# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
EOF
fi