如果我仅使用分支机构名称签出分支机构,则HEAD会更新为指向该分支机构。
$ git checkout branch
Switched to branch 'branch'
如果我使用refs/heads/branch或heads/branch检出一个分支,HEAD将变为分离状态。
$ git checkout refs/heads/branch
Note: checking out 'refs/heads/branch'.
You are in 'detached HEAD' state. You can look around, make
我很确定我在一个流行的Git项目中看到分支有一个类似于"feature/xyz“的模式。
然而,当我尝试创建一个带有斜杠字符的分支时,我得到了一个错误:
$ git branch labs/feature
error: unable to resolve reference refs/heads/labs/feature: Not a directory
fatal: Failed to lock ref for update: Not a directory
(我最初的尝试)也有同样的问题:
$ git checkout -b labs/feature
如何在Git中创建带有斜杠字符
一段时间以来,我一直在使用带有斜线的分支,但突然发现在某些情况下我无法创建它们
$ git init
Initialized empty Git repository in /home/dimskraft/tests/git-slash-branch/.git/
$ git checkout -b my-branch
Switched to a new branch 'my-branch'
$ git status
On branch my-branch
No commits yet
nothing to commit (create/copy files and us
我有一个分支和一个名为test的标记。如果我有一个明确的引用,比如heads/test或refs/heads/test,那么我如何才能不进入分离状态而签出呢?
git checkout heads/test
我想保存当前的HEAD状态,然后返回到它:
# Exit if dirty
# Save HEAD
ref=$(git symbolic-ref -q --short HEAD)
if [ -z "$ref" ] ; then # Detached
ref=$(git rev-parse HEAD)
fi
echo $ref
# Do Stuff that ch
我是git的新手,正面临着这个问题。git push命令显示以下错误。我将从一开始就向你解释我一直在努力做的事情。我创建了一个子模块,提交并推送它。推送抛出下面的错误。
Salman@PC_HOME ~/git/breakit-web-app (master)
$ git push origin master
error: refs/heads/master does not point to a valid object!
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objec
我正在尝试同步我的github回购与AWS协解程序。在尝试执行git push sync --mirror时,我不知道它为什么要删除。对于master分支,相同的代码可以正常工作,当我切换到preprod分支时,它会失败,出现以下错误
remote: error: refusing to delete the current default branch 'refs/heads/master'.
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
error:
我刚刚安装了netbeans,并通过ssh连接到我的git存储库。
除了推入主分支之外,其他一切都很正常。每次我在主分支上提交一些更改并尝试推送分支时,我都会得到这个弹出窗口:
There were errors during the push.
Open output to see more details.
详细信息如下
==[IDE]== Jun 30, 2012 4:29:42 PM Pushing finished.
==[IDE]== Jun 30, 2012 4:32:38 PM Pushing
git push ssh://50.57.180.187:22/var/www/ne