Suppose I am in branch A. How can I merge branches B and C without checking out another branch?
Can I use this command?
git merge B C
Suppose I am in branch A. How can I merge branches B and C without checking out another branch?
Can I use this command?
git merge B C
Nope.... you can't. For these cases, you can use temporarily a new worktree:
git worktree add blahblah B
cd blahblah
git merge C
cd ..
git worktree remove blahblah
How can I merge branches B and C without checking out another branch?
There is no such thing as merging branches B and C. Merging is into. You can merge B into C, or you can merge C into B. They are very different things.
Either way, you must be on the branch you are merging into. This is because Git needs to use the working tree to enact the merge.