os: window 11
(How to delete a pushed commit on Windows OS )
git push를 했는데 저런.. 파일을 잘못 올려버렸다. 폴더 속 폴더를 올린 것이다.
이미 push된 commit 기록은 웹사이트에서 제거할 수 없다.
따라서 git을 설치하여 수정하도록 한다.
Git - Downloads
https://git-scm.com/downloads
Git - Downloads
Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. Latest source Release 2.47.0 Release Notes (2024-10-06) Download Source Code GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but ther
git-scm.com
조금 더 편의를 위해 github desktop도 설치하자.
https://desktop.github.com/download/
Download GitHub Desktop
Simple collaboration from your desktop
desktop.github.com
1. github desktop 설치 후 repository를 선택한다.
2. git을 설치했다면 Repository -> Open in Command Prompt를 클릭
3. git log로 돌아갈 commit hash를 알아낸다.
4. 'q' 로 나가고, 다음 명령어 실행
git reset --hard d255af26d114460c79c544dfe33b72df4e097489
5 git terminal에서 push!
git push origin main
issue
6. 4번 작업인 reset을 강제로 시키고, 강제로 push하면 바뀐다.
하지만, 팀원들과 충분히 상의 후 진행하자.(팀원이 이를 모르고 작업 시 기존 작업들과 충돌이 일어날 수 있다.)
**그리고 복사본을 필수로 만들고 하자!**
git push -f origin main
의도한 바 완료!
'CI&CD > Git' 카테고리의 다른 글
[Git] 내 코드 파일 배포 A to Z (0) | 2024.12.08 |
---|---|
[Git] github 최근 커밋 수정사항 반영: git commit --amend (0) | 2024.11.26 |
[Git] 원격 저장소와 로컬 저장소의 통일 (0) | 2024.09.26 |
[Git] git push 하지 않고 작업 사항을 공유하는 방법 (1) | 2024.08.18 |
[Git] git rebase - commit 기록을 정리하고 싶다! (0) | 2024.08.14 |