Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7642853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:17:45+00:00 2026-05-31T09:17:45+00:00

Having read some postings here about this topic, I realize that there are quite

  • 0

Having read some postings here about this topic, I realize that there are quite some cons that speak against using keyword-substitution. Nevertheless, I need a way to solve following problem and hope that somebody might have an idea on how to solve this with git (whether or not with keyword-substitution):

I have a main application for which I use git as VCS. Parts of this main application (a certain set of XML-Files) are being used by a utility for which I also use git (separate repo).

Now, the main app and the utility have different release cycles, and whenever I release a new version of the utility, I copy over the most current set of XML-Files from the main application.
Within the utility, this set of XML-Files is non-versioned content in git, so it’s not even checked in to the repo.

As of now, whenever I look at different releases of this utility (which is managed by git and has tagged releases) I have no way of knowing which “version” (better: commit hash) the set of contained XML-Files is referring to.

So I was thinking: if I can have the latest commit SHA within those XML-Files (as a comment), I’d always know to which set of XML-Files a certain version of my utility refers to.
Is there anything wrong in this approach or is this the way to go? If yes, how do I get the latest commit-SHA into my XML-Files? (I read that $Id:$ won’t take the commit-SHA, but some “blob”-SHA?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:17:46+00:00Added an answer on May 31, 2026 at 9:17 am

    Ok guys, based on your input, this is what i did:

    1. Insert placeholders in my XML-Files: <!-- @GIT_VERSION@ -->
    2. Have ant pick up git version information, note that this is Windows:
    3. Have ant insert this info into my XML-Files while copying them over.

    Code:

    <target name="getGitDetails">
        <exec executable="cmd" outputproperty="git.revision">
             <arg value="/c" />
             <arg value="git.cmd --git-dir=<path-to-repo> describe --long --dirty --always" />
        </exec>
         <exec executable="cmd" outputproperty="git.currentBranchRef">
             <arg value="/c" />
             <arg value="git.cmd --git-dir=<path-to-repo> describe --all" />
         </exec>
     </target>
    
     <target name="build" depends="getGitDetails">
         <copy todir="<dest-dir>">  
             <filterset>
                 <filter token="GIT_VERSION" value="${git.currentBranchRef} ${git.revision}" />
             </filterset>
         </copy>
     </target>
    

    Thanks for your help!

    See also:

    How to lookup the latest git commit hash from an ant build script

    Deriving application build version from `git describe` – how to get a relatively straightforward string?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings, I've read some threads about this topic, but actually I was unable to
I remember having read about it somewhere… Could anyone shed some light on this?
I'm having some problems implementing an algorithm to read a foreign process' memory. Here
Having read this past question for git, I would like to ask if there
I have installed Wamp 2.2d, having php 5.3.10. I have read some where that
I'm new to Objective-c and after having read some articles about good practices, it
I've read some of the similar questions but they don't quite answer this query
Having read an existing post on stackoverflow and done some reading around on the
Having read up on quite a few articles on Artificial Life (A subject I
Having read this link on RBAR and this , my understanding of RBAR amounts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.