如何摆脱GIT中的“繁华”

时间:2018-08-29 12:43:27

标签: git

我在代码上做错了什么,我搜索了一些命令以还原为以前的版本,但情况变得更糟。我不知道该怎么办才能解决此问题。好恐怖~~~

我尝试了许多命令,但不知道使用过什么 git恢复到正常工作状态。在此阶段,我的代码正在运行,但是如何返回主分支?

Now the terminal show: 

zswenjin:~/workspace/project_1 ((f9f01be...)|REVERTING) $ 


That is git log:
    commit f9f01bee8249770135e92dc6bc117c5033d3e349 (HEAD)
    Merge: 2a9bc0a 2bb5f7e
    Author: Louis
    Date:   Wed Aug 29 12:28:23 2018 +0000

        Merge branch 'master' into HEAD

    commit 2a9bc0a2110c1a35ab32504c16208305ee7ac895
    Author: Louis 
    Date:   Wed Aug 29 12:23:00 2018 +0000

        Revert "Revert "user now can edit and update their reviews""

        This reverts commit 37062450a252dcf2f22054e9b094ce97bb60ed6d.

    commit afd7b3a8f0fcbd89577bef1f473d0721138b0b3e
    Author: Louis
    Date:   Wed Aug 29 12:21:40 2018 +0000

        Revert "user now can edit and update their reviews"

        This reverts commit 5b7e703aafe1a5d745674eb2350cd4967a9d73a7.

    commit 2bb5f7ee26fff9ec2f8ec3653e87ae30a191e7e4 (github/master, master)
    Author: Louis 
    Date:   Wed Aug 29 11:46:20 2018 +0000

    just commit

    commit 466ce7f711bf38203be829424d960157638e8d4e
    Author: Louis
    Date:   Wed Aug 29 11:44:07 2018 +0000

    Revert "recover from disater"

    This reverts commit 1162459e513425da2ba22a82a7d787fb2cd8da79.



   commit 1162459e513425da2ba22a82a7d787fb2cd8da79
    Author: Louis
    Date:   Wed Aug 29 11:38:00 2018 +0000

        recover from disater

    commit 37062450a252dcf2f22054e9b094ce97bb60ed6d
    Author: Louis 
    Date:   Wed Aug 29 11:35:26 2018 +0000

        Revert "user now can edit and update their reviews"

        This reverts commit 5b7e703aafe1a5d745674eb2350cd4967a9d73a7.

git状态显示:

HEAD detached from 5b7e703
You are currently reverting commit 3706245.
  (fix conflicts and run "git revert --continue")
  (use "git revert --abort" to cancel the revert operation)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   app/Http/Controllers/ProductController.php
        modified:   database/test.sql
        modified:   resources/views/includes/manufacturer/manufacturerDetail.blade.php
        modified:   resources/views/includes/navBar/navBar.blade.php
        modified:   resources/views/includes/products/productDetail.blade.php
        modified:   resources/views/includes/products/updateProduct.blade.php
        new file:   resources/views/includes/reviews/editReview.blade.php
        modified:   resources/views/reviewDesc.blade.php

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

        both modified:   routes/web.php

2 个答案:

答案 0 :(得分:0)

git status告诉您,您有两种选择:

  

您当前正在还原提交3706245。     (修复冲突并运行“ git revert --continue”)     (使用“ git revert --abort”取消恢复操作)

您需要执行的操作取决于您要完成的操作。是否要取消还原,请执行git revert --abort。您是否要还原此提交,然后解决冲突并执行git revert --continue

答案 1 :(得分:0)

如果您只是想重新掌握:

您应该能够退出“正在还原”状态

git revert --abort

看来您将处于分离状态。您所提供的信息不会告诉我们您是如何进入该状态的,也无法告诉您是否处于分离状态(可能存储在无法到达的提交中)时进行了任何更改。如果是这样,您可能想要在继续​​之前创建一个分支或标记,以确保以后可以恢复这些更改。

此外,您可能想说

git status

查看是否有任何未提交的更改。

确定要重返大师级课程后,您应该可以

git checkout master

本地未提交的更改可能会对此造成干扰,在这种情况下,您必须决定是要提交,存储,丢弃它们还是将结帐推迟到完成上述操作之一之后。 / p>