1

Does git provide a REST API for fetching the output of the gits status command. I looked up the https://developer.github.com/v3/ but couldn't find what I am looking for. I want to get all the text output that gets displayed when we type in the git status command in the command prompt/git bash terminal and then be able to display that output on a webpage /application window.

6
  • 1
    I'm not sure it makes to have that in the API. The official documentation for that command is "Show the working tree status". What would you expect the server to say? Commented May 8, 2019 at 20:23
  • @RayToal to put in other words: I would like to display the exact output that git terminal shows when I type in the git status command. Or atleast something that could give me details like changes to be commited, untracked files, current branch, etc just as the original console displays it. Commented May 8, 2019 at 20:30
  • I think I understand that, but if you call GitHub's API, the endpoint on the server will not know your local information. Pretty much all that information is computed within the git executable on your local machine; none of that (or very very little perhaps) is done via the GitHub API. Hope that makes sense. Commented May 8, 2019 at 20:38
  • I got your point.Makes complete sense. Is that the end of the road. Isn't there any way around this, like any way to integrate with the git terminal. Commented May 8, 2019 at 20:44
  • Thank you @RayToal I think I should rephrase my question. Commented May 8, 2019 at 21:00

1 Answer 1

2

Server repositories are bare, they don't have the working directory. And in a bare repository (even local) git status is meaningless (because it compares the repository with the working tree) and produces error:

fatal: This operation must be run in a work tree

Hence there is no API for getting status.

Sign up to request clarification or add additional context in comments.

3 Comments

I had just rephrased my question.Thank you for clarifying it
It's a completely different question now. IMO it would be better if you restore the original question and ask a different question separately. Or my answer looks stupid and irrelevant.
rolled back. but I guess people would have still been able to go through the original question , thanks to stackoverflow's history feature.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.