在我的主分支中,我做了一个git merge some-other-branch本地,但从未将更改推送到原始主.我不是故意合并,所以我想撤消它.在git status合并后执行操作时,我收到此消息:
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
Run Code Online (Sandbox Code Playgroud)
git revert HEAD -m 1
Run Code Online (Sandbox Code Playgroud)
但现在我收到这条消息git status:
# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
Run Code Online (Sandbox Code Playgroud)
我不希望我的分支通过任何数量的提交领先.我该如何回到那一点?
有没有办法可以撤消一个已更改的文件的自动合并而不是Git中的整个分支?
我想撤消这个合并:
自动合并public/stylesheets/application.css
到以前的版本,其余的保持当前状态.
我试过了:
git reset HEAD~1 public/stylesheet/application.css
Run Code Online (Sandbox Code Playgroud)
但似乎它不起作用.
当我自己工作时,不了解 git 的基础知识是可以的,但是现在我正在和另一个人一起工作,并且我们每个人都提交拉取请求以让他们合并,这开始成为一个问题。
工作流程:我写在我的“作者”分支。当准备好进行审查时,我提交了一个拉取请求,我的编辑器将其合并到 master 中。当她对我有意见时,她提交了她的 Editor 分支的 pull request,我将它们合并到 master 中。
今天,我收到了一个完全令人恼火的循环错误,我不明白我被要求做什么。
thomas@trigger ‹ author ?? › : ~/pm/wip
[1] % git push
To https://github.com/mathpunk/punk-mathematics-text.git
! [rejected] Editor -> Editor (non-fast-forward)
! [rejected] author -> author (non-fast-forward)
error: failed to push some refs to 'https://github.com/mathpunk/punk-mathematics-text.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
所以,我尝试 git …