Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 퀵소트
- Chunk
- log_bin
- current_date
- 정규표현식
- MySQL
- mysql 5.5
- REACT
- npm
- JavaScript
- Spring Batch
- migration
- REACTJS
- Effective Java 3/e
- eslint
- regex
- update
- Express
- git
- nodejs
- spring cloud
- Webpack
- Node
- Effective Java
- upgrade
- Regular expression
- expire_logs_days
- spring
- log4j2
- java
Archives
- Today
- Total
내 세상
[Git] 멍청한 Push를 되돌려보자 본문
728x90
반응형
1. 우선 commit을 초기화 한다. 아래는 가장 최근의 commit을 취소하고 working directory로 돌리는 것.
git reset HEAD^
Windows에서는 More? 라는 문구가 뜨면서 작동하지 않고, 엔터를 갈기면 아래와 같은 에러가 뜬다.
fatal: ambiguous argument 'HEAD ': unknown revision or path not in the working tree. Use '--' to separate paths from revisions
해결 방법으로는 이렇게 2가지가 있다. 둘중에 하나로 하면 된다.
git reset HEAD~1
git reset "HEAD^"
그렇다면 원하는 commit 시점으로 돌리려면 어떻게 해야할까?
위의 사진에서 commit 옆에 있는 96ac9ac3e7~~ 값을 복사해서 아래와 같이 사용하면 된다
git reset 96ac9ac3e7~~
2. working directory를 돌린 상태에서 commit 한다.
git commit -m "help me"
3. 원격 저장소로 강제(-f option) push 한다.
git push -f origin [branch name]
728x90
반응형
'Technical > etc' 카테고리의 다른 글
[Windows] RDP/원격 데스크탑 여러 모니터 중 일부만 실행 (2) | 2020.12.29 |
---|---|
[JavaScript] Uncaught TypeError: $(...) is not a function (0) | 2020.09.24 |
[Git] 특정 Branch만 Clone하기, git clone 저장 폴더 변경 (0) | 2020.09.04 |
[express] fetch를 사용하여 formdata를 넘길 때, files을 전달하는 방법(React/Express/Multer) (0) | 2020.07.01 |
SSH RSA 공유키 충돌 문제 해결 (0) | 2019.02.13 |