问题
I am running Git-1.8.0-preview20121022 on Windows 7 and the install was with "Git Bash Only" (least intrusive to Windows cmd).
When I open the Git Bash from the start menu shortcut, everything is fine with the history.
But when the Git Bash here
context menu (either the git-cheetah
shell extension one or the simpler registry one) is what launched a session, the commands from that session are not saved to the .bash_history
.
How could figure out why this is happening? Or better yet, does someone know how to fix this?
回答1:
You should be able to fix this by adding this line to your ~/.bash_profile
PROMPT_COMMAND='history -a'
回答2:
Putting
PROMPT_COMMAND='history -a ~/.bash_history'
into the .bash_profile did it for me.
来源:https://stackoverflow.com/questions/14199462/git-bash-here-is-not-preserving-bash-history-between-sessions