Many Git commands take revision parameters as arguments. Depending on the command, they denote a specific commit or, for commands which walk the revision graph (such as git-log(1)), all commits which can be reached from that commit. In the latter case one can also specify a range of revisions explicitly. In addition, some Git commands (such as git-show(1)) also take revision parameters which denote other objects than commits, e.g. blobs ("files").
Questions tagged [git-revision]
11 questions
11
votes
2 answers
Getting git-revision hash with webpack
I'm trying to create archive with webpack with suffix by git-revision. Could you tell me please what is good way to do it?

Stepan Suvorov
- 25,118
- 26
- 108
- 176
6
votes
4 answers
Is there a way to refer to a child commit of the current detached HEAD?
I know how to refer to a parent commit as HEAD^.
But is it possible to refer to a child commit in a similar way?

konstunn
- 355
- 4
- 17
4
votes
1 answer
passing $SOURCE_COMMIT to Dockerfile commands on docker hub
I am building docker image for a service at hub.docker.com. During compilation, the commit hash of the source is passed as an argument to CMake (so that it can be embedded in the version information). According to Advanced options for Autobuild and…

eudoxos
- 18,545
- 10
- 61
- 110
3
votes
2 answers
Git commit revision id to be five chars long when using pretty format in Ruby script
My code is the following
system('git log --pretty=format:[%h]: %an')
where %h gives the revision id of the commit, and it is seven characters long and %an is the author name.
My problem is that I want to have a five-digits revision id and not…

hack-is-art
- 325
- 5
- 20
2
votes
1 answer
Referring to the commit prior to a commit specified using `:/` syntax?
The most recent commit whose commit message contains "foo" is spelled :/foo, as in:
git show :/foo
How does one refer to the parent of that commit? :/foo^ is incorrect; that results in:
fatal: ambiguous argument ':/foo^': unknown revision or path…

larsks
- 277,717
- 41
- 399
- 399
1
vote
3 answers
Get MERGE_HEAD in pre-merge-commit hook
In pre-merge-commit, I need the hash of the merge head to verify a few things about the commits that are about to be merged to the current branch.
However, it seems that neither the reference MERGE_HEAD nor the file .git/MERGE_HEAD exist at the time…

Piotr Siupa
- 3,929
- 2
- 29
- 65
1
vote
0 answers
git log extension in VSCode throwing error ambiguous argument 'HEAD'
One strange issue i am facing is git history extenstion in VSCode throwing me error that - ambiguous argument HEAD if i select a file and click on git history extension button to see the history on the file.
But if i run the git command manually to…

Reese
- 389
- 2
- 10
- 26
1
vote
0 answers
git log - exclude children/descendants of given ancestor/base
In git help log and git help revisions, it is documented how to include or exclude specific commits/refs and their ancestors in git log.
I am now looking for a way to exclude children of a given rev, and combine this with other range…

donquixote
- 4,877
- 3
- 31
- 54
1
vote
2 answers
What is the command for "show me all logs from HEAD to ec9cb4106"?
I need to see either (1) log messages from HEAD to ec9cb4106 or (2) rollup diff from HEAD to ec9cb4106. The revision selection page does not appear to discuss it, and I can't get git to accept the obvious choices:
$ git log HEAD .. ec9cb4106
fatal:…

jww
- 97,681
- 90
- 411
- 885
0
votes
0 answers
How to build from a specific git revision in Jenkins
I have a Jenkins build job with
Source Code Management > GIT > Repository URL: https://GitHub_repo_url/branch_name
this will pull the the HEAD revision out of the branch.
How can I pull code of specified revision?

Heinz
- 913
- 4
- 12
- 22
0
votes
0 answers
Git revision id and date stay the same for all files
I am iterating over a git repo, or sub repos recursively and I want to output (along with other details) the revision id of the latest commit (aka most recent) of when a file was modified.
My problem is that the revision id and date stay the same…

hack-is-art
- 325
- 5
- 20