1

I'm the owner of repository A.

My Collage created a fork from my repository (AFork) and made a Pull request or Commits A, B and C (In that order).

I reviewed his changes and found that i only wont to merge the changes of commit C without the changes that parts of commit A and B.

I understand that i can not do that with GitHub website and i have to use the Git command line.

I investigated, and found something called "cherry-pick" but for some reason i can not figure out whats are the exact steps i have to do.

What i tried is:

  1. Connecting to the fork and pulling everything to a separate directory.
  2. from the above directory (of the fork) i typed: git cherry-pick [long-hash of the C commit here]

i got the following error:

The previous cherry-pick is now empty, possibly due to conflict resolution

How can i fix that or what should i do to accomplish what i want to do?

Will be help if someone will write the exact steps that i have to do including command line examples.

Timir
  • 1,395
  • 8
  • 16
Omtechguy
  • 3,321
  • 7
  • 37
  • 71

1 Answers1

1

You should try doing git status, it should tell you whats up and what your options are for the current state of cherry-pick

git status

I think you will need to run the following command, but make sure you have no changes that you don't want to lose

git cherry-pick --abort

For your actual problem at hand, you can't cherry-pick commits across repositories (aka 2 separate git directories). What you could try is creating a Patch, but I have tried doing that in the past and its cumbersome.

I think the easiest solution would be to add your colleague's repository as a remote, pull his branch from his remote repository, and then cherry pick his commit from his branch.

Is it possible to cherry-pick a commit from another git repository?

Kristupas A.
  • 304
  • 5
  • 15