How to pull specific commit code from bitbucket-git

26,052

Solution 1

You can't pull a single commit. Rather, clone the repository and checkout the commit you are interested in:

$ git clone <repo>
$ git checkout v1

This will create a detached HEAD state in your working copy, mirroring the state in commit v1.

If you want to continue committing from where v1 ended, use a hard reset:

$ git reset --hard v1

Solution 2

I had the same query, this is how i solved it:

1.) Make a new branch in ur git directory:

git branch new-branch-name-here

2.) Switch into that branch

(git checkout new-branch-name-here)

3.) Once on that branch, type:

git reset commit-code-here --hard

(where commit-code-here is the commit name, in ur case v3.)

ull be back to that commit!

Share:
26,052
N Sharma
Author by

N Sharma

I have done masters in Advanced Software Engineering. I have worked on various technologies like Java, Android, Design patterns. My research area during my masters is revolving around the Recommendation algorithms that E-commerce websites are using in order to recommend the products to their customers on the basis of their preferences.

Updated on July 25, 2022

Comments

  • N Sharma
    N Sharma almost 2 years

    I am using BitBucket-Git for my android application for version control. I have commited code five times.

    Suppose I have done five commits v1, v2, v3, v4, v5. Now I want to get the complete source code till I have v3 commit only. Is there any way to get that?

    I just simply want to pull complete code till v3.