Git: 删除或替换 master 分支为 head
Git: Removing or replacing master branch with head
我在我的项目中到了某个阶段,有些东西搞砸了,所以我检查了一个旧版本。我以为我将当前签出的版本作为主版本并丢弃了被搞砸的版本。看起来这并没有发生,因为在 运行:
之后
git push -u origin master
我收到了这些错误:
error: failed to push some refs to 'https://username@bitbucket.org/username/project.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details
我对git有初步的了解,不想还原或整合恶魔大师分支。我很确定 'git pull' 正是我不想要的。我在寻找什么命令?
已发布的历史记录(在 bitbucket "origin" 端)是:
--o--o--o--o--O (origin/master)
在你身边:
--o--o--o--o (master)
如果您想用 master
替换 origin/master
,则必须 push --force -u origin master
。
不过要小心,并在更改其历史记录之前检查其他人是否已经在使用origin/master
。
我在我的项目中到了某个阶段,有些东西搞砸了,所以我检查了一个旧版本。我以为我将当前签出的版本作为主版本并丢弃了被搞砸的版本。看起来这并没有发生,因为在 运行:
之后git push -u origin master
我收到了这些错误:
error: failed to push some refs to 'https://username@bitbucket.org/username/project.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details
我对git有初步的了解,不想还原或整合恶魔大师分支。我很确定 'git pull' 正是我不想要的。我在寻找什么命令?
已发布的历史记录(在 bitbucket "origin" 端)是:
--o--o--o--o--O (origin/master)
在你身边:
--o--o--o--o (master)
如果您想用 master
替换 origin/master
,则必须 push --force -u origin master
。
不过要小心,并在更改其历史记录之前检查其他人是否已经在使用origin/master
。