git log --oneline
The above command gives me the followed results:
5485b34 Modify: something
ccaf2c4 Modify: another thing
85a87e8 Bug Fix: the other thing
But because I'm using gerrit and usually gerrit has it's change number as refs/changes/... format, I want to collect list framed as follows:
refs/changes/85/104085/9 Modify: something
refs/changes/33/104033/9 Modify: another thing
refs/changes/83/104183/2 Bug Fix: the other thing
I know there is a way to obtain the mapping between commit IDs and remote references by using "git ls-remote". And by using "git ls-remote", I can make a script to obtain the above result. But is there any better and simpler way to obtain the above results?
You can display references in logs with the --decorate
option.
But it will only display the local and fetched references so the refs/changes/x/yyyy/zz
won't be displayed, you have to fetch them first:
git config --add remote.origin.fetch refs/changes/*:refs/remotes/gerrit/changes/*
Then you will get an output like this:
# You can add '--all' to see other references not in the current history
$ git log --oneline --decorate
5485b34 (HEAD -> master, origin/master, origin/HEAD, gerrit/changes/85/104085/9) Modify: something
ccaf2c4 (gerrit/changes/33/104033/9) Modify: another thing
85a87e8 (gerrit/changes/83/104183/2) Bug Fix: the other thing