Dealing with PATH and Bash in Windows 10

This post serves as a convenience reminder to myself and possibly others on how to manage working within Git Bash and Command Line in general within Windows 10. It can be a real pain in the neck to deal with PATH.

Git Bash Notes:

Windows PATH Tips/Instructions:

  • Control Panel > System > Advanced > Environment Variables
  • Edit Path to add a folder or System Variable
    • Add a folder: Point the resource you need by adding a folder path without the .exe
    • Add a System Variable: First point the directory and assign a variable name by adding to the System Variables. Next append the name of the variable to the Path ( ex. %JAVA%; ).
  • Windows Environment Variable added without restarting (ha): https://serverfault.com/questions/8855/how-do-you-add-a-windows-environment-variable-without-rebooting
  • Add things for convenience like c:/eclipse/ and then simply type eclipse to open the IDE

.bash_profile/.bashrc Examples:

https://www.tldp.org/LDP/abs/html/sample-bashrc.html

https://gist.github.com/susanBuck/ee3a0a53d72198c1a244

My example .bash_profile:

# Upon open go to my dev directory cd 'C:\Users\AlexanderRamsey\dev' 
# Launch Sublime in current dir 
alias sublime='subl.exe .' 
# Launch python in git bash 
alias pyth='winpty py' 
# Search history. Example usage: histg foo alias histg="history | grep" 
# Handle history among multiple windows 
# Avoid duplicates 
export HISTCONTROL=ignoredups:erasedups  
# When the shell exits, append to the history file instead of overwriting it 
shopt -s histappend 
# After each command, append to the history file and reread it export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

My example .gitconfig

[color "diff"]
meta = yellow bold
[alias]
st = status
ch = checkout
co = commit
s = status
p = pull
d = diff

Sublime Text Config File

{
 "font_size": 12,
 "hot_exit": false,
 "ignored_packages":
 [
 "Vintage"
 ],
 "remember_open_files": false,
 "tab_size": 3,
 "theme": "Adaptive.sublime-theme"
}