Last post Jan 08, 2020 09:13 PM by bruce (sqlwork.com)
Jan 08, 2020 07:30 PM|vyasnikul|LINK
I have _layout.cshtml file in my mvc project. It has the design such that the footer contains the last updated date of the application. But instead of manually changing the date. I want to print the last git commit date, is there a way to print last commit
date into razor html view?
<li>Last update: < Last Git Commit Date ?? > </li>
<li>© 2020 All Rights Reserved</li>
I am able to fetch the data using:
git show -s --date=short
in the package manager console.
I guess when Microsoft bought GitHub, there must be some provision to do so but I am not able to find any documentation on msdn.
Jan 08, 2020 09:13 PM|bruce (sqlwork.com)|LINK
git does not have this feature. A more common approach is to do this at build time. Normally the build server sets an environment variable to the commit and build ids. you then use any build tool to write this a source file that you include in the code.