# Project feature request: use git commit info

**URL:** <https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100>\
**Category:** Feature Requests\
**Created:** [15 July 2020 06:21 UTC](https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100 "2020-07-15T06:21:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![psmtvdw](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@psmtvdw](https://discourse.nodered.org/u/psmtvdw)\
**Post date:** [15 July 2020 06:21 UTC](https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100/1 "2020-07-15T06:21:32Z")

</div>

I would like to use the git commit and tag info as data in my flow. (to use in some logging or to show in a UI screen). This would be very helpfull if you have xx instances running on edge devices in the field.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [15 July 2020 12:07 UTC](https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100/2 "2020-07-15T12:07:51Z")

</div>

I think you can get that info in your flow by using the git commands from an exec node.

Have a look at the output of `git -C /path/to/repo log --oneline HEAD^..HEAD`

That will show you the latest commit hash, branch and message.

Normally you would execute git commands from within the working copy, so you need the `-C` parameter to specify the path of your node-red workspace/project to get it working from an exec node

The `git describe` command could be useful too, if you use tags.

---

<div class="post-metadata">

**Author:** ![psmtvdw](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@psmtvdw](https://discourse.nodered.org/u/psmtvdw)\
**Post date:** [16 July 2020 05:40 UTC](https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100/3 "2020-07-16T05:40:08Z")

</div>

Thanks for the suggestion. The hardest part in that scenario is getting the workspace/project path. Especially since I'm working with production/development environments. So still considering whether it's wise to fetch this git info inside the flow or as an alternative, to run external script during a deployment procedure, save it to a file and let my flow read this info on start-up.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [16 July 2020 07:16 UTC](https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100/4 "2020-07-16T07:16:23Z")

</div>

You could use environment variables for specifying the path. You wouldn't have to touch each flow individually then.

Another thought... the runtime needs to know that path anyway. Maybe it's available somehow through some API or some env-var already. 🤔

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 September 2020 07:16 UTC](https://discourse.nodered.org/t/project-feature-request-use-git-commit-info/30100/5 "2020-09-14T07:16:27Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
