user997112
user997112

Reputation: 30625

Find a deleted file in Gitlab

I deleted a file ages ago. I don't remember the commit ID or the branch, just the folder the file was contained within.

What's the easiest way to find this file in Gitlab/see what code was in the file?

I can't see any obvious way in the GUI how to achieve this. Google'd but the results referred to finding them in Git, not Gitlab.

Upvotes: 12

Views: 8586

Answers (1)

Christian Wilkie
Christian Wilkie

Reputation: 3823

Came across this in Google and I had the same issue, couldn't find a solution in the current version of the GitLab GUI.

As a workaround from not finding a way to do it in the GUI directly, I ended up cloning the project and using the Git CLI:

git log --all --full-history -- **/myfile.ext

The top commit on this was the commit that deleted the file. You can then browse the commit itself on the GitLab GUI using the commit ID.

Hopefully they'll add better support for this in a future version (unless I just can't find it), but at least this is a workaround.

Upvotes: 17

Related Questions