How can I make my develop branch ahead of master branch?
What happened was:
I tried to git pull and rebase, but both changed my develop version 1.1 into master version 1.0.
What should I do?
A git log --decorate --graph --oneline --all --branches
in your local repository should show you something like:
x commit for 1.0 (HEAD, master, origin/master)
|
x commit for 1.1 (develop, origin/develop)
You can therefore reset your develop
branch to master
, and cherry-pick your old develop
commit, on top of master
.
git switch -C develop master
git cherry-pick origin/develop
git push -f -u origin develop
(assuming here there was only only commit on develop
)
The new log should show develop
ahead of master
now:
x commit for 1.1 (HEAD, develop, origin/develop)
|
x commit for 1.0 (master, origin/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.