我有一个问题,其中最接近我的问题已经被提出,但无法添加评论。
git:您的分支和'origin/master'已经分歧-如何放弃本地提交?
我运行了上面问题的提示和答案,但没有解决。我正在使用软件源树跟进进度图表。我关闭软件并在bash git中运行命令。但是同样的错误被引用。
# Your branch and 'origin/master' have diverged,
# and have 7 and 11 different commits each, respectively.
# (use "git pull" to merge the remote branch into yours)
我也遇到了同样的问题。按照运行2个comentos的步骤,但没有起作用。我认为我的问题是,在我为单独的头部检出并做了提交之前,我回到了树分支/主分支,然后提交了我所做的提交,我相信这引用了个别树头。总之,我无法撤消此提交,我在SourceTree软件上以图形方式显示。
编辑-添加信息: 我想扔掉未发布的提交并进行服务器检出。但我在互联网上找到的解决方法都不起作用。我还尝试在gitBash中使用git reverse,但控制台显示我要做deveo的消息。
$ Git status
On branch processos_criminais_151029
Your branch and 'origin / processos_criminais_151029' have diverged,
and 7 and 11 have different commits each, respectivamente.
(use "git pull" to merge the remote branch into yours)
Changes not staged for commit:
(use "git add <file> ..." to update what will be committed)
(use "git checkout - <file> ..." to discard changes in working directory)
我尝试了这两个解决方案,但都没有起作用。如果我试图推送会出现大量文件冲突的问题,我尝试使用自动合并来解决这些问题,但是当我运行新的git status时,它指出同样数量的文件存在冲突。
git reset --hard origin/master
后,git status
的输出是否保持不变? - poke