Git - Get current working copy

I am editing a project with git on multiple computers. How to check the current version that I run on a computer?

For example, every time I make a transaction, I use the version number and include it in the commit message. Is there a way to get the current commit message for the working copy I'm using?

+7
source share
3 answers

Git has no concept of "Revision Number". It has a commit hash. You won’t know your commit hash until you actually made a mistake, so you won’t be able to get the “current hash”.

If you need a commit hash of a previous commit, use git log -1 . If you only need hash output, then xpapad's answer is what you are looking for.

If you mean the actual version of Git (your question was a bit ambiguous for me), use git version .

+8
source

You can use git rev-parse HEAD

If you are using maven to create your projects, think about how to use the maven plugin for maven, see

http://maven.apache.org/scm/git.html

+17
source

Looks like you want git-describe. What closes, git has a monotonous version number.

+1
source

All Articles