Francis Bacon
Francis Bacon

Reputation: 4745

how to know which remote branch that my local branch is merged into

I have a local branch and create a pull request, but I do not know if it is accepted and merged, and which remote branch it is merged into.

How can I know that?

I know through gitk or SourceTree we might see the result.

But how to achieve it by command line?

Upvotes: 0

Views: 31

Answers (1)

ElpieKay
ElpieKay

Reputation: 30858

Suppose the local branch is foo.

git fetch
git branch -r --contains foo

git fetch updates the tracking branches like origin/foo.

git branch -r --contains foo lists all the tracking branches (-r) that have merged foo (--contains foo).

If a tracking branch origin/bar is in the output, then we know the branch bar in the remote repository has merged foo.

Upvotes: 1

Related Questions