Can an admin access my reflog to revert commit changes?

74 views Asked by At

I recently made a commit and it was incorrect so I tried to reset it to another commit. Now I'm realizing that the commit had information we needed for our team. Can the GitHub organization's admin find that commit (from reflog) and get the information needed from their own computer? It no longer shows in the commit history on GitHub :(.

It would be really helpful if they could do that as I'm still learning git and wouldn't like to mess anything up more.

1

There are 1 answers

0
bk2204 On

Probably not. The administrator probably can't access the reflog on your computer, and they can't access the reflog on GitHub. GitHub keeps reflogs, but they aren't accessible to users. However, it also keeps several other records of pushes, and their support team can resurrect data that's been pushed over in many cases. This isn't an uncommon request and it happens all the time, since people are human and make mistakes. All you have to do is have an organization admin write in.

What might be easier is to look and see if you have the commit in the reflogs on your computer and see if the data you want is still there. For example, say you did your work on branch foo, you could probably do git reflog foo and see the states that the branch was in. One of those is probably the commit you made. Even if you've deleted the branch, you might be able to do git reflog HEAD to find out the recent changes.

When you find the ID of the commit you want to look at, say, abc123, you can do git checkout abc123 to check out that commit, or you can do git show abc123 to look at that particular commit without checking it out. If you find the commit you want, you can turn it into a branch with git checkout -b branch-name abc123, which will create a new branch called branch-name at that commit. You can then push it somewhere other folks can access it.

Ultimately, making a mistake and needing to go back is very common and it's why the reflog exists. I contribute to Git and use it extensively, so it's useful for both novice and advanced users alike.