I would like to see if one of my new local branches exists on the remote computer with a single line. Like creating an alias or function that would let me type
git remoteExists <branchName>
Right now, I manually write off each branch on the remote control and check if my local branch exists. This is not as easy as we would like, because our remote has hundreds of branches, many of which have similar names.
I switch branches, often working on different things, maybe 6-7 at a time, and it's hard to remember if I finished and clicked on a branch, or I still need to finish it.
I searched and found ways to do something similar to this, but many seemed unnecessarily complicated, is there an easier way to do this?
EDIT
To understand what I am doing. I start with the remote branch and disable the local branch. I make changes to my local branch and push. I do not want to set the branch upstream, since I will no longer use this branch; the person working with the remote branch will view my changes and integrate them into the remote version.
It works:
git diff <branchName> remotes/origin/<branchName>
fatal: ambiguous argument 'remotes / origin / TestReadyBranch': unknown version or path not in the working tree. Use '-' to separate paths from revisions, for example: 'git [...] - [...]'
Having seen this error, I would know that the branch does not exist on the remote control. Is there a cleaner way to do this?
git branch
Alex
source share