Read current git branch natively using vscode extension

Viewed 1355

While I am developing an extension for Visual Studio Code (vscode) I have asked myself how to proper read git refs like the current branch using native methods.

My current solutions feels more like a workaround:

  • fetch the git path
  • run git rev-parse', '--abbrev-ref', 'HEAD'
  • return stdout as string and put into variable (E.g. master)

Complete method implemented here (forked extension gitHistoryVSCode)

Any other ideas, for example how to access the extension/git methods or model properties?

1 Answers
Related