This content originally appeared on foobartel.com :: Stream and was authored by foobartel.com :: Stream
Ever since Apple released macOS Catalina in 2019 and changed the default shell to zsh across its operating system, I’ve been meaning to follow this move and change my default shell from the good old bash to zsh.
With my current setup, I used a few lines from this profile to display the current git branch with the prompt. I never took the time to do some research and look into the topic, because all things shell is clearly not my comfort zone. Hence I also never found out how easy it could have been to get the same setup with zsh as I had all that time.
It seems that showing the git branch in Terminal is quite a common thing to do nowadays. I asked on Twitter and got some helpful pointers, and off I went into shell land.
I looked at Starship prompt, which works cross-shell, and with that I’m now running zsh as my default shell, inclusive of displaying the current git branch. Starship has a lot of options for configuration and you can easily pick the ones you need and like. It has a good documentation that without much time required, allowed me to add the options I wanted. After all, this wasn’t as scary or difficult as initially assumed.
I’ve switched my prompt to starship a few years ago and have found that largely eliminated any motivation to switch to zsh lol
That said, I’ve been doing fine with bash all those years and don’t use the shell to an extend that I’d notice all the advantages, but at least I got rid of the constant reminder of the new default shell and it feels like I’m up to date again.
I also found two more links that do the same without any additional tools, in case this is your cup of tea:
- Simplest ZSH Prompt Configs for Git Branch Name
- Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)
This content originally appeared on foobartel.com :: Stream and was authored by foobartel.com :: Stream
foobartel.com :: Stream | Sciencx (2022-01-17T23:00:00+00:00) Starship Prompt – Displaying the GIT Branch in Terminal. Retrieved from https://www.scien.cx/2022/01/17/starship-prompt-displaying-the-git-branch-in-terminal-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.