Andrew Rhyne
Andrew Rhyne

Reputation: 5090

How does pull work with git?

I have a question regarding git repository management.

Lets say I want to create a new branch from 'develop' for a patch. Easy enough:

sudo git checkout develop && sudo git checkout -b test-patch

I also want collaboration, so I am going to push that branch to our remote:

sudo git push -u origin test-patch

Now, I want to pull in changes because another developer has finished a piece of the patch:

sudo git pull origin test-patch

So, here is my question...

EDIT

Now that I understand that origin refers to the repository that the branch hails from, does sudo git pull origin test-patch get any changes from the remote copy of the 'test-patch' branch and apply those changes to the local copy (excluding the possibility of conflicts)?

Upvotes: 1

Views: 186

Answers (1)

Nevik Rehnel
Nevik Rehnel

Reputation: 51935

No, origin identifies the remote from which you want to pull. When you clone a repo with git, that repo you clone from will by default be registered as a remote called origin.

You can change that name or add other remotes with the command git remote

Upvotes: 5

Related Questions