How to check if remote branch exists on a given remote repository?

后端 未结 14 1018
独厮守ぢ
独厮守ぢ 2020-12-02 11:04

I need to do a subtree merge for a specific branch, if it exists on a given remote repository. The problem is that the remote repository is not checked out locally, so I can

14条回答
  •  半阙折子戏
    2020-12-02 11:15

    Then no need to manually pass the repository name everytime.

    git ls-remote origin 
    

    Instead of

    git ls-remote  
    

    Example :

    git ls-remote git@bitbucket.org:landmarkgroupme/in-store-application.git  uat_21dec
    

    OR

    git ls-remote origin uat_21dec
    

    Both will give same output :

    More on Origin : Git has the concept of "remotes", which are simply URLs to other copies of your repository. When you clone another repository, Git automatically creates a remote named "origin" and points to it. You can see more information about the remote by typing git remote show origin .

提交回复
热议问题