Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » insert git head into code
insert git head into code [message #1496244] Tue, 02 December 2014 22:31 Go to next message
Alex Pabouctsidis is currently offline Alex PabouctsidisFriend
Messages: 1
Registered: December 2014
Junior Member
Hello all,

I'm currently working on an embedded project (ARM) using Eclipse CDT + GNU ARM Eclipse, and i am using git for all of my revision control.

I'm trying to find a way to extract the current git head information such as the commit id, date, author, branch, etc. which would then be hard coded into the project at compile time (such as a #define, structure, etc.). This in turn would then be used when creating crash/data logs on an external SD card.

After a fair amount of searching i wasn't able to find any indication whether or not this is possible.

Any help / advice would be very much appreciated!

Thanks,
Alex
Re: insert git head into code [message #1565695 is a reply to message #1496244] Thu, 15 January 2015 12:28 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1131
Registered: July 2009
Senior Member
Using jgit command line [1] you can do something like

$ jgit show HEAD

If you want to do that from Java have a look at how jgit show command is implemented [2]

[1] https://www.eclipse.org/jgit/download/
[2] http://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
Previous Topic:security-fix for CVE-2014-9390
Next Topic:"Replace with Index" and "Replace with HEAD" in Staging view do nothing
Goto Forum:
  


Current Time: Mon Mar 30 14:47:31 GMT 2020

Powered by FUDForum. Page generated in 0.02287 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top