小编Mil*_*mic的帖子

如何从特定提交继续项目并修复 HEAD 分离问题?

我从我的项目中检出特定提交并从那里继续,希望该提交之后的更改将被删除,并且我检出的那个提交将是新的头。我提交了新的更改,但我无法推动它们。我还是 git 的新手。

我所做的是:

  1. git checkout commit_hash
  2. 编辑项目
  3. git commit -m "新变化"
  4. git push -u origin master

我有:

To https://github.com/myusername/project.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/miloradsimic/ISA16.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing …
Run Code Online (Sandbox Code Playgroud)

git version-control head git-detached-head

4
推荐指数
1
解决办法
4894
查看次数

标签 统计

git ×1

git-detached-head ×1

head ×1

version-control ×1