git rebase失去了我的改变.我有一个详细的历史.任何知道出了什么问题



重大变化消失了。而且没有明显的原因。

首先,我制作了自己的分支my_branch formation_branch。

我进行了一些更改,并在本地承诺。

后来,我需要进行其他对feature_branch上的更改。我用rebase做到了。

然后,我使用force将my_branch推向服务器。

到目前为止很好。

然后,我进行了更多更改,将它们提交,从服务器上拉出feature_branch,重新重新(第二次(,然后我的更改消失了。我有重态日志和历史日志。这就是我刚刚didl

  Do some work.
$ git status
-> on my_branch with some changes.
$ git add .  // add new files and updated files.
$ git commit -m "message"
$ git status
-> on my_branch, nothing to commit
$ git push --force // send my changes to my_branch on the server.
$ git checkout feature_branch
$ git pull  // get latest changes from the server.
$ git checkout my_branch
$ git rebase feature_branch // this should merge my changes, not overwrite them!
-> bunch of merge messages and one conflict.
-> I fixed the one conflict.

现在至少我的一些重大变化已经消失了。rebase命令($ git rebase feature_branch"已将我的更改(并承诺(的文件覆盖了来自原始文件的文件。注意到它失去了我的工作。

如果我在bitbucket上查看my_branch,我在做rebase命令之前就向后推了,我会看到我的更改。但是由于rebase命令,他们在本地缺少。

可能出了什么问题?

注意:除我以外没有人修改了my_branch。

我想我现在有三个选择。

1) wipe my local git database, and try to restore from time machine.
2) try git merge --abort and hope.
3) try to get my_branch from the server again. I don't know how to do this, other than to delete my local git directory, and clone from scratch, then checkout the branch.

有什么建议?

这是有问题的篮板的日志:

 git rebase feature_branch
First, rewinding head to replay your work on top of it...
Applying: <some old commit message1>
Using index info to reconstruct a base tree...
M somefile1
M somefile2
M somefile3
.git/rebase-apply/patch:160: trailing whitespace.
    "xxx-keyspace-configs": [ 
.git/rebase-apply/patch:485: trailing whitespace.
        
.git/rebase-apply/patch:1258: new blank line at EOF.
+
.git/rebase-apply/patch:1299: new blank line at EOF.
+
.git/rebase-apply/patch:1341: new blank line at EOF.
+
warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging somefile1
Auto-merging somefile2
Auto-merging somefile3
Auto-merging somefile4
Applying: <some old commit message2>
Using index info to reconstruct a base tree...
M somefile1
M simefile2
M somefile3
M somefile4
Falling back to patching base and 3-way merge...
Auto-merging somefile4
CONFLICT (content): Merge conflict in somefile4
Auto-merging somefile3
Auto-merging somefile2
Auto-merging somefile1
error: Failed to merge in the changes.
Patch failed at 0002 xxx
The copy of the patch that failed is found in: .git/rebase-apply/patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

如果我在重生之前回到州,然后再进行一次,我将再次失去更改。

=== update ===

$ git reflog engage-swh
c051e4f4b (origin/my_branch, my_branch) my_branch@{0}: commit: <my last commit message>
b9275d1ae my_branch@{1}: commit: <my second from last commit message>
30a24608b my_branch@{2}: rebase finished: refs/heads/my_branch onto 732a052fd4e0a6c171b52acb84ddaf16d27956c1
11c60cd90 my_branch@{3}: commit: <my first commit message>
1b811e4b2 (feature-2019R07) my_branch@{4}: branch: Created from feature-2019R07

如果我在bitbucket中查看branch my_branch中的file6,请查看我在反弹后直接在本地拥有的东西,我添加的所有行都消失了。本地版本与我进行更改之前的版本相同。我所有的更改都在遥控器上。已被"覆盖"的文件不是合并的文件(即不在上面的输出中(

我只是尝试做

$ git merge --abort 

我试图恢复失业的尝试。

这将导致:

fatal: There is no merge to abort (MERGE_HEAD missing).

我想这给我带来了两个选项,可以从Time Machine恢复备份,或删除我的项目DIR,再次克隆项目,然后结帐my_branch。问题是,如何在不再次覆盖我的更改的情况下重新列出freation_branch?我认为我无法合并,因为我最初重新恢复了。

==== update 2 =====

我刚刚尝试:

$ git log --oneline --graph --decorate

Padawin建议

它显示了所有在feature_branch分支上工作的人以及所有分支机构的工作。没有任何错误或任何有线索的东西。这是前几行:

* a84d5dcbd (HEAD) my first commit message.
* 139d71db8 (origin/feature_branch, feature_branch) made xxx in_active
*   bedea7520 Merge branch 'feature_branch' of https://bitbucket.org/xxx/xxx-parent into feature_branch
|  
| *   b4c06d0c8 Merge branch 'feature_branch' of https://bitbucket.org/xxx/xxx-parent into feature_branch
| |  
| * | 7996ca962 Release Prep
* | | 76aaddfcf system config update
| |/  
|/|   

=== update ======

我累了,即使我的工作被"被覆盖",我也很疲倦。我修复了一个冲突的一个文件," $ git add"。要标记它固定,然后进行了" $ git rebase -continue"。

我现在遇到了更多错误:

$ git rebase --continue
Applying: <one of my commit messages>
Applying: refactored merger, added update
Using index info to reconstruct a base tree...
M somefile1
M somefile2
M somefile3
Falling back to patching base and 3-way merge...
Auto-merging somefile3
Auto-merging somefile2
Auto-merging somefile1
CONFLICT (content): Merge conflict in somefile1
error: Failed to merge in the changes.
Patch failed at 0003 refactored merger, added update
The copy of the patch that failed is found in: .git/rebase-apply/patch

几件事:

  • 为什么要回答git push --force合法。
  • 当您是唯一在分支上工作的人,请查看分支机构的回流:

    git reflog my_branch
    
  • 运行一些日志以找到您丢失的提交

  • 樱桃在他们所属的分支中挑选它们。

根据以下讨论,您发生了冲突,现在您正处于重生的中间。然后,您需要在git rebase试图应用的提交中进行任何要应用的脱离舞台更改,然后运行git rebase --continue进行rebase继续。

好的,在经历了很多痛苦之后,我想我知道问题所在。在使用了几次后,重生分阶段工作。在这些阶段,您会暂时"丢失"工作,直到在后期赶上。我不知道这发生了 - 我认为一切都丢失了。

相关内容

最新更新