Check upstream git-How can I see which Git branches are tracking which remote / upstream branch?

151    Asked by NiharikaDeshpande in SQL Server , Asked on Jul 1, 2021
- I know I can do git branch --all, and that shows me both local and remote branches, but it's not that useful in showing me the relationships between them.

How do I list branches in a way that shows which local branch is tracking which remote?

Answered by Nakagawa Harada

To resolve check upstream git you should follow:

    “[]@{push}, e.g. master@{push}, @{push}

The suffix @{push} reports the branch "where we would push to" if git push were run while branchname was checked out (or the current HEAD if no branch name is specified). Since our push destination is in a remote repository, of course, we report the local tracking branch that corresponds to that branch (i.e., something in refs/remotes/).”

From the above documentation clearly mentions that you can find the upstream of the branch using:

git rev-parse --symbolic-full-name @{upstream}
refs/remotes/origin/master

Example:

git rev-parse --abbrev-ref master@{upstream}



Your Answer

Interviews

Parent Categories