This is my first time posting, so please go easy on me if I'm making any mistakes. ;)
Currently when I use Git, the color of the branch is always Cyan. I was watching a video on how to use Git, and the instructors branch name would change from Red, Yellow and Green depending if files were untracked, staged and committed. I'm using a dark theme, so I'd like to change the colors from always being Cyan to something else. I've searched for answers on this, but the things I'm finding have to do with changing colors of files and branch names, but not as an indicator of what is going on in the branch. Would anybody be able to walk me through how to change the colors?
I did searches on the internet and found all sorts of ways to change colors of files and branches, but these were static changes... I think I'm looking for a dynamic change of the branch status. This article seems to address what I want, but it is for Mac OS, and I'm using Windows. I read this article on how to change colors, but I'm to green to understand exactly what to do, and I'm afraid of messing things up that I can't fix. I also want the changes to be Global. Thank you in advance for taking the time to read my question and answer if possible. Any help would be greatly appreciated.
CodePudding user response:
Git does not have this built in.
Some shells (command line interpreters) have ways to fiddle with the "shell prompt"—the %
or >
or $
or ~/src/project1 >
or whatever that you choose to have the shell print for you when it's expecting you to enter a command—such that it can include the current Git branch name when you're in a Git repository.
The bash and zsh shells in particular can do this, and it's desirable enough that Git comes with a set of bash-and-zsh scripts that do do it. But they don't fiddle with the branch name's color in the way you talk about. Zsh comes with its own (separate) scripts that also fiddle with the prompt, and some of those may do the color-changing tricks you mention.
Again, none of this is part of Git itself. You'll need to install or write1 a command line interpreter that has the capability, then install or write appropriate prompt-setting code. Since Git-for-Windows comes with a bash port (see git-bash), you can use bash, but you'll still have to find (or write) a prompt-setting system that does what you want.
1Writing a decent command line interpreter is an excellent exercise for learning your OS, but you should allocate a significant amount of time here.