Here is my situation
For this, you cannot do a pull. You did have the right idea though:
git rebase main
Then when locally everything is in order, force push ( git push --force
) to overwrite the remote "my branch", telling it that your state (which includes the commits added from main) is the correct one.
Lets say we have master, branch_A (made from master) and branch_B (also made from master). I am working on branch_A and my friend is working on branch_B. My friends work in branch_B was merged to master. Now I am done and I want to merge my branch to master as well. The process I would follow is below:
git checkout master
git pull
(update local master from with remote changes) git checkout branch_A
git rebase master
(this will pull in the changes from master and stack your branch commits on top) git push origin branch_A -f
(need force since you rebased which changes branch HEAD) Hope that helps.
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.