git command to emit name of remote tracking branch

前端 未结 4 1027
无人共我
无人共我 2020-12-31 01:04

I\'d like a command that emits the name of the tracked branch for the branch I\'m on. Something like:

$ git checkout --track -b topic origin/master
Branch t         


        
4条回答
  •  萌比男神i
    2020-12-31 01:45

    Will emit the remote being tracked:

    git config branch..remote
    

    Will emit the ref being tracked on that remote:

    git config branch..merge
    

    I don't believe that there is a combined command that will emit both together (at least within normal Git; you could always make your own).


    For example, for a local master branch:

    $ git config branch.master.remote
    origin
    $ git config branch.master.merge
    refs/heads/master
    

提交回复
热议问题