how do you change the parent branch in git?

Here is my current git graph:
main __c1__c2__c3__c4__c5
|
branchA |__c1__c2__c3__c4
|
branchB |__c1__c2__c3__C4
main __c1__c2__c3__c4__c5
|
branchA |__c1__c2__c3__c4
|
branchB |__c1__c2__c3__C4
I mistakenly though I was branching out of the last commit on main. but I instead branched out of branchA. I don't wanna go through removing the branchA changes from every single file on branchB. Is there a way to "rebase" the branchB - c1 on main - c2 without doing it the hard way?
15 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
venego
venego•2y ago
execute my noobish question. it worked(in a scary way) thank you I've lost the commit in the second argument. I just realized that after deleting the bkp
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
venego
venego•2y ago
yes c1 in branchB
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
venego
venego•2y ago
I guess I'll try to restore the filesystem somehow. I didn't even use trash, I deleted right away
venego
venego•2y ago
this says it should've worked
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
venego
venego•2y ago
no worries it's a small feature. thank god I do atomic commits.
venego
venego•2y ago
yh I just read it here.
venego
venego•2y ago
thanks though for your time I'm not sure but I think the commit could be just dereferenced. is there a way to list all un referenced commits?
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
venego
venego•2y ago
I already did. but it's a detached head. how do I reference it back from the common commit. I was able to diff and it turns out that I've changed a lot in that commit 😆
venego
venego•2y ago
oh they just told me how to do so.
venego
venego•2y ago
fixed
Want results from more Discord servers?
Add your server