Before when I installed Windows 10 when I press the arrow down or up button inside Git Bash I get my previous entered commands. But now when I have closed Git Bash i lose all the commands I have ever entered. How do I get this back?
-
3the so called "history" is a bash feature. see this question (stackoverflow.com/questions/10488498/…) describing a similar problem.– SchwertspizeAug 10, 2015 at 17:54
-
Thanks fixed it by entering exit. It automatically makes a .bash_history file.– Raymond the DeveloperAug 12, 2015 at 15:00
2 Answers
Just enter exit
inside the Git Bash console. It will add or update a .bash_history
file.
-
4Effectively it works, but I don't think is a good solution. Why when we close the window of git bash it doesn't update the .bash_history? Sep 24, 2018 at 8:44
-
1You only have to do it once though. The next time you close the window it will save. Sep 24, 2018 at 11:24
-
7I thought also, but if I don't type
exit
it don't save the history Sep 24, 2018 at 12:34 -
-
Observing that I lost my history because of an automatic Windows update & reboot as well :-(– dbreauxFeb 14, 2019 at 14:23
This is a duplicate and has already been answered: https://stackoverflow.com/a/10901227/5243543
Put this in your ~/.bash_profile
PROMPT_COMMAND='history -a'