Jack D.
Jack D.

Reputation: 33

Create a branch from an unmerged (and unckecked) pull request from github

I cloned a project from github with

git clone https://github.com/somecompany/someproject.git

Now I want to make a branch using an unmerged (on github) and unchecked pull request

https://github.com/somecompany/someproject/pull/1234

Can I do this using only git console tool?

Upvotes: 2

Views: 2577

Answers (1)

kowsky
kowsky

Reputation: 14439

Yes. The pull request is a request to merge one branch (let's call it branch-to-merge) into another branch. You just have to

git fetch

in your local clone to fetch all remote changes, including information about the remote branch-to-merge. Now, you can just

checkout branch-to-merge,

to check out a local copy of branch-to-merge. From there, you can create branches (git checkout -b new-branch) to work on top of those changes.


Edit: You should be aware of @miqdadamirali s comment:

[...] if you commit & push anything on branch-to-merge, it'll be part of the PR while it's still open

So you should create a new branch instead of working directly on branch-to-merge.

Upvotes: 4

Related Questions