I have a codebase which has been migrated from mercurial to git recently, yet its version detection has not been adopted yet.
While I know how to obtain each piece of information by a separate git command (git rev-parse HEAD
, git status
, git log
) scraping their outputs. I wonder whether I can be more brief and get things as a nicely tab or space-separated list for easy digestion within python. I need
- the commit's hash
- whether it's an unmodified checkout
- any tag associated with it (if any)
- the time and date the commit was made
Basically I'm trying to created an an extended version of Get the current git hash in a Python script and need pointers to use more appropriated git commands than so far.