I'm using git 2.3.0. and trying to find 3 latest commits on a remote repository myremote.
$: git remote
origin
myremote
I would expect that the command
git log -3 --decorate --remotes=myremote
would achieve what i want. However, I can see the logs that are not strictly from myremote.
Example.
$: git remote
commit 63d8a59f6 (myremote/branch1)
...
commit 63d8a59f6 (myremote/branch2)
...
commit 63d8a59f6 (origin/branch3)
...
In the above example, I would expect not to see the anything from origin.
This is a subtlety of the functionality for --remotes:
--remotes[=<pattern>]
Pretend as if all the refs in refs/remotes are listed on the command line as
<commit>.
Git is looking at the commit hashes for branches from myremote. But since your origin/branch3 also is pointing to a hash from a myremote branch, it shows up in the log output.
Functionally
git log --remotes=myremote
is the same as
git log <hash1> <hash2> <hash3> ... <hashN>
where each hash is taken from the contents of the files in .git/refs/remotes/myremote/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With