If two commits belong to the same branch in Git, how do you determine which one comes first (or later)?
git
git log --pretty=format: "%h%ar%s" --graph
Why don't you look at the log shown as and see where the two commits are displayed?
*458d5cb 4 days ago Expect interactive repo name input on create
* e9301226 days ago Merge pull request #1834 from nejat-njonjo/ubuntu-installation
|\
| * e2cca 5d 7 days ago adding hkp://and:80 does the trick
|/
* 921a2997 daysago Update install_linux.md
* d336fab7daysago Update install_linux.md
* 38298887 days ago Merge pull request #1766 from montes11/view-specific-branch-of-repo
|\
| *381d1a18 days ago Added option to specify branch ingh report view
* | 21c12ce 7 days ago Merge pull request #1757 from cli/ubuntus
|\ \
| * | 74665b28 days ago support more ubuntus
| |/
* | f6aa6b07 days ago chore: add make clean to remove bin and manpages (#1776)
* |49e9ede 7 days ago Merge pull request #1803 from timsueberkrueb/patch-1
https://github.com/cli/cli.git
It looks like this, so why don't you decide by looking at the location and date of the commit displayed in it?
However, in the example above, commits merged like commit 381d1a1
and 21c12ce
are
It's a matter of disagreement to decide which comes first.
The timestamp of the commit of git depends on the clock of the terminal, so if the clock of the terminal is different
because of the presence of
Also, when you commit cherry-pick
, you register the committed time and the time it was committed in that branch
I have two hours of time, and I'm worried about which time to use.
Also, using gitk
instead of gitlog --graph
is useful because it appears graphically as follows:
git merge-base
is available.
As described, the command is intended to find a common ancestor for the commit specified in the argument.
And if two commits are in the same branch, one is always the other ancestor.
git merge-base<commit A><commit B>
Run the
<commit A>
or <commit B>
is printed, it is the other ancestorThat's what it means.
© 2024 OneMinuteCode. All rights reserved.