How to download source code for a particular commit in Bitbucket?
Asked Answered
S

5

39

I would like to download (as zip) a particular commit in Bitbucket. Unfortunately I can not find any facility in the UI to do it.

(I've already found out that I can see the source by copy and pasting the short hash of the commit after the url: https://bitbucket.org/myname/myproject/src/) Is this manual way only to browse the source code of a particular commit?)

Shoup answered 5/8, 2014 at 7:45 Comment(1)
my answer was one year earlier than the accepted answer and it is same.Medullated
M
82

The url below should work. Just change required parts.

https://bitbucket.org/<username>/<reponame>/get/<commitCODE>.tar.gz

(without hypens)

Medullated answered 24/8, 2015 at 15:1 Comment(2)
Is there a way to provide credentials while calling this url? Since some of the repos are private in nature and needs login id and password of bitbucket to get access.Uri
@AnudeepS You can use curl: curl -s -S --user username:apppassword -L -O <URL>Medullated
C
42

https://bitbucket.org/USERNAME/PROJECTNAME/get/COMMITNUMBER.tar.gz

note the uppercase in the URL. you will need to change them COMMITNUMBER can be found under commit for that specific commit.

Chattanooga answered 25/1, 2016 at 9:55 Comment(0)
S
8

You'll need to add the Tag for the particular commit and then you can Download it as a zip.

  1. Login to bitbucket.org
  2. Navigate to a particular Repository
  3. From the left pane click on Commits
  4. Click on the row for your desired commit
  5. Add a tag
  6. Click on Downloads from left pane
  7. Click on Tags and download the zip
Subplot answered 2/12, 2022 at 5:46 Comment(1)
this is an excellent answer to this question and still relevant today in late 2023Fricassee
V
3

To download a particular commit in Bitbucket go to : Repositories -> Select repository click on Downloads --> Branches. You will find all the commits made to the repository. Select which commit you want to download. To download as a zip file, click zip under download column.

Veronique answered 22/9, 2017 at 16:5 Comment(1)
This is not possible in 2021. Maybe they removed this feature from BitBucket.Finstad
C
0

Please try to enter in Terminal "git checkout COMMIT-ID"

Replace COMMIT-ID with the commit id in your repo.

Congenital answered 2/8, 2021 at 22:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.