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 4 years ago
Updated 3 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.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today