12

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.

4
  • Why do you not want to use the command line? Commented Oct 1, 2020 at 19:10
  • @flaxel Because I want to see the history of the file in Gitlab Commented Oct 5, 2020 at 11:53
  • You can use the history also with the git log <file> command. Commented Oct 5, 2020 at 12:06
  • 3
    @flaxel I want to see the history graphically, as per Gitlab. Same as what Gitlab normally shows, just for a file which was deleted in the past. Commented Oct 5, 2020 at 20:26

1 Answer 1

18

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for answering. Can't accept as full answer but i've given an upvote for the help.
@user997112 yeah totally understandable, just wanted to give a workaround in case others have the same issue and found this page when googling it like I did. Would be great if there is an easy way to do this in the GUI

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.