I create a new branch (pj2/new-register-feature) from [dev-project2] branch and I created a pull request to [dev-project2] branch. (pull request 1).
And then let's continue action rebase [dev-project2] to [dev-project1] and push force [dev-project2] branch after rebase.
But when I review [pull request 1] as above it was occur a lot of commit on [pull request 1] after rebased [dev-project2] to [dev-project1] branch.
So, Could you help me explain it and how to update [pull request 1] to only see commit of [pj2/new-registry-feature] which create pull request
Here is how I understood your question (please let me know if I missed something) :
You started from :
--A--B--C--D--E--F--G--H <- dev-project1
\
\-c--d--e--f--g <- dev-project2
\
\-p--q--r <- pj2/new-register-feature
And created a pull request to merge pj2/new-register-feature
into dev-project2
.
Then you rebase dev-project2
onto dev-project1
.
With the rebase completed, the graph now looks like :
--A--B--C--D--E--F--G--H <- dev-project1
\ \
\-c--d--e-[f]-[g] \-c'--d'--e'--f'--g' <- dev-project2
\
\-p--q--r <- pj2/new-register-feature
What you observe in the merge request is :
p--q--r
as the history for your branch (wrt dev-project2
), c--d--e--p--q--r
If you want to restore something closer to the initial graph, you would need to rebase pj2/new-register-feature
on top of e'
(that is : the rebased version of the original fork point between pj2/new-register-feature
and dev-project2
).
I'll try to explain it with out image.
After you rebase project2 to project1, you change all the commits in project2 (at least their hash) as the rebase puts them after the commits in project1. In this case, your project2 commits and new-register-feature commits are completely different and you see all those commits.
Read the https://git-scm.com/book/en/v2/Git-Branching-Rebasing for some more data, they explain what happens when you rebase.
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.