programing tip

힘내- "손상된"대화식 rebase를 고치는 방법?

itbloger 2020. 7. 19. 10:41
반응형

힘내- "손상된"대화식 rebase를 고치는 방법?


로컬 git 저장소에 약간의 혼란을 만들었습니다. 다음 지침 을 사용하여 깨진 커밋을 수정하려고했습니다 . "git commit --amend"을 실행하기 전에 (git rebase --interactive 후) 변경 사항이 잘못되었다고 판단하여 "git reset HEAD --hard"를 실행했습니다. 좋은 생각은 아닙니다.

이제 대화식 리베이스가 "고착"된 것 같습니다. 힘내 현재 분기를 (| REBASE-m)으로 표시합니다. 내 저장소 내의 모든 명령 (cd .., ls, git rebase ...)에는 다음 오류가 발생합니다.

cat : .git / rebase-merge / head-name : 해당 파일 또는 디렉토리가 없습니다.

git rebase --abort의 모습은 다음과 같습니다.

$ git rebase --abort
cat: c:/_work/project/src/git/.git/rebase-merge/quiet: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/head-name: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/orig-head: No such file or directory
HEAD is now at 4c737fb Revert "Modified file names"
rm: cannot remove `c:/_work/project/src/git/.git/rebase-merge/done': Permission denied
rm: cannot remove directory `c:/_work/project/src/git/.git/rebase-merge': Directory
not empty
cat: .git/rebase-merge/head-name: No such file or directory

git rebase --continue의 결과는 다음과 같습니다.

$ git rebase --continue
cat: c:/_work/project/src/git/.git/rebase-merge/prev_head: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/end: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/msgnum: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/onto: No such file or directory
cat: c:/_work/project/src/git/.git/rebase-merge/quiet: No such file or directory
prev_head must be defined
cat: .git/rebase-merge/head-name: No such file or directory

어떤 아이디어? 잘 생각한 리베이스 작업을 시작하기 전의 상태로 상황을 다시 설정하고 싶습니다.

git log --oneline이 상황을 보여주는 방법은 다음과 같습니다.

4c737fb Revert "Modified file names"
247ac02 Modified file names
33141e6 Message modifications
10a4a04 Modified db script

그리고 이것은 괜찮습니다.

msysgit v1.7.0.2를 사용하고 있습니다.


Git이 .git/rebase-merge디렉토리 를 제거하려고했지만 완전히 제거 할 수없는 것 같습니다 . 해당 폴더를 복사 해 보셨습니까? .git/rebase-apply폴더가 있으면 복사하십시오 .


zombie vim.exe 프로세스로 인해 비슷한 문제가 발생했습니다. 작업 관리자에서 종료 한 다음 git rebase --abort수정했습니다.


나는 이것에 갇혀있다. 헤드 이름 파일을 만든 다음 파일을 찾을 수 없다는 다른 오류가 발생하여 해당 파일을 만들었습니다. 그런 다음 '.git / rebase-apply / onto'를 읽을 수 없다는 또 다른 오류가 발생했습니다. 해당 파일이나 디렉토리가 없습니다.

그래서 rebasing 에 대한 자식 문서보고 라는 또 다른 명령을 찾았습니다 git rebase --quit. 이로 인해 변경 사항이없는 지점으로 다시 돌아 왔으며 새 기지처럼 다시 기지를 시작할 수있었습니다.


귀하의 답변에 감사합니다 @Laura Slocum

rebasing하면서 물건을 엉망으로하고 분리 된 HEAD를 얻었습니다.

 error: could not read orig-head

리베이스를 끝내지 못했습니다.

분리 된 HEAD에 정확한 내 rebase 원하는 상태가 정확하게 포함 된 것 같습니다.

rebase --quit

그 후 나는 분리 된 헤드에 바인딩하기 위해 새로운 임시 분기를 체크 아웃했습니다.

리베이스하려는 지점과 비교하여 새 임시 지점이 내가 원하는 상태에 있음을 알 수 있습니다. 감사


이클립스에서도 같은 문제가있었습니다. 이클립스에서 리베이스 => 중단 할 수 없습니다.

Git Bash에서 git rebase --abort 실행 나를 위해 일했습니다.


Windows에서 컴퓨터를 다시 시작하지 않거나 다시 시작할 수없는 경우 아래를 참조하십시오.

프로세스 탐색기 설치 : https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

프로세스 탐색기에서 찾기> 파일 핸들 또는 DLL ...

오류에 언급 된 파일 이름을 입력하십시오 (내 오류의 경우 'git-rebase-todo'이지만 위의 질문에서는 'done'입니다).

프로세스 탐색기는 파일을 잠그는 프로세스를 강조 표시합니다 (나에게 'grep'였습니다).

프로세스를 종료하면 표준 방식으로 git 작업을 중단 할 수 있습니다.


Create a file with this name:

touch .git/rebase-merge/head-name

and than use git rebase


In my case eighter git rebase --abort and git rebase --continue was throwing:

error: could not read '.git/rebase-apply/head-name': No such file or directory

I managed to fix this issue by manually removing: .git\rebase-apply directory.


In my case it was because I had opened SmartGit's Log in the respective Git project and Total Commander in the respective project directory. When I closed both I was able to rebase without any problem.

The more I think about it, the more I suspect Total Commander, i.e. Windows having a lock on opened directory the git rebase was trying to something with.

Friendly advice: When you try to fix something, always do one change at a time. ;)


I'm using git version 2.19.2.windows.1.

the only thing that worked for me was to remove the .git/rebase-apply/ directory and do a git reset --hard.


I have tried all the above steps mentioned but nothing worked for me. Finally, restarting the computer worked for this issue :D


With SublimeText 3 on Windows, the problem is fixed by just closing the Sublime windows used for interactive commit edition.


Once you have satisfactorily completed rebasing X number of commits , the last command must be git rebase --continue . That completes the process and exits out of the rebase mode .


I had the same problem. I used process explorer as suggested in other post (i am not able to find that post) and figured out which process has a lock on the file and kill it. then execute the --continue or --abort as per needs


In my case after testing all this options and still having issues i tried sudo git rebase --abort and it did the whole thing


tried everything else but a reboot, what worked for me is rm -fr .git/REBASE_HEAD


I am using git in eclipse and I was having the same problem.

Eventually I found that the "Rebase ..." menu entry was temporarily transformed into a sub-menu.

Team-> Rebase -> Abort

It worked for me.

참고URL : https://stackoverflow.com/questions/3685001/git-how-to-fix-corrupted-interactive-rebase

반응형