This blog will provide the method of finding which remote branch a local branch is tracking.
How do Find out Which Remote Branch a Local Branch is Tracking?
To find out which remote branch a local branch is tracking, multiple Git commands are used, such as:
- “$ git branch -vv” command
- “$ git -avv” command
- “$ git status” command
Let’s move ahead and check out the results of the above-listed commands!
First, run the “cd” command and move to the Git root directory:
To view the remote branch a local branch is tracking, use the “git branch” command:
As you can see, the below-highlighted “origin/master” branch is the remote tracking branch:
Another way to display the tracking branch is using the “git branch” command along with the “-avv” option:
Here, the below-highlighted branch is the remote-tracking branch of a local branch:
You can also get the name of the remote branch which is tracking a local branch by checking the current repository status:
That was all about finding the remote branch which is tracking a local branch.
Conclusion
To find out which remote branch a local branch is tracking, multiple Git commands are used, such as “$ git branch -vv”, “$ git -avv” and “$ git status” commands. To utilize these commands, move to the required Git local repository and run any of the mentioned commands. This blog demonstrated the method to find out which remote branch a local branch is tracking.