With modern Git (1.8.3.4 in my case) and not using branches you can do:
$ git rev-list --count HEAD
68
But this has all kinds of issues and might not be easy to reproduce or easy to get back to the commit hash in case you need to. So try to avoid it or use it only as a hint.
More Related Contents:
- Does deleting a branch in git remove it from the history?
- How do I discard unstaged changes in Git?
- When do you use Git rebase instead of Git merge?
- Why do I need to explicitly push a new branch?
- Git workflow and rebase vs merge questions
- Committing Machine Specific Configuration Files
- What does “Git push non-fast-forward updates were rejected” mean?
- Distributed Version Control Systems and the Enterprise – a Good mix? [closed]
- How to remove/delete a large file from commit history in the Git repository?
- Vendor Branches in Git
- What is the Difference Between Mercurial and Git?
- Gitlab repository mirroring
- What are the differences between local branch, local tracking branch, remote branch and remote tracking branch?
- Git non-fast-forward rejected
- Should I add the google-services.json (from Firebase) to my repository?
- Why is “origin/HEAD” shown when running “git branch -r”?
- how do you push only some of your local git commits?
- git-svn: how do I create a new svn branch via git?
- Collapsing a git repository’s history
- Git: Is there a way to figure out where a commit was cherry-pick’ed from?
- Sharing rerere cache
- How to sync changes on my local server with the ones on the remote one without commiting?
- Git clone without .git directory
- How do you undo “Discard all changes” in VS Code/Git
- Git: Ignore files for public repository, but not for private
- “Cannot spawn ssh” when connecting to Github, but ssh -T [email protected] works?
- How do I remove a single file from the staging area (undo git add)?
- Where does a Git branch start and what is its length?
- How to convert a Git repo to a submodule, which is nested in another (parent) Git repo?
- Limiting file size in git repository