'first commit in branch
Whith command
git rev-list --max-parents=0 HEAD
I get first commit in project
37a8bdc19ce1fd41ebfa1611621da3b30e92ff03
With this two I get the same output:
git rev-list --max-parents=0 master
git rev-list --max-parents=0 branch1
How I can get the first commit in branch named "branch1"?
Solution 1:[1]
Approach: list all commits that are "new" in the branch compared to master and pick the first one:
git log --no-merges --reverse --format='%H' master..branch | head -n1
or
git rev-list --no-merges --reverse origin/LIVE..origin/UAT | head -n1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |