2016-08-21 7 views
2

좋아, 이번에는 GIT가 정말 엉망이었습니다. 저는 프로젝트에서 며칠간 오프라인으로 작업했으며, 오늘 GitHub에 변경 사항을 적용/적용하려고했습니다. 어쨌든, 갈등이 있었는데, 나는 rebase로 풀려고했습니다. 내가 지부 REBASE 1/2에서 끝내고 건너 뛰기 옵션과 이동자를 REBASE 2/2에 사용했는데, 다시 건너 뛴다. 나는 GitHub에 밀린 최신 커밋으로 내 로컬 프로젝트를 덮어 쓰면서 11 일을 잃어 버렸습니다.GIT 리베이스가 모든 변경 사항을 덮어 씁니다.

이제 리베이스 전에 변경 사항을 수행하고 커밋 했으므로이 재앙을 복구 할 수있는 방법이 있다고 생각했습니다. 내가 자식 reflog 확인 때,이 상단 라인 :

2e73363 HEAD의 @ {0} : 리베이스 완료 : 심판/헤드/마스터로 복귀하는 것은 문제가

,이 번호를 11 일간 커밋 전에, 오늘부터!

제 질문은 : - 오늘 내 커밋은 어디에 있습니까? - 프로젝트에 대한 모든 변경 사항을 복원 한 리베이스를 되돌릴 방법이 있습니까?

편집 :이 reflog에서 전체 테스트입니다 :

$ git reflog 
2e73363 [email protected]{0}: rebase finished: returning to refs/heads/master 
2e73363 [email protected]{1}: rebase: checkout origin/master 
2ff234f [email protected]{2}: commit: added .classpath to commit 
8ddcf79 [email protected]{3}: commit: fixed few errrors 
e5a6da9 [email protected]{4}: commit: adding hibernate to DAO classes 
c6c10bf [email protected]{5}: commit: fixed problems with commit after detached head 
0e527a6 [email protected]{6}: commit (merge): added Spring Security 
f4ad11a [email protected]{7}: checkout: moving from tmp to master 
a0a1597 [email protected]{8}: checkout: moving from master to tmp 
f4ad11a [email protected]{9}: checkout: moving from new-branch to master 
f4ad11a [email protected]{10}: checkout: moving from master to new-branch 
f4ad11a [email protected]{11}: checkout: moving from master to master 
f4ad11a [email protected]{12}: checkout: moving from 96e7903b784ae435c042abab33939327b081c138 to master 
96e7903 [email protected]{13}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138 
f4ad11a [email protected]{14}: checkout: moving from a0a1597361522b25f4c12463f1bfa2673721eb7b to master 
a0a1597 [email protected]{15}: checkout: moving from master to a0a1597 
f4ad11a [email protected]{16}: checkout: moving from a0a1597361522b25f4c12463f1bfa2673721eb7b to master 
a0a1597 [email protected]{17}: commit: commit from detached head 
c40dc30 [email protected]{18}: commit: added Spring Security to admin page 
96e7903 [email protected]{19}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138 
f4ad11a [email protected]{20}: revert: Revert "commicommitt" 
96e7903 [email protected]{21}: checkout: moving from 96e7903b784ae435c042abab33939327b081c138 to master 
96e7903 [email protected]{22}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138 
96e7903 [email protected]{23}: commit: commicommitt 
f9fc7a1 [email protected]{24}: merge refs/remotes/origin/master: Fast-forward 
ff7fc6d [email protected]{25}: commit (initial): Initial commit 

는 이것은 reflog 마스터의 출력입니다 :

$ git reflog master 
2e73363 [email protected]{0}: rebase finished: refs/heads/master onto 2e7336369502768f42174019bf1efbfc9b113d9f 
2ff234f [email protected]{1}: commit: added .classpath to commit 
8ddcf79 [email protected]{2}: commit: fixed few errrors 
e5a6da9 [email protected]{3}: commit: adding hibernate to DAO classes 
c6c10bf [email protected]{4}: commit: fixed problems with commit after detached head 
0e527a6 [email protected]{5}: commit (merge): added Spring Security 
f4ad11a [email protected]{6}: revert: Revert "commicommitt" 
96e7903 [email protected]{7}: commit: commicommitt 
f9fc7a1 [email protected]{8}: merge refs/remotes/origin/master: Fast-forward 
ff7fc6d [email protected]{9}: commit (initial): Initial commit 
+1

저는 "rebase finished : refs/heads/master로 돌아가는 것"이 ​​과거에서 왔다고 생각하지 않습니다. 내 말은 rebase가 성공했다는 것을 의미합니다. HEAD @ {1} 및 HEAD @ {2}에 무엇을 가지고 있습니까 ?? –

+0

방금 ​​'rebase - skip'이라는 어려운 방법을 발견했습니다. 병합 충돌을 해결하는 대신 커밋을 제거 하시겠습니까? –

+0

@ Adegbuyi Ademola 이것은 다음과 같습니다. 2e73363 HEAD @ {1} : rebase : 체크 아웃 원점/마스터 2ff234f HEAD @ {2} : 커밋 : 커밋 할 .classpath 추가 –

답변

1

당신이 ORIG_HEAD을 확인 했습니까? 아마도 rebase하기 전에 브랜치 헤드를 가리킬 것입니다.

그래도 git reflog master이거나 지점으로 교체하면 마스터가 수행 한 모든 커밋이 표시되어야합니다.

0

좋아, 해결 : git reflog master을 사용하여 rebase 전에 커밋 번호를 찾았습니다. 그런 다음 나는 git reset --hard으로 커밋으로 되돌아갔습니다.

관련 문제