j3d
j3d

Reputation: 9724

How to move unpushed commits from a local branch into a separate clone

I have a set of unpushed commits in a local branch... and want to move them into another local branch created out of a new fresh clone. Is that possible?

Upvotes: 1

Views: 40

Answers (1)

storm
storm

Reputation: 409

You need to set the first project as remote branche of the second then get your commits references by using git log and cherry pick merge them to the new branch

cd /home/projectB
git remote add projectA /home/you/projectA
git fetch projectA
git cherry-pick <first_commit>..<last_commit>
git remote remove projectA

Upvotes: 2

Related Questions