0

One of our refs has been moved to a commit where it shouldn't be, presumably because someone did a merge in the wrong direction or something like that.

To sort this out (see what actually happened) it would be a great help to see a reflog for that ref, but from the devops cloud repo itself, as opposed to showing it for any specific developer's local repo.

Is there any way I can get a reflog from the Azure devops cloud repo?

I understand that there's no git command that can be executed on a developer machine that can get it for the remote/cloud repo. I also found that Azure devops offers a git api, but for refs all i can find is calls to list refs, modify/create/delete refs, and lock/unlock refs.

Kjell Rilbe
  • 1,331
  • 14
  • 39

1 Answers1

1

How about the built-in History view in Azure devops repo? We can view all merges in it.

enter image description here

Update:

You can add a powershell task to a pipeline, run git checkout master and git reflog show --all commands to get reflog.

enter image description here

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
  • Unfortunately it just shows the commit history. If I have branch A and derive branch B from there. Then make commits to B, and then merge B to A, the merge will just fast-forward A to the last commit of B. There won't be any record of that operation, who did it or when it happened, and most importantly, there's no way to see where A pointed before that (which is what it should be reset to, probably). All I can see is the commit history and that A and B point to the same commit. – Kjell Rilbe Nov 10 '20 at 08:29
  • 1
    You can add a powershell task to a pipeline, run `git checkout master` and `git reflog show --all` commands to get reflog. – Hugh Lin Nov 12 '20 at 10:09
  • 1
    Oh, so a powershell task has access to the cloud git repo? Interesting. Would be worth a try. Unfortunately I already chose a "qualified guess" approach, so I have left the actual problem behind for now. Will keep this in mind for future needs. Thanks! (I'll be sure to mark this as correct answer when I've tried it). – Kjell Rilbe Nov 13 '20 at 14:47
  • Looking forward to your test result. :) – Hugh Lin Nov 26 '20 at 02:42