zehata
zehata

Reputation: 3674

Git how to pull only some commits

I have some commits that i have made to my own forked repo from the master, now I would like to create a pull request for only some of my commits (some are reverted in my repo). I don't want to clutter up the pull request with my unnecessary commits, what should I do.

Upvotes: 4

Views: 6568

Answers (2)

Chetan Narsude
Chetan Narsude

Reputation: 340

Assuming "origin" is your remote and you want to create a pull request against "master" branch of "origin".

git fetch origin
git checkout -b new_branch origin/master

Then a bunch of

git cherry-pick {commit-id}

where {commit-id} is specific commit that you want to pick.

When you are done, create a new request from new_branch!

Upvotes: 7

kgsharathkumar
kgsharathkumar

Reputation: 1399

Better Solution is Create a Local Branch and get code from master branch and make change in your local branch and again push to master and Push to server. :)

Upvotes: 2

Related Questions