How to access full source code of an old commit

We use GitHub and Bitbucket for version controlling of our any web project and theme at TechnoCrews. Once in a while, we need to fully revert back to any web project. Sometimes, it is quite impossible to track an old commit after a longer period of time. So, what we do if we want to revert back to the old full source code of a project? How to access full source code of an old commit then? Well, there is no short cut way but it is possible to do it!

First, let me give you the solution to How to access full source code of an old commit in GitHub:

You can put the sha that you want in the download URL:

As a general rule, if you have an URL that works, you can replace “master” with the specific sha you want.

if you are comfortable with command line then: 

First, clone the repository using git, e.g. with:

That downloads the complete history of the repository, so you can switch to any version. Next, change into the newly cloned repository:

and then, use git checkout <COMMIT> to change to the right commit:

Now how to access full source code of an old commit in Bitbucket:

BitBucket project pages have no link to download an arbitrary version. There are links to download specific tags, in the format:

But by tweaking a bit the URL above, changing the tag name by the commit hash, like:

or

where XXXXX is the 5 alphanumeric number from the URL structure of the source.

 

Hope it will help you to manage any big revert back to change your code. Let me know if you need more help by commenting out. I would love to hear any new way of doing so.

Author: Mizanur Rahaman Mizan

Mizanur Rahaman Mizan is an entrepreneur, blogger, innovator, life-long student of technology, marketing and sales, and in most occasion – a teacher of these subjects. By profession, he is dedicated to assisting businesses in achieving growth through new initiatives and the design and execution of innovative marketing and business development programs.

Leave a Reply

Your email address will not be published. Required fields are marked *