Originally, my local master branch is the same as origin/master. imagine the follows:
originally
master: a->b
origin/master: a->b
origin/master one more commit
master: a->b
origin/master: a->b->c
master one more commit
master: a->b->d
origin/master: a->b->c
new branch from master
master : a->b->d
newbranch: a->b->d->e
origin/master: a->b->c
I tried rebasing master branch to origin/master, I expected log of new branch will be a->b->c->d->e. But instead, log of new branch is still a->b->d->e, why is that?
What I'd do:
git checkout master; git reset b
git checkout master; git reset b
git pull origin master
; this will pull in c . git merge
or git cherry-pick
to put commits d and e onto master, resolve any conflicts with commit c . Generally it is advisable to avoid working directly on a master branch. Use feature branches, do git pull --rebase
on them regularly to keep in sync with master, and only merge to freshly-pulled master.
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.