Issue
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 ?
Solution
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.
Answered By - Gavin Campbell