Git alias:
branch-commit-first = "!f() { \
branch="${1:-$(git current-branch)}"; \
count="${2:-1}"; \
git log --reverse --pretty=%H "$branch" | \
head -"$count"; \
}; f"
Syntax:
git branch-commit-first [branch name [commit count]]
Options:
-
branch name: default is the current branch name.
-
commit count: default is 1
Example: show the current branch's first commit hash:
git branch-commit-first
Example: show the "foo" branch's first commit hash:
git branch-commit-first foo
Example: show the "foo" branch's first 3 commit hashes:
git branch-commit-first foo 3
Compare:
- git branch-commit-first: show a branch's first commit hash (or hashes)
- git branch-commit-last: show a branch's last commit hash (or hashes)
- git branch-commit-prev: show a branch's previous commit hash (or hashes)
- git branch-commit-next: show a branch's next commit hash (or hashes)