git - find the common base commit
December 12, 2024
The git merge-base
command can be used to find the original base of the feature
branch.
git merge-base feature master
The feature
branch log - a simple example:
$ git log feature
commit f0fff31854c6445062b034346d0c7fc1b2ac4fdb (HEAD -> feature)
commit c8e248bf9c781ccee43eb937448a59eaedae23a7
commit b6770a6a1b0c6bc70d8177d349eaaad3c41565ba
commit 73dbfb6b3c373695db3c89da69ad6642b8863667 (master)
commit 41056f29fef1802afecd02c09b9028ca4ff7341d
commit abb79ca40061c0d2bab6e7e3f074e15d2eb4eb4b
So, the git merge-base feature master
command from above in this case shows:
73dbfb6b3c373695db3c89da69ad6642b8863667