How to include the current Git commit ID and branch in my document?
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I use Git to track changes on my TEX files. When producing a PDF, it would be nice to include the current branch and commit ID somewhere in the document (e.g. on the title page or in a footer).
I know that the package gitinfo2 exists but I'd rather avoid adding any hooks to Git. Besides, I am aware of this question but I would prefer a solution that does not require enabling write18
.
Given that the name of the current branch can be found in .git/HEAD
and the current commit ID is stored in .git/refs/heads/[name of branch]
, is it possible to embed this information in the final document?
revision-control git gitinfo
add a comment |Â
up vote
5
down vote
favorite
I use Git to track changes on my TEX files. When producing a PDF, it would be nice to include the current branch and commit ID somewhere in the document (e.g. on the title page or in a footer).
I know that the package gitinfo2 exists but I'd rather avoid adding any hooks to Git. Besides, I am aware of this question but I would prefer a solution that does not require enabling write18
.
Given that the name of the current branch can be found in .git/HEAD
and the current commit ID is stored in .git/refs/heads/[name of branch]
, is it possible to embed this information in the final document?
revision-control git gitinfo
I'm writing this self-answered Q&A because it took me a while to figure this out. Hope it will help others in the future.
– CL.
3 hours ago
despite the question saying you wanted an alternative to gitinfo, there is a big overlap so I added that tag
– David Carlisle
3 hours ago
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I use Git to track changes on my TEX files. When producing a PDF, it would be nice to include the current branch and commit ID somewhere in the document (e.g. on the title page or in a footer).
I know that the package gitinfo2 exists but I'd rather avoid adding any hooks to Git. Besides, I am aware of this question but I would prefer a solution that does not require enabling write18
.
Given that the name of the current branch can be found in .git/HEAD
and the current commit ID is stored in .git/refs/heads/[name of branch]
, is it possible to embed this information in the final document?
revision-control git gitinfo
I use Git to track changes on my TEX files. When producing a PDF, it would be nice to include the current branch and commit ID somewhere in the document (e.g. on the title page or in a footer).
I know that the package gitinfo2 exists but I'd rather avoid adding any hooks to Git. Besides, I am aware of this question but I would prefer a solution that does not require enabling write18
.
Given that the name of the current branch can be found in .git/HEAD
and the current commit ID is stored in .git/refs/heads/[name of branch]
, is it possible to embed this information in the final document?
revision-control git gitinfo
revision-control git gitinfo
edited 3 hours ago
David Carlisle
472k3811001829
472k3811001829
asked 3 hours ago


CL.
320114
320114
I'm writing this self-answered Q&A because it took me a while to figure this out. Hope it will help others in the future.
– CL.
3 hours ago
despite the question saying you wanted an alternative to gitinfo, there is a big overlap so I added that tag
– David Carlisle
3 hours ago
add a comment |Â
I'm writing this self-answered Q&A because it took me a while to figure this out. Hope it will help others in the future.
– CL.
3 hours ago
despite the question saying you wanted an alternative to gitinfo, there is a big overlap so I added that tag
– David Carlisle
3 hours ago
I'm writing this self-answered Q&A because it took me a while to figure this out. Hope it will help others in the future.
– CL.
3 hours ago
I'm writing this self-answered Q&A because it took me a while to figure this out. Hope it will help others in the future.
– CL.
3 hours ago
despite the question saying you wanted an alternative to gitinfo, there is a big overlap so I added that tag
– David Carlisle
3 hours ago
despite the question saying you wanted an alternative to gitinfo, there is a big overlap so I added that tag
– David Carlisle
3 hours ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
As stated in the question, the branch name can be extracted from .git/HEAD
and given [branch name]
, the commit ID can be found in .git/refs/heads/[branch name]
.
The package catchfile
provides the command CatchFileDef
, which allows us to read .git/HEAD
into a macro. As HEAD
has no file extension, MiKTeX users have to add a trailing dot to the file name:
CatchFileDefheadfull.git/HEAD.
This assigns something like ref: refs/heads/master
to headfull
. As this string has a trailing whitespace character, we use StrGobbleRight
from the xstring package to trim it:1
StrGobbleRightheadfull1[head]
In order to extract only the branch name (master
in the example) from this string, we can use StrBehind
:
StrBehind[2]head/[branch]
This saves the branch name in branch
. Finally, we can use CatchFileDef
again, to save the commit ID in commit
:
CatchFileDefcommit.git/refs/heads/branch.
Full MWE:
documentclassarticle
usepackagexstring
usepackagecatchfile
CatchFileDefheadfull.git/HEAD.
StrGobbleRightheadfull1[head]
StrBehind[2]head/[branch]
CatchFileDefcommit.git/refs/heads/branch.
begindocument
This revision: textttcommit on branch textttbranch.
enddocument
Sample output:
This revision:
d92dc1386e48e04ceecb85461ed3b232146e6a32
on branch
master
.
1 Using the last optional argument of StrGobbleRight
(name
) to assign the trimmed string to a macro (head
) is necessary to allow further manipulation of the string using the xstring
functions – see here for a discussion.
add a comment |Â
up vote
5
down vote
A no-package approach (tested on mac os, modify it for Windows regarding extra needed dot perhaps) based on @CL.'s answer.
documentclassarticle
newcommanddotGitHEAD
newcommandbranch
newcommandcommit
makeatletterletmyfilehandle@inputcheckmakeatother
openinmyfilehandle=.git/HEADrelax
begingroupendlinechar-1
globalreadmyfilehandle to dotGitHEAD
endgroup
closeinmyfilehandle
newcommandGetBranch
defGetBranch ref: refs/heads/#1relaxrenewcommandbranch#1
expandafterGetBranchdotGitHEADrelax
openinmyfilehandle=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalreadmyfilehandle to commit
endgroup
closeinmyfilehandle
begindocument
branch+++
commit+++
This revision: textttcommit on branch textttbranch.
enddocument
Package getcommit
:
ProvidesPackagegetcommit[2018/10/16 get current commit and branch (JFB)]
@ifundefinedbranch
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringbranchspace macro was already
defined. Overwritten.
@ifundefinedcommit
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringcommitspace macro was already
defined. Overwritten.
openin@inputcheck=.git/HEADrelax
begingroupendlinechar-1
globalread@inputcheck to getcommit@HEAD
endgroup
closein@inputcheck
defgetcommit@GetBranch ref: refs/heads/#1relaxdefbranch#1
expandaftergetcommit@GetBranchgetcommit@HEADrelax
openin@inputcheck=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalread@inputcheck to commit
endgroup
closein@inputcheck
endinput
Example of use:
documentclassarticle
usepackagegetcommit
begindocument
+++branch+++
+++commit+++
%frenchspacing
This revision: textttcommit on branch textttbranch.
enddocument
is there an available scratch file handle for read operations in LaTeX, avoiding anewread
here?
– jfbu
2 hours ago
1
There is@inputcheck
used by the kernel in IfFileExists.
– Ulrike Fischer
2 hours ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
 |Â
show 3 more comments
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
As stated in the question, the branch name can be extracted from .git/HEAD
and given [branch name]
, the commit ID can be found in .git/refs/heads/[branch name]
.
The package catchfile
provides the command CatchFileDef
, which allows us to read .git/HEAD
into a macro. As HEAD
has no file extension, MiKTeX users have to add a trailing dot to the file name:
CatchFileDefheadfull.git/HEAD.
This assigns something like ref: refs/heads/master
to headfull
. As this string has a trailing whitespace character, we use StrGobbleRight
from the xstring package to trim it:1
StrGobbleRightheadfull1[head]
In order to extract only the branch name (master
in the example) from this string, we can use StrBehind
:
StrBehind[2]head/[branch]
This saves the branch name in branch
. Finally, we can use CatchFileDef
again, to save the commit ID in commit
:
CatchFileDefcommit.git/refs/heads/branch.
Full MWE:
documentclassarticle
usepackagexstring
usepackagecatchfile
CatchFileDefheadfull.git/HEAD.
StrGobbleRightheadfull1[head]
StrBehind[2]head/[branch]
CatchFileDefcommit.git/refs/heads/branch.
begindocument
This revision: textttcommit on branch textttbranch.
enddocument
Sample output:
This revision:
d92dc1386e48e04ceecb85461ed3b232146e6a32
on branch
master
.
1 Using the last optional argument of StrGobbleRight
(name
) to assign the trimmed string to a macro (head
) is necessary to allow further manipulation of the string using the xstring
functions – see here for a discussion.
add a comment |Â
up vote
5
down vote
As stated in the question, the branch name can be extracted from .git/HEAD
and given [branch name]
, the commit ID can be found in .git/refs/heads/[branch name]
.
The package catchfile
provides the command CatchFileDef
, which allows us to read .git/HEAD
into a macro. As HEAD
has no file extension, MiKTeX users have to add a trailing dot to the file name:
CatchFileDefheadfull.git/HEAD.
This assigns something like ref: refs/heads/master
to headfull
. As this string has a trailing whitespace character, we use StrGobbleRight
from the xstring package to trim it:1
StrGobbleRightheadfull1[head]
In order to extract only the branch name (master
in the example) from this string, we can use StrBehind
:
StrBehind[2]head/[branch]
This saves the branch name in branch
. Finally, we can use CatchFileDef
again, to save the commit ID in commit
:
CatchFileDefcommit.git/refs/heads/branch.
Full MWE:
documentclassarticle
usepackagexstring
usepackagecatchfile
CatchFileDefheadfull.git/HEAD.
StrGobbleRightheadfull1[head]
StrBehind[2]head/[branch]
CatchFileDefcommit.git/refs/heads/branch.
begindocument
This revision: textttcommit on branch textttbranch.
enddocument
Sample output:
This revision:
d92dc1386e48e04ceecb85461ed3b232146e6a32
on branch
master
.
1 Using the last optional argument of StrGobbleRight
(name
) to assign the trimmed string to a macro (head
) is necessary to allow further manipulation of the string using the xstring
functions – see here for a discussion.
add a comment |Â
up vote
5
down vote
up vote
5
down vote
As stated in the question, the branch name can be extracted from .git/HEAD
and given [branch name]
, the commit ID can be found in .git/refs/heads/[branch name]
.
The package catchfile
provides the command CatchFileDef
, which allows us to read .git/HEAD
into a macro. As HEAD
has no file extension, MiKTeX users have to add a trailing dot to the file name:
CatchFileDefheadfull.git/HEAD.
This assigns something like ref: refs/heads/master
to headfull
. As this string has a trailing whitespace character, we use StrGobbleRight
from the xstring package to trim it:1
StrGobbleRightheadfull1[head]
In order to extract only the branch name (master
in the example) from this string, we can use StrBehind
:
StrBehind[2]head/[branch]
This saves the branch name in branch
. Finally, we can use CatchFileDef
again, to save the commit ID in commit
:
CatchFileDefcommit.git/refs/heads/branch.
Full MWE:
documentclassarticle
usepackagexstring
usepackagecatchfile
CatchFileDefheadfull.git/HEAD.
StrGobbleRightheadfull1[head]
StrBehind[2]head/[branch]
CatchFileDefcommit.git/refs/heads/branch.
begindocument
This revision: textttcommit on branch textttbranch.
enddocument
Sample output:
This revision:
d92dc1386e48e04ceecb85461ed3b232146e6a32
on branch
master
.
1 Using the last optional argument of StrGobbleRight
(name
) to assign the trimmed string to a macro (head
) is necessary to allow further manipulation of the string using the xstring
functions – see here for a discussion.
As stated in the question, the branch name can be extracted from .git/HEAD
and given [branch name]
, the commit ID can be found in .git/refs/heads/[branch name]
.
The package catchfile
provides the command CatchFileDef
, which allows us to read .git/HEAD
into a macro. As HEAD
has no file extension, MiKTeX users have to add a trailing dot to the file name:
CatchFileDefheadfull.git/HEAD.
This assigns something like ref: refs/heads/master
to headfull
. As this string has a trailing whitespace character, we use StrGobbleRight
from the xstring package to trim it:1
StrGobbleRightheadfull1[head]
In order to extract only the branch name (master
in the example) from this string, we can use StrBehind
:
StrBehind[2]head/[branch]
This saves the branch name in branch
. Finally, we can use CatchFileDef
again, to save the commit ID in commit
:
CatchFileDefcommit.git/refs/heads/branch.
Full MWE:
documentclassarticle
usepackagexstring
usepackagecatchfile
CatchFileDefheadfull.git/HEAD.
StrGobbleRightheadfull1[head]
StrBehind[2]head/[branch]
CatchFileDefcommit.git/refs/heads/branch.
begindocument
This revision: textttcommit on branch textttbranch.
enddocument
Sample output:
This revision:
d92dc1386e48e04ceecb85461ed3b232146e6a32
on branch
master
.
1 Using the last optional argument of StrGobbleRight
(name
) to assign the trimmed string to a macro (head
) is necessary to allow further manipulation of the string using the xstring
functions – see here for a discussion.
answered 3 hours ago


CL.
320114
320114
add a comment |Â
add a comment |Â
up vote
5
down vote
A no-package approach (tested on mac os, modify it for Windows regarding extra needed dot perhaps) based on @CL.'s answer.
documentclassarticle
newcommanddotGitHEAD
newcommandbranch
newcommandcommit
makeatletterletmyfilehandle@inputcheckmakeatother
openinmyfilehandle=.git/HEADrelax
begingroupendlinechar-1
globalreadmyfilehandle to dotGitHEAD
endgroup
closeinmyfilehandle
newcommandGetBranch
defGetBranch ref: refs/heads/#1relaxrenewcommandbranch#1
expandafterGetBranchdotGitHEADrelax
openinmyfilehandle=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalreadmyfilehandle to commit
endgroup
closeinmyfilehandle
begindocument
branch+++
commit+++
This revision: textttcommit on branch textttbranch.
enddocument
Package getcommit
:
ProvidesPackagegetcommit[2018/10/16 get current commit and branch (JFB)]
@ifundefinedbranch
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringbranchspace macro was already
defined. Overwritten.
@ifundefinedcommit
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringcommitspace macro was already
defined. Overwritten.
openin@inputcheck=.git/HEADrelax
begingroupendlinechar-1
globalread@inputcheck to getcommit@HEAD
endgroup
closein@inputcheck
defgetcommit@GetBranch ref: refs/heads/#1relaxdefbranch#1
expandaftergetcommit@GetBranchgetcommit@HEADrelax
openin@inputcheck=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalread@inputcheck to commit
endgroup
closein@inputcheck
endinput
Example of use:
documentclassarticle
usepackagegetcommit
begindocument
+++branch+++
+++commit+++
%frenchspacing
This revision: textttcommit on branch textttbranch.
enddocument
is there an available scratch file handle for read operations in LaTeX, avoiding anewread
here?
– jfbu
2 hours ago
1
There is@inputcheck
used by the kernel in IfFileExists.
– Ulrike Fischer
2 hours ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
 |Â
show 3 more comments
up vote
5
down vote
A no-package approach (tested on mac os, modify it for Windows regarding extra needed dot perhaps) based on @CL.'s answer.
documentclassarticle
newcommanddotGitHEAD
newcommandbranch
newcommandcommit
makeatletterletmyfilehandle@inputcheckmakeatother
openinmyfilehandle=.git/HEADrelax
begingroupendlinechar-1
globalreadmyfilehandle to dotGitHEAD
endgroup
closeinmyfilehandle
newcommandGetBranch
defGetBranch ref: refs/heads/#1relaxrenewcommandbranch#1
expandafterGetBranchdotGitHEADrelax
openinmyfilehandle=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalreadmyfilehandle to commit
endgroup
closeinmyfilehandle
begindocument
branch+++
commit+++
This revision: textttcommit on branch textttbranch.
enddocument
Package getcommit
:
ProvidesPackagegetcommit[2018/10/16 get current commit and branch (JFB)]
@ifundefinedbranch
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringbranchspace macro was already
defined. Overwritten.
@ifundefinedcommit
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringcommitspace macro was already
defined. Overwritten.
openin@inputcheck=.git/HEADrelax
begingroupendlinechar-1
globalread@inputcheck to getcommit@HEAD
endgroup
closein@inputcheck
defgetcommit@GetBranch ref: refs/heads/#1relaxdefbranch#1
expandaftergetcommit@GetBranchgetcommit@HEADrelax
openin@inputcheck=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalread@inputcheck to commit
endgroup
closein@inputcheck
endinput
Example of use:
documentclassarticle
usepackagegetcommit
begindocument
+++branch+++
+++commit+++
%frenchspacing
This revision: textttcommit on branch textttbranch.
enddocument
is there an available scratch file handle for read operations in LaTeX, avoiding anewread
here?
– jfbu
2 hours ago
1
There is@inputcheck
used by the kernel in IfFileExists.
– Ulrike Fischer
2 hours ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
 |Â
show 3 more comments
up vote
5
down vote
up vote
5
down vote
A no-package approach (tested on mac os, modify it for Windows regarding extra needed dot perhaps) based on @CL.'s answer.
documentclassarticle
newcommanddotGitHEAD
newcommandbranch
newcommandcommit
makeatletterletmyfilehandle@inputcheckmakeatother
openinmyfilehandle=.git/HEADrelax
begingroupendlinechar-1
globalreadmyfilehandle to dotGitHEAD
endgroup
closeinmyfilehandle
newcommandGetBranch
defGetBranch ref: refs/heads/#1relaxrenewcommandbranch#1
expandafterGetBranchdotGitHEADrelax
openinmyfilehandle=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalreadmyfilehandle to commit
endgroup
closeinmyfilehandle
begindocument
branch+++
commit+++
This revision: textttcommit on branch textttbranch.
enddocument
Package getcommit
:
ProvidesPackagegetcommit[2018/10/16 get current commit and branch (JFB)]
@ifundefinedbranch
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringbranchspace macro was already
defined. Overwritten.
@ifundefinedcommit
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringcommitspace macro was already
defined. Overwritten.
openin@inputcheck=.git/HEADrelax
begingroupendlinechar-1
globalread@inputcheck to getcommit@HEAD
endgroup
closein@inputcheck
defgetcommit@GetBranch ref: refs/heads/#1relaxdefbranch#1
expandaftergetcommit@GetBranchgetcommit@HEADrelax
openin@inputcheck=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalread@inputcheck to commit
endgroup
closein@inputcheck
endinput
Example of use:
documentclassarticle
usepackagegetcommit
begindocument
+++branch+++
+++commit+++
%frenchspacing
This revision: textttcommit on branch textttbranch.
enddocument
A no-package approach (tested on mac os, modify it for Windows regarding extra needed dot perhaps) based on @CL.'s answer.
documentclassarticle
newcommanddotGitHEAD
newcommandbranch
newcommandcommit
makeatletterletmyfilehandle@inputcheckmakeatother
openinmyfilehandle=.git/HEADrelax
begingroupendlinechar-1
globalreadmyfilehandle to dotGitHEAD
endgroup
closeinmyfilehandle
newcommandGetBranch
defGetBranch ref: refs/heads/#1relaxrenewcommandbranch#1
expandafterGetBranchdotGitHEADrelax
openinmyfilehandle=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalreadmyfilehandle to commit
endgroup
closeinmyfilehandle
begindocument
branch+++
commit+++
This revision: textttcommit on branch textttbranch.
enddocument
Package getcommit
:
ProvidesPackagegetcommit[2018/10/16 get current commit and branch (JFB)]
@ifundefinedbranch
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringbranchspace macro was already
defined. Overwritten.
@ifundefinedcommit
PackageWarninggetcommitATTENTION!^^J
@spaces@spacesstringcommitspace macro was already
defined. Overwritten.
openin@inputcheck=.git/HEADrelax
begingroupendlinechar-1
globalread@inputcheck to getcommit@HEAD
endgroup
closein@inputcheck
defgetcommit@GetBranch ref: refs/heads/#1relaxdefbranch#1
expandaftergetcommit@GetBranchgetcommit@HEADrelax
openin@inputcheck=.git/refs/heads/branchrelax
begingroupendlinechar-1
globalread@inputcheck to commit
endgroup
closein@inputcheck
endinput
Example of use:
documentclassarticle
usepackagegetcommit
begindocument
+++branch+++
+++commit+++
%frenchspacing
This revision: textttcommit on branch textttbranch.
enddocument
edited 28 mins ago
answered 2 hours ago


jfbu
43.2k65141
43.2k65141
is there an available scratch file handle for read operations in LaTeX, avoiding anewread
here?
– jfbu
2 hours ago
1
There is@inputcheck
used by the kernel in IfFileExists.
– Ulrike Fischer
2 hours ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
 |Â
show 3 more comments
is there an available scratch file handle for read operations in LaTeX, avoiding anewread
here?
– jfbu
2 hours ago
1
There is@inputcheck
used by the kernel in IfFileExists.
– Ulrike Fischer
2 hours ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
is there an available scratch file handle for read operations in LaTeX, avoiding a
newread
here?– jfbu
2 hours ago
is there an available scratch file handle for read operations in LaTeX, avoiding a
newread
here?– jfbu
2 hours ago
1
1
There is
@inputcheck
used by the kernel in IfFileExists.– Ulrike Fischer
2 hours ago
There is
@inputcheck
used by the kernel in IfFileExists.– Ulrike Fischer
2 hours ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
Quite nice and it works on windows. But imho for a real package it should try to find the info also in parent folders (imho gitinfo2 looks 4 levels up by default).
– Ulrike Fischer
50 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
But miktex really needs the period at the end ...
– Ulrike Fischer
41 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
@UlrikeFischer is there any test allowing package to know that this is executed under MikTeX?
– jfbu
30 mins ago
 |Â
show 3 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f455396%2fhow-to-include-the-current-git-commit-id-and-branch-in-my-document%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I'm writing this self-answered Q&A because it took me a while to figure this out. Hope it will help others in the future.
– CL.
3 hours ago
despite the question saying you wanted an alternative to gitinfo, there is a big overlap so I added that tag
– David Carlisle
3 hours ago