简体   繁体   中英

Create a branch from another branch with its latest changes?

I need to create a branch from another branch with its latest changes. I use bitbucket, I created via website panel and I checked out to the new branch in my VS code but I realized that the latest changes don't come. (suppose there is a branch called A which created from the development branch and the A branch has a bunch of commits and now I need branch B from A with its commits) and it seems I create my new branch B from the A but without commits. how can I bring changes in branch B?

You can use this command in branch A :

git checkout -b B A

This way you have branch B with all A commit.

Check out to the branch from you like to make a new branch. Then checkout to your new branch. git checkout branch "newBranch"

切换到你的 A 分支,创建提交后,运行“git checkout -b B”

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