franmon franmon - 3 months ago 20
Git Question

.bash_history does not update in Git for Windows (git bash)

I am using Git for Windows (ver. 1.7.8-preview20111206) and even though I have a .bash_history file in my HOME folder, it never automatically gets updated. When I start Git Bash, I can see in the history commands that I manually added to the .bash_history file, but it does not get updated automatically.

I used the

shopt -s histappend
command to make sure that the history gets saved every time I close the shell, but it does not work.

If I manually use the
history -w
command, then my file gets updated, but I would want to understand why the shopt command does not work as I understand it should.

Anyone can tell me why is this behavior happening?

Thanks in advance

Answer Source

I put this in my ~/.bash_profile

PROMPT_COMMAND='history -a'