好的,这次我真的搞砸了GIT:我在一个项目上离线工作了几天,今天我尝试将更改提交/推送到GitHub。不知怎的,有一些冲突,我试图用rebase解决。我最后在一个分支REBASE 1/2,我使用跳过选项和移动到REBASE 2/2,我再次跳过...好吧,你猜怎么着?我搞砸了很多,以至于我最终覆盖了我的本地项目,最新的提交被推送到GitHub,失去了11天的工作!
现在,既然我确定我在变革之前上演并提交了我的更改,我认为有办法恢复这场灾难;但是当我用git reflog检查时,这是第一行:
2e73363 HEAD @ {0}:rebase完成:返回refs / heads / master
问题是,这个提交号是从11天前开始的,而不是从今天开始的!
所以我的问题是: - 从今天起我的承诺在哪里? - 有没有办法恢复我今天所做的rebase,恢复我对项目的所有更改?
编辑:这是来自reflog的完整测试:
<!--This is the table*-->
<form id="fromTable" name="formTable">
<table width="100%" border="1" id="myTable">
<tr id="myTable">
<th width="7%" id="cell1" scope="col">Row.Num.</th>
<th width="33%" id="cell2" scope="col">Column1</th>
<th width="31%" id="cell3" scope="col">Column2</th>
<th width="7%" id="cell4" scope="col">Column3</th>
<th width="22%" id="cell5" scope="col">Total</th>
</tr>
</table>
</form>
<!--These are the buttons. The ones that I add and delete rows.-->
<p>
<input name="addRow" type="submit" class="addRowbtn" onClick="myAdd();" value="Add row" />
<input name="deleteRow" type="submit" class="addRowbtn" onClick="myDelete();" value="Delete Row" />
</p>
这是reflog master的输出:
$ git reflog
2e73363 HEAD@{0}: rebase finished: returning to refs/heads/master
2e73363 HEAD@{1}: rebase: checkout origin/master
2ff234f HEAD@{2}: commit: added .classpath to commit
8ddcf79 HEAD@{3}: commit: fixed few errrors
e5a6da9 HEAD@{4}: commit: adding hibernate to DAO classes
c6c10bf HEAD@{5}: commit: fixed problems with commit after detached head
0e527a6 HEAD@{6}: commit (merge): added Spring Security
f4ad11a HEAD@{7}: checkout: moving from tmp to master
a0a1597 HEAD@{8}: checkout: moving from master to tmp
f4ad11a HEAD@{9}: checkout: moving from new-branch to master
f4ad11a HEAD@{10}: checkout: moving from master to new-branch
f4ad11a HEAD@{11}: checkout: moving from master to master
f4ad11a HEAD@{12}: checkout: moving from 96e7903b784ae435c042abab33939327b081c138 to master
96e7903 HEAD@{13}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138
f4ad11a HEAD@{14}: checkout: moving from a0a1597361522b25f4c12463f1bfa2673721eb7b to master
a0a1597 HEAD@{15}: checkout: moving from master to a0a1597
f4ad11a HEAD@{16}: checkout: moving from a0a1597361522b25f4c12463f1bfa2673721eb7b to master
a0a1597 HEAD@{17}: commit: commit from detached head
c40dc30 HEAD@{18}: commit: added Spring Security to admin page
96e7903 HEAD@{19}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138
f4ad11a HEAD@{20}: revert: Revert "commicommitt"
96e7903 HEAD@{21}: checkout: moving from 96e7903b784ae435c042abab33939327b081c138 to master
96e7903 HEAD@{22}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138
96e7903 HEAD@{23}: commit: commicommitt
f9fc7a1 HEAD@{24}: merge refs/remotes/origin/master: Fast-forward
ff7fc6d HEAD@{25}: commit (initial): Initial commit
答案 0 :(得分:1)
您检查过thread.start_new_thread( deleteThread, (api, status.id, ) )
吗?它可能仍然指向rebase之前的分支头。
尽管如此from django.utils import timezone
class Meal(models.Model):
...
collection_from = models.DateTimeField(default=timezone.now)
...
或替换为您的分支,应该显示master已经提交的所有提交。
答案 1 :(得分:0)
好的我解决了它:使用git reflog master
,我在rebase之前找到了提交号码;然后,我使用git reset --hard
恢复了该提交。