1

I am trying to merge commits from branch B to branch A.

branch A has commits a-c 
branch B has commits d-f BUT doesn't have commits a-c in it's commit history.

How can I get branch B's commits d-f to show in branch A after commit c.

I tried git cherry-pick hashCommit but I got a message saying

The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'

I also checked out this SO post, but wasn't sure which Answer was suitable for me.

When I look in my github pages branch B, at the top it say branch B is x commits ahead of branch A

enter image description here

Also after doing the cherry-pick, when I type git log, the first commit shows

commit hashCommitNumber (HEAD -> branchB, origin/branchB, branchA)

I am currently checked out on branch B

henhen
  • 1,038
  • 3
  • 18
  • 36

1 Answers1

0

What I did was I migrated the RTC histories from the last successful cut off date to the present date

It depends on how/where that migration was made: if it is in a new repo/new branch, then yes, a merge would be difficult (unrelated history)

A better practice is:

  • having a local clone of your GitHub repository, set on the branch you want to update with RTC new changesets
  • having a local RTC repository workspace (sandbox)
  • iterate on each changeset and update your sandbox
  • use git --work-tree=/path/to/sandbox add . (done inside your local Git clone). That will detect any new/changed/removed file from sandbox compared to your current Git repository content
  • commit, and repeat for the next changeset.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Would this have to be done manually for each changeset? There are hundreds of them. I think the purpose of using rtc2gitcli tool was so that it is automated, but this initializes a local git repository which I have to connect to remote, but that gave me the problems in OP – henhen Feb 10 '20 at 19:24
  • Then use rtc2git, then cherry-pick the commit from the new unrelated branch into your existing one. – VonC Feb 10 '20 at 21:18
  • Do you know how I can do that? I tried to cherry pick but it says the previous Cherry Pick is empty. I updated OP to explain what I have done. – henhen Feb 12 '20 at 20:44
  • @henhen You can cherry-pick a range of commits: https://stackoverflow.com/a/1994491/6309 – VonC Feb 12 '20 at 21:13
  • yes, thats what I did first, but I got the following error `error: empty commit set passed, fatal: cherry-pick failed ` – henhen Feb 12 '20 at 21:26
  • @henhen the order of commits in the range matter, as explained in the link. – VonC Feb 12 '20 at 21:27
  • when I do this, should I be checked out on branch B or branch A? branch B is the branch with commits branch A does not have. – henhen Feb 13 '20 at 18:30
  • @hen A, meaning the destination branch, the one where you need to create commits – VonC Feb 13 '20 at 20:00