'how to push only current changes on specific or other branch from my current branch

let's asume, I have a repo. there are separate branches. branch A & branch B. branch A has 15 commits and branch B has 10 commits. now I am working on branch A and doing some changes and committing it locally. basically, it will commit number 16 for branch A, but I want to push these commits on branch B. I want to say that I want to push only the latest change(only commit no 16) on branch B from branch A. How it will possible?



Solution 1:[1]

If I'm interpreting your question correctly, you are looking to push changes from a specific branch.

git push origin <branch-name>

You should be able to execute this regardless of which branch you are currently on. Note that this assumes your local and remote branches have the same name.

In your example, executing git push origin branch-B should do the trick.

I suggest reading some additional answers on this thread.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ExplosiveFridge