[英]Branch is behind 'GitHub/master' by 1 commit
New to git and having an issue. git 的新手并遇到问题。
Commit ab30d85: "Github/Master" - Test提交 ab30d85: "Github/Master" - 测试
Commit d4f6492: "Master" - Fixed error提交 d4f6492:“大师” - 修复错误
I need to delete and remove the ab30d85 commit and make the d4f6492 the master for github.我需要删除并移除 ab30d85 提交,并使 d4f6492 成为 github 的主控。 When I try to revert the test commit I get the error below.当我尝试恢复测试提交时,出现以下错误。 Please help.请帮忙。
On branch master Your branch is behind 'GitHub/master' by 1 commit, and can be fast-forwarded.在分支 master 您的分支在 'GitHub/master' 之后 1 次提交,并且可以快进。 (use "git pull" to update your local branch) nothing to commit, working tree clean (使用“git pull”更新你的本地分支)没有提交,工作树干净
Make sure you've deleted the commit on your local, and force push to the master branch to update it as per your local branch using确保您已删除本地的提交,并强制推送到主分支以根据您的本地分支使用
git checkout master; git push -f
That being said, please know that the master branch on github will be force updated with your local branch.话虽如此,请注意 github 上的主分支将与您的本地分支强制更新。 This is not a recommended practice.这不是推荐的做法。
You have options:您有以下选择:
git rebase origin/master
will rework you local branch to include the ab30 commit and the apply you d4f commit. git rebase origin/master
将重做您的本地分支以包括 ab30 提交和应用您的 d4f 提交。 You will need to force push after fixing any merge conflicts to get this onto the remote branch.在修复任何合并冲突后,您需要强制推送以将其放到远程分支上。
git push --force
will replace the remote branch with your local copy. git push --force
将用您的本地副本替换远程分支。 Not good practice in general一般不是很好的做法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.