Use -sb flag to get a shorter git status output without unnecessary noise

Tomasz Łakomy
InstructorTomasz Łakomy
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

git is an interesting tool for a developer - it's definitely the most widespread version control solution and even after using it for years, there's always something new to learn.

In this lesson we're going to learn a quick trick - how to use -sb flag in order to modify the git status command so it returns a shorter, more succinct info about the state of our changes.

We're also going to learn how to create an alias for git status -sb command so we won't have to type more in order to get a shorter output.

Instructor: [00:00] When working with Git in your brand-new project, you probably at some point want to check the status of your changes. The usual way of doing that is running git status. Right now, we can see that I'm working on my brand-new egghead.io workshop, and I have some files that need to be commented, I have some files that are not searched for comment, and I have some unchecked files.

[00:17] The thing is that the vast majority of this git status output is the info that I don't really need. Luckily, there is a better way to understanding what's the status of my changes without seeing all this excess info.

[00:27] The solution to that is running git status -sb, and sb stands for short and branch info. I'm going to see over here that I'm currently on the master branch and I'm going to push those changes to origin/master, and this is the status of my changes.

[00:42] I can see that I've appended a file, I've modified some, I've deleted some and I have some files that are unchecked. This is much more clear for me as a developer to understand what exactly is the status of my changes.

[00:53] To avoid typing more in order to get the shortest status output, we can set up an alias in our git config file. Right now, I have two aliases that git ask is going to run git status and git st is going to run status -sb. On my machine git ask is going to get me this usual output and git st is going to get me the shorter output.