Skip to main content

How to access full source of an old commit in BitBucket

· 2 min read

I have sometime needed a file in a Bitbucket git repository that I had deleted some commits before. I needed to check the contain of this file and the rest of files of the commit where this file was deleted.

In order to find this file, we have to use the command

git log -- [file path]

This command shows all the changes of the file. If we want to find the last commit where the file was deleted, we will use the command

git log -1 -- [file path]

For example, to find a file called menu.xml in somewhere of the repository, we execute

lostinsoftware$ git log -1 -- \*menu.xml
commit c04b4eca30769be967be7a92f2f75e27488385c3
Author: lostinsoftware
Date: Tue Feb 1 15:08:00 2015 +0200

Refactoring security

Then we go to the list of commits in Bitbucket and we select the commit that we found with the command aforementioned. We click on the commit line

We will get the list of files changed in this commit

If we click on the link of the file, we will see the source of this file.

Then, if we click on the View of file button of another file, we will be able to review the source of the selected file.

We can go to all files of the repository in this commit clicking on the link of the repository's name, as it is shown in the image before.

The pattern of the url of every commit is:

https://bitbucket.org/<user>/<repository_name>/src/<commit-id>?at=master