0

Is there an option that would allow me to place a variable place holder to a git environment variable and upon committing, have that variable be populated with the information within it?

I have an XML file that I have appended my changes too, while providing a comment for visual satisfaction for those who dont use Git and review my files. I want to append the date of the commit from GIT into that variable place holder in the document.

<root> <!--CR **{git_commit_date}**: Added a root.--> </root> 
1
  • 1
    I don't think git offers that sort of option, but I could be wrong. Your use case sounds like a changelog tho, and there does exist good automation for that. stackoverflow.com/questions/3523534/… Commented Mar 21, 2018 at 16:36

1 Answer 1

1

Yes and no.

What you are after is traditionally (since SCCS or may be even older) is called "keyword expansion" — as it was used to expand special placeholders such as $Id$ by some meta-information from the most recent commit created by a VCS.

Git explicitly refuses to support this out of the box but provides means to do that with the help of external tools.

Here is a gentle introduction to the topic, and here is the manual.

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

1 Comment

Thank you, I believe this is what I am after.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.