简体   繁体   中英

push a commit into multiple branches with git and netbeans

I need to push a commit into two or more branches as the same time, using Git and Netbeans. Those branches are not local, but in BitBucket and shared with others developers.

The situation is this: We have a branch which is used as a master (soon we will rebase it) and we are working on an another one. WHen I find a problem on the older branch, I'll switch to that and do the modification, then commit. I want the pushed code to be merged also with the newer branch.

How Can I do ?

There are a couple of ways to approach this, sounds to me like the simplest one in this case might be to use git cherry-pick to copy the commit from old-branch to new-branch locally on your machine, then push the revised new-branch back to Bitbucket.

The alternative way would be to create a PR on the server from old-branch to new-branch , whether or not this is viable will depend on what else is in old-branch that you don't want to copy across.

Thanks to all. I tryed a cherry-pick trough Netbeans git plugin and it worked perfectly. Now just have to guess if it add only committed lines or if it merges the entire files in the pick. I'll do some tests. I'll try also the pull request, sooner or later.

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