-1

I am trying to create a pull request for a particular commit. I have already executed the following commands

git push upstream issue-430 

There is a particular commit that I want to create a pull request. I tried to create another branch from issue-430 and cherry pick the particular commit but it is giving the error

error: your local changes would be overwritten by cherry-pick.
hint: commit your changes or stash them to proceed.
fatal: cherry-pick failed

But I already committed all my local changes.

kowsky
  • 12,647
  • 2
  • 28
  • 41
TriposG
  • 103
  • 1
  • 2
  • 11

1 Answers1

0

I tried to create another branch from issue-430

This is a problem — you created a branch from issue-430 (say it's called newbranch), which means that any commits made in issue-430 are already in new-branch. When you branch off another branch, it's almost like creating a copy of where you branched from (not really because it's actually just creating another pointer to the same hash but for understanding sake we'll go with this). So you're trying to cherry pick commits from issue-430 onto new-branch but they're already there because new-branch is the same as issue-430, so you can't commit anything because git says there's no changes to apply.

You probably also have modified changes that show up when running git status, and those modified files, git is saying, will be overwritten if you try to apply the changes from the commit you're cherry-picking.

So instead, say you want to make a PR to master from a specific commit from issue-430. First, make sure you don't have any relevant uncommitted changes (you can git stash to push them off for now)

Checkout master first and branch off that, say we call it pr-branch. Then, cherry-pick that one commit onto pr-branch. Then, push pr-branch to your upstream repo.

rb612
  • 5,280
  • 3
  • 30
  • 68