简体   繁体   English

当前分支的远程分支的git引用

[英]git reference for current branch's remote branch

I can indirectly reference "the current commit" with HEAD . 我可以用HEAD间接引用“当前提交”。

I can indirectly reference "the commit before otherCommit " with otherCommit~ or otherCommit^ (subtleties relating to merge commits IIRC) 我可以间接引用“之前提交otherCommit ”与otherCommit~otherCommit^ (涉及合并微妙之处提交IIRC)

Is there a way that I can indirectly reference "the branch which the currently active branch is tracking". 有没有办法可以间接引用“当前活动分支正在跟踪的分支”。

Usages would include git reset --hard <magicReference> which discards local changes, and local commits to the current branch, without needing to type the name of the current branch. 用法包括git reset --hard <magicReference> ,它会丢弃本地更改,并且本地提交到当前分支,而无需键入当前分支的名称。


Regarding any warnings about reset --hard or detached HEAD s ... I do know exactly what I'm doing and none of those concerns apply. 关于reset --hard任何警告 - reset --hard或分离的HEAD ......我确切地知道我在做什么,这些问题都不适用。 Please assume that what command I want to run that happens to references the remote branch that my current branch tracks is genuinely what I want to run. 请假设我想要运行的命令恰好引用the remote branch that my current branch tracks正是我想要运行的。

您正在寻找HEAD@{upstream} ,也称为@{upstream} ,也称为@{u}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM