Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pull older branch?

Tags:

git

Remotely I have several branches, such as master, 12.0 and 13.0. 13.0 is ahead of 12.0, which is again ahead of master.

Locally I only have the branch 13.0, which is up to date with the remote branch.

Now I would also like to have the 12.0 branch locally. So I enter git checkout -b 12.0 and then git pull origin 12.0. However, the first command creates a local branch 12.0 based on 13.0, and consequently git pull produces an error.

So how can I get the remote 12.0 branch on my local machine?

like image 425
Nick Avatar asked Oct 15 '25 20:10

Nick


1 Answers

Use this command separately in different folder to pull that particular branch.

git pull origin --branch <your branch name>

If you want to pull that branch in same project folder then use :

git fetch origin <your branch name>

git checkout <your branch name>

If you face any error try

git checkout -b <your branch name> --track origin/<your branch name>
like image 86
Vipulw Avatar answered Oct 17 '25 11:10

Vipulw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!