Tim
Tim

Reputation: 99616

Are these two meanings of a pull request both correct, and contrary to each other?

On my local repository, I created a branch A from branch B. I did some work on branch A, and pushed A to github.

Then I created a pull request on github, in order to merge branch A into branch B, I heard that it is said to be "branch A is pulled from branch B". Is it correct?

Doesn't a pull request mean merging branch A into branch B?

What does "pulling" branch A from branch B mean?

It seems to me that the two meanings of a pull request are contrary to each other.

Upvotes: 2

Views: 215

Answers (3)

codemacabre
codemacabre

Reputation: 1122

There are two different uses of 'pull' in git terminology and, while not contradictory, they can be confusing at first.

1. Pull:

From the command-line command git pull (also known as a combination of fetch and merge). Essentially just gets the remote code (or 'pulls' it to your computer) and merges it into your local code. Read more here.

2. Pull request:

When you want to merge your changes into the repo. Generally opens a discussion and review of your changes before the pull request (or 'PR') is accepted. Read more here.


As an aside, there is also a 'push' command, which may make things clearer (and reiterate the direction pushing and pulling to and from local and remote repos). git push 'pushes' your commits from local to remote (i.e. the opposite of #1, git pull). Read more here.

Upvotes: 1

n4feng
n4feng

Reputation: 2454

Pull and Merge are two different process.

"branch A pull from branch B" means you make a editable copy, call it A, from B (If A originally not exist).

"Merge A into B" means you are applying all the changes you made in A back into B

the reason people saying that "branch A is pulled from branch B" is because if A is not pull from B, it can not be merged back to B

Upvotes: 1

kelunik
kelunik

Reputation: 6928

If you merge A into B it will be:

Branch A is pulled into B.

or

Branch B is pulled from A.

It refers to the branch you're currently at. If you're in branch B and pull from A, that pull will first fetch A and then merge A.

Upvotes: 1

Related Questions