.bashrc file, terminal prompt that shows current git branch, Arduino setup, Eclipse setup, git diff with line numbers, helpful scripts, improved Linux productivity, etc.
When installing Git For Windows, which also has Git Bash, be sure to check the box for (NEW!) Add a Git Bash Profile to Windows Terminal, as shown in blue here in the Git 2.42.0 setup:
Choose Sublime Text as your git editor (Sublime Text should have already been installed).
Override the branch name, and set it to main:
For line endings, I prefer to use Unix style line endings (LF), instead of Windows style (CRLF), even on Windows. So, choose the core.autocrlf = input option, as shown here:
I've noticed, and I don't know why, that sometimes Git Bash sets your HOME (~) directory to /u/, which is super weird, instead of to /c/Users/myusername. To check this, run echo ~ or echo "$HOME" (same thing). If you see /u/, that's not right. You should see something like /c/Users/myusername instead. The first / in an absolute path in Linux or in Git Bash represents the filesystem root, just like C:\ does in Windows.
So, if your HOME dir is not right, open up the profile file in your Git Bash root folder in a text editor. It is located at C:\Users\myusername\AppData\Local\Programs\Git\etc\profile, for example. If you have MS VSCode installed, you can open this file for editing in VSCode by running the following in Git Bash:
# open this file for editing in VSCode
code /c/Users/$USERNAME/AppData/Local/Programs/Git/etc/profile
Add the following to the very top of this file. Be sure to use Linux-style forward slashes (/), not Windows-style backslashes (\), in the path. Note that "GS" here is just my initials, so I can be reminded that I made this change and added this comment:
# GS: Manually fix the HOME dir
HOME="/c/Users/$USERNAME"
Save and close the file when done.
Close and re-open any Git Bash terminals you have open, to finalize this change.
Run echo ~ or echo "$HOME" again to verify that the home folder is now set correctly, and now shows /c/Users/myusername.
Installing Git For Windows
When installing Git For Windows, which also has Git Bash, be sure to check the box for
(NEW!) Add a Git Bash Profile to Windows Terminal
, as shown in blue here in theGit 2.42.0
setup:Choose Sublime Text as your git editor (Sublime Text should have already been installed).
Override the branch name, and set it to
main
:For line endings, I prefer to use Unix style line endings (LF), instead of Windows style (CRLF), even on Windows. So, choose the
core.autocrlf = input
option, as shown here:Check the box to enable symbolic links:
Check these two boxes too:
Fix the
~
(HOME
) dir in Git Bash, if necessaryUpdate: see my new answer here to solve this problem: Change the location of the
~
directory in a Windows install of Git BashMy original notes:
I've noticed, and I don't know why, that sometimes Git Bash sets your
HOME
(~
) directory to/u/
, which is super weird, instead of to/c/Users/myusername
. To check this, runecho ~
orecho "$HOME"
(same thing). If you see/u/
, that's not right. You should see something like/c/Users/myusername
instead. The first/
in an absolute path in Linux or in Git Bash represents the filesystem root, just likeC:\
does in Windows.So, if your
HOME
dir is not right, open up theprofile
file in your Git Bash root folder in a text editor. It is located atC:\Users\myusername\AppData\Local\Programs\Git\etc\profile
, for example. If you have MS VSCode installed, you can open this file for editing in VSCode by running the following in Git Bash:Add the following to the very top of this file. Be sure to use Linux-style forward slashes (
/
), not Windows-style backslashes (\
), in the path. Note that "GS" here is just my initials, so I can be reminded that I made this change and added this comment:Save and close the file when done.
Close and re-open any Git Bash terminals you have open, to finalize this change.
Run
echo ~
orecho "$HOME"
again to verify that the home folder is now set correctly, and now shows/c/Users/myusername
.Also do this
See also