It gives me information that I find generally useful, but doesn’t get in the way of my work. There are even PS2, PS3 and PS4 prompts that you can configure! I like that my prompt is simple, but informative. You can manipulate your prompt in a huge number of ways.
![git create branch from terminal git create branch from terminal](https://www.devopsschool.com/slides/git/using-git-with-gui/images/source-tree-for-git.jpg)
Republic of Ireland export PS1="\>\>\e>\ " You can recover from a temporary change by closing the terminal and opening it again, or changing PS1 to something else.Īmerica export PS1="\>\>\>\ "įrance export PS1="\>\>\>\ " bashrc file to make the change permanent.
![git create branch from terminal git create branch from terminal](https://n7ren.com/static/5e1f7148db94baf8bdad37656da7ad98/c1c45/terminal-git-show-branches.png)
Set them temporarily by running the below commands or add one to your. Some other fun promptsĪll of the following result in prompts that look like ‘»>’ but in a variety of national flag colours. Redirecting the output stops these sorts of error messages from polluting your prompt. ~ $ git symbolic-ref -short HEADįatal: not a git repository (or any of the parent directories). This part is important because git symbolic-ref -short throws an error when you’re not in a git managed directory and we don’t want that error to show up in our prompt. The command itself just prints out the current branch and redirects any errors away to /dev/null. The git command runs in a sub-shell (that’s why it’s wrapped in $()).
#Git create branch from terminal full
‘w’ is the full path if you prefer, but it’s often too long for my liking. (Using this as-is would recreate my prompt but using your default terminal text colour.) If we strip those out we get something that’s a little easier to read: export \W \$ " The bits that look like ‘’ are ANSI colour codes – which you can see lots more examples of here – and they set the colours you see in the prompt. ‘PS1’ is where bash keeps your default prompt configuration. (You may need to side-scroll to see all of it, sorry!) This is what I came up with: export \\W\ \\$ "
#Git create branch from terminal update
With that in mind I set out to update my prompt myself and came up with what you see above. When I’m working in a terminal session, simplicity and reliability are key.
![git create branch from terminal git create branch from terminal](https://3.bp.blogspot.com/-4ZkfQ3Kx06c/W8_ttOgU0LI/AAAAAAAANAc/o_wtUOlAx2cgTkUeb8_COG1afa9KN-Y4wCLcBGAs/s1600/lazygit_9_viewing-commit-diffs.png)
I don’t need anything particularly fancy looking. This approach is much lighter though, since it doesn’t rely on installing anything and is specifically tailored to my needs. It was in part inspired by one of those fancy shell add-ons, like gbt, that does some of this and lots more. What does it show?Įach of these things automatically updates (as required) each time you run a command in the terminal. The people who’ve asked me about it have wondered what it shows, how it was done and how they can do it for themselves, so I thought I’d write it up for anyone that might be interested. I’ve been asked a few times recently about the prompt I have in my terminal.