简体   繁体   中英

Git merge from same branch?

I have a single branch in the form of:

 a --> b --> c
 ^           ^
 |           |
main        dev

I want to make another connection between a and c . A visual:

 ----> b --->
 |          |
 a -------> c
 ^          ^
 |          |
main       dev

How would I do this with git? Is it possible?

Assuming you want to keep the contents of c in the new revision:

git commit-tree -p main -p b -m "one comment" c^{tree}

That will give you a revision id as the result. Feel free to check it with log or check it out.... when you feel like that is what you want:

git branch -f dev the-id

And you are done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM