简体   繁体   中英

Git rebase from branch A to B

I have two branches, Master and Develop. I will like to "copy" the content of Develop in Master so:

Master <- Develop

According to documentation:

git rebase <base>

Rebase the current branch onto base, which can be any kind of commit reference (an ID, a branch name, a tag, or a relative reference to HEAD).

But Im not very sure about the terminology, if I check out to Master and from there i do git rebase develop am I coping everything from develop to master or the other way?

git rebase X means:

move the commits of the current branch on top of branch X .

In your case:

git checkout Develop
git rebase master

But if you don't want to change the history of Develop (for instance, if Develop was already pushed to a remote repo), a simple git merge is enough.

git checkout master
git merge Develop

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