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