Git pull remote branch to local

Time:2020-4-11

Git pull remote branch to local

Pull branch

First, you need to check whether you have a connection with the remote warehouse.

git remote -v

If not, add it yourself

Git remote add origin xxxx (GIT warehouse address of your remote branch)

If you want to commit code every day, you can bypass the above step and switch branches directly

git checkout -b Q3 origin/Q3

At this time, the operation failure prompt is as follows:

  • fatal: ‘origin/Q3’ is not a commit and a branch ‘Q3’ cannot be created from it

It means that you don’t have the remote branch Q3 locally.

You can perform git branch – r to check if there is a Q3 remote branch locally.
Pull remote branch to local and switch branches.

git fetch origin Q3
git checkout -b Q3 origin/Q3

Pull remote branch to local

git pull origin Q3

My blog and GitHub, if you like, go to dianxing, thank you.

https://github.com/lanpangzhi

http://blog.langpz.com

Reference resources

https://curder.gitbooks.io/blog/git/remote_repository_pull.html

Recommended Today

nuxt.js Imitating wechat app communication chat | Vue + nuxt chat | imitating wechat interface

Project overview be based on vue.js + nuxt.js +Chat room imitating wechat app interface developed by vuex + webpack + node + vant and other technologiesNuxtchatroom project。 It realizes the functions of card type drag and slide, message / expression sending, picture / video preview, red packet / circle of friends and so on. Technology […]