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 238457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:30:25+00:00 2026-05-11T20:30:25+00:00

I’m looking for a Git alternatives to svn info. Today I added some information

  • 0

I’m looking for a Git alternatives to “svn info”.

Today I added some information that Subversion gives me with the “svn info” command right into my build, and that is then pushed into a source file that prints this during startup.
That way I always know where that build came from and how to get it back again.

If you have “svn info” like URL, Repository Root, Repository UUID and the Revision, you have a good link between what is deployed and the buildsystem.
And if someone reports a bug you know where that software came from, and since that information was automatically included, the risk of human error is smaller.

Now the question is, what information do I need to get from Git so I can later identify where that build came from? And how do I use that information to switch back to exactly that version?

(Maybe I need to add some information about the “build computer” as well since Git is distributed.)


Update:
Using rev-parse was really useful, and I got something like this:

cj@zap:~/git_test$ git rev-parse HEAD
72ce5f3e13c61f76fde5c58cefc85eed91b6f1f8

And with that magic number it is later possible to do:

cj@zap:~/git_test$ git checkout 72ce5f3e13c61f76fde5c58cefc85eed91b6f1f8

And I am back where I was.


Update:
I think that if I take some parts from that scripts VonC provided and put them into my buildfile I will get the result I was looking for.


Update:

A note on “git describe”. You need a real tag (tag -a) earlier in you branch history to make this work or you will get something like this.

fatal: cannot describe '72ce5f3e13c61f76fde5c58cefc85eed91b6f1f8'

The problem is also described in Git Tag Does the Wrong Thing by Default.

But please note that a checkout seems to work anyway, even though that was an error message.

git checkout 72ce5f3e13c61f76fde5c58cefc85eed91b6f1f8

The normal thing though seems to be that you create something like a “ver1.0” tag, and then if you continue to work you get something like this:

cj@zap:~/git_test$ git describe 
ver1.0-2-g4c7a057
cj@zap:~/git_test$ git tag -a ver2.0
cj@zap:~/git_test$ git describe 
ver2.0
cj@zap:~/git_test$ git commit . -m "something..."
Created commit ac38a9d: something...
 1 files changed, 1 insertions(+), 0 deletions(-)
cj@zap:~/git_test$ git describe 
ver2.0-1-gac38a9d

So when you use describe correctly it does work and may produce a more human-readable results, and it can be really useful as well.

  • 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-11T20:30:26+00:00Added an answer on May 11, 2026 at 8:30 pm

    To complete Charles’s answer, you also can make a script displaying "sn info" like information, like this one (already mentioned there)

    #!/bin/bash
    
    # author: Duane Johnson
    # email: duane.johnson@gmail.com
    # date: 2008 Jun 12
    # license: MIT
    # 
    # Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
    
    pushd . >/dev/null
    
    # Find base of git directory
    while [ ! -d .git ] && [ ! `pwd` = "/" ]; do cd ..; done
    
    # Show various information about this git directory
    if [ -d .git ]; then
      echo "== Remote URL: `git remote -v`"
    
      echo "== Remote Branches: "
      git branch -r
      echo
    
      echo "== Local Branches:"
      git branch
      echo
    
      echo "== Configuration (.git/config)"
      cat .git/config
      echo
    
      echo "== Most Recent Commit"
      git --no-pager log  -n1
      echo
    
      echo "Type 'git log' for more commits, or 'git show' for full commit details."
    else
      echo "Not a git repository."
    fi
    ---
    popd >/dev/null
    

    Which would produce something like:

    == Remote URL: origin git@github.com:canadaduane/my-project.git
    == Remote Branches:
      origin/work
      trunk
      trunk@1309
      trunk@2570
      trunk@8
    
    == Local Branches:
      master
    * work
    
    == Configuration (.git/config)
    [core]
      repositoryformatversion = 0
      filemode = true
      bare = false
      logallrefupdates = true
    [svn-remote "svn"]
      url = svn+ssh://svn.my-project.com/srv/svn
      fetch = my-project/trunk:refs/remotes/trunk
    [remote "origin"]
      url = git@github.com:canadaduane/my-project.git
      fetch = refs/heads/*:refs/remotes/origin/*
    [github]
      user = canadaduane
      repo = my-project
    
    == Most Recent Commit
    commit b47dce8b4102faf1cedc8aa3554cb58d76e0cbc1
    Author: Duane Johnson <duane.johnson@gmail.com>
    Date:   Wed Jun 11 17:00:33 2008 -0600
    
        Added changes to database schema that will allow decentralization from content pointers table
    
    type 'git log' for more, or 'git show' for full commit details.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.