Since the Midnight Commander overrides the PROMPT_COMMAND variable when it starts a new subshell, it is impossible to make a git prompt work without recompiling the mc. It is also an issue that the program has really poor documentation. It was quite hard for me to figure out how I can make it work:
- The major problem is hard-coded in the mc sources, so the attachment of this bug report should be applied to the mc sources and recompiled: https://www.midnight-commander.org/ticket/2027 (If you check the comments, the guys make flames instead of fixing the problem).
- When the mc is recompiled with the patch and installed, a new file should be created: ~/.mc/bashrc . This file contains executed commands when the new subshell starts, the example content of my ~/.mc/bashrc:
Happy gitting with bash & mc! :)