

When I have added/modified/deleted many files (since the last commit), I like to look at those modifications in chronological order. Or (for a bit more information, including untracked files): git status.

#Git status ignore untracked how to
Mastering Git: How to Use Shell Commands to Reset and Delete Untracked. But what if you wanted to stash untracked files of your current working directory? In order to stash untracked files, add the “–include-untracked” option to your “git stash” initial command. As you probably noticed before when creating stashes, stash only saves tracked files of your working directory by default. The flag is also available for commands like push or blame. If you want to find out more about version two, head over to git status documentation.įor advanced automation using git, -porcelain is the way to go. Without a defined version -porcelain uses the v1 format that you have seen in this post. The last thing I learned is that -porcelain comes with different included versions (remember the backward compatibility promise). That's cool! Different versions of git status -porcelain porcelain guarantees that there won't be backward-incompatible changes to the output so that your scripts won't break with a git update.įor compact display with color guidance, you can use git status -s, and if you're automating git workflows, you can use git status -porcelain. In that case, you don't want to have help text and terminal colors included in the output.Īdditionally, you also don't want that the output differs from git version to git version. Imagine running some automation that checks the status of a git repository before running further commands. So why's that? It turns out that the -porcelain flag is used to generate output that is script-parseable. The difference between git status -s and git status -porcelain This formatting and color highlighting are missing when using -porcelain. This highlighting makes it easier to read. Git status -s highlights the characters that give information on the files' status. > git status -sĪt first look, these two flags seem to be very similar, but there is one difference that is only visible in the terminal. After reading the documentation, I found out there is also a -s or -short flag. Using git status with the -porcelain flag is more efficient. When you run git status with the -porcelain flag, the displayed information looks as follows: > git status -porcelain All I care about are files and their status. While this is not a problem, it shows a lot of information that I'm not interested in as a daily git user. No changes added to commit (use "git add" and/or "git commit -a")Īs you see, the default output of git status is very wordy.

" to discard changes in working directory) (use "git push" to publish your local commits) Your branch is ahead of 'origin/master' by 1 commit.

I have used git for years now, and I usually go with the "normal" git status command, whose output is very verbose. Three ways to control the output of git status
