“Git Bash here” is not preserving bash history between sessions

本小妞迷上赌 提交于 2019-12-10 02:50:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!