相关疑难解决方法(0)

撤消尚未推送的Git合并

在我的主分支中,我做了一个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 undo git-merge

3695
推荐指数
27
解决办法
200万
查看次数

Git只撤消对特定文件的自动合并,而不是整个分支

有没有办法可以撤消一个已更改的文件的自动合并而不是Git中的整个分支?

我想撤消这个合并:

自动合并public/stylesheets/application.css

到以前的版本,其余的保持当前状态.

我试过了:

git reset HEAD~1 public/stylesheet/application.css
Run Code Online (Sandbox Code Playgroud)

但似乎它不起作用.

git

18
推荐指数
3
解决办法
2万
查看次数

git:对“非快进”错误的基本误解

当我自己工作时,不了解 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 …

git

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

标签 统计

git ×3

git-merge ×1

undo ×1