0

I'm trying to parse the output from the command git status --porcelain. As stated in this SO answer.

The problem is that I'm not getting any output when testing this in the cli:

git status

output:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

And with --porcelain

git status --porcelain

output:
(nothing :)

Can someone please explain what's going on?

Community
  • 1
  • 1
hitautodestruct
  • 20,081
  • 13
  • 69
  • 93

2 Answers2

1

If you have no untracked files and no changed file git status --porcelain shouldn't output anything, try to add a file touch new.file or change an existing one an try again.

Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
1

git status --porcelain only shows status of files in a machine readable format. - Check the exit code in order to make sure no error occurred (!= 0 indicates an error).

As "nothing to commit, working directory clean" is shown by git status you get an empty list of files. - Change some files or stage some changes and you'll see some output.

MrTux
  • 32,350
  • 30
  • 109
  • 146