Git Fish Prompt

Joshua Crass
3 min readJun 24, 2018

Here’s how I set up my fish prompt helping me with git on the command line. Which is the only way to “git” things done. I hope you find this useful.

Below is the default fish prompt.

username@host ~/.c/fish> 

Out of the box, fish prompt is already awesome and it has so many more great features already built-in. Git command completion and git prompt support are just a couple of them. It’s all documented in the fish repo, but you need to know where to look. Now what I find very useful when working with git on the command line is setting up my prompt to show me the state of my current branch. Below we’ll look at my prompt and I’ll explain a little about each part.

First, we have our branch named “staging”. It is in the middle of a merge and our local branch is 4 commits ahead and 5 commits behind the upstream branch. Next we see 1 staged file, 2 conflicts, 3 un-staged changes and 4 untracked files. Hopefully you don’t find yourself in this situation too often. See more examples at the bottom.

Fish Prompt Config

Lets’s start by creating a fish prompt file using your preferred editor (i.e vi).

~/.config/fish/functions/fish_prompt.fish

Now you can paste in the code below and edit it as you see fit. Fish has default icons which you…

--

--