- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想用提交消息“第一”和“第二”压缩两个最新提交。首先我拉 master 然后我使用命令
git rebase -i HEAD~2 master
它向我显示了编辑器中的两次提交,如下所示:
pick first
pick second
然后我将此编辑器更改为:
pick first
squash second
保存更改后,我收到此消息:
Successfully rebased and updated refs/heads/master.
它确实改变了远程主控中的任何内容。为了应用这些更改,我使用 git push 命令并收到以下错误:
To https://github.com/aneelatest/GITtest.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/test/GITtest.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
然后我再次运行 git pull
命令,它合并 origin master 并使用此提交消息进行另一次提交:
Merge branch 'master' of https://github.com/aneelatest/GITtest
此后,当我运行 git Push 时,它将两个提交压缩为一个,并带有消息“first”。问题是在远程主控中,我现在有四个提交:
first
second
Merge branch 'master' of https://github.com/test/GITtest
first
我只想要一个提交,即带有提交消息“第一个”的压缩提交。有什么想法我做错了吗?
最佳答案
git rebase
重写历史记录,因为提交已被修改。当上述提交尚未推送到远程存储库时,这不是问题,但这里远程存储库之前已使用您重写的提交进行了推送,因此它拒绝了推送。
当你从 github 拉取时,它合并了两个历史记录,并应用了你的南瓜提交,因此造成了困惑。
结论:当你想重写已经推送的提交时,你有两个选择:
git push --force
,这也会在远程重写历史记录,并告诉人们您已经重写了历史记录,这样他们在下一次拉取时就会看到奇怪的事情。<关于github - 想要压缩 github 中的多个提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17670717/
使用登录后,我想吐出用户名。 但是,当我尝试单击登录按钮时, 它给了我力量。 我看着logcat,但是什么也没显示。 这种编码是在说。 它将根据我在登录屏幕中输入的名称来烘烤用户名。 不会有任何密码。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎是题外话,因为它缺乏足够的信息来诊断问题。 更详细地描述您的问题或include a min
我是一名优秀的程序员,十分优秀!