【问题标题】:Creating aliases for Git branch names为 Git 分支名称创建别名
【发布时间】:2015-01-12 16:26:46
【问题描述】:

假设我在 git 中有以下分支:

  • master
  • release-2014-11-02-some-long-text

我想轻松地在这些之间切换,如下所示:

git checkout devel # checkout to master
git checkout release # checkout to the branch release currently points/aliases to, in this case:  release-2014-11-02-some-long-text (I would like to change this alias from time to time)

如何在 Git 中做到这一点?

【问题讨论】:

    标签: git branch alias git-checkout


    【解决方案1】:

    您可以尝试使用git symbolic-ref(如“Is it possible to alias a branch in Git?”中所述):

    git symbolic-ref refs/heads/devel   refs/heads/master
    git symbolic-ref refs/heads/release refs/heads/release-2014-11-02-some-long-text
    

    您可以找到similar example in this gist

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-23
      • 1970-01-01
      • 2016-12-19
      • 2014-02-07
      相关资源
      最近更新 更多