简体   繁体   English

分支落后于 'GitHub/master' 1 次提交

[英]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.

相关问题 GitHub 分支总是落后于 master 一个提交 - GitHub branch always one commit behind master “使用”一个成功的Git分支模型“,在Github中,这个分支是提前1次提交,1次提交后” - “This branch is 1 commit ahead, 1 commit behind master” in Github while using “A successful Git branching model” Git:您的分支是在master后面提交1个,在master后面提交5个? - Git: Your branch is 1 commit ahead and 5 commit behind master? 分叉分支在主分支后面提交1次时更新 - Forked branch is updated while being 1 commit behind the master branch 将 Hotfix 分支合并到两者后,功能分支是 Master 后面的 1 个提交 - Feature branch is 1 commit behind Master after merging Hotfix branch to both Git 孤儿分支“此分支提前 1 次提交,在 master 后面提交 n 次” - Git Orphan branch “This branch is 1 commit ahead, n commits behind master” 我的dev分支是在请求请求后在master后面提交1次 - My dev branch is 1 commit behind master after pull request git 分支在 master 无限循环之前/之后提交 - git branch commit ahead of/behind master infinite loop Github通过x提交显示(开发)分支 - Github showing (develop) branch behind master by x commits 在GitHub上,“该分支前面是0提交,而后面是0的提交”是什么意思? - What does “This branch is 0 commits ahead and 0 commits behind master” mean on GitHub?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM