기본 콘텐츠로 건너뛰기

Git 깃 커밋한 날짜와 시간 변경 방법

 Git 깃 커밋한 날짜와 시간 변경


직전 커밋은 git log로 검색해서

Date:   Thu May 14 09:55:56 2020 +0900

부분 복사하고

git commit --amend --no-edit --date "Thu May 14 13:15:56 2020 +0900"

시간 수정해서 커밋하면 끝~

혹시 현재 날짜로 변경하고 싶다면

git commit --amend --no-edit --date "$(date)"

이렇게 사용하면 된다


문제는 그 이전의 커밋을 수정할 때는

git log를 통해서 commit의 고유값을 복사 후 리베이스를 실행함

git rebase -i 37ef02220d4f49e7e638ca4b3aee604e2ff9c9e9
cs

커밋 수정을 치면

git commit --amend
cs

이런식으로 나오는데 수정을 원하는 커밋한 내용앞의 pick를 edit으로 바꿔주고 저장 후 종료

pick 9a54fd4 commit의 설명 추가
pick 0d4a808 pull 설명을 추가
 
# Rebase 326fc9f..0d4a808 onto d286baa
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
cs

그리고 다시 커밋 수정을 치면 내용이 원하는 커밋으로 선택되어진걸 확인할 수 있음

git commit --amend
cs

이제 시간을 변경하고

git commit --amend --no-edit --date "Thu May 14 13:15:56 2020 +0900"
cs

다시 복구 시키는 명령어로

git rebase --continue
cs

하면 변경이 완료 됨



출처 : https://backlog.com/git-tutorial/kr/stepup/stepup7_6.html





댓글

이 블로그의 인기 게시물

네이버페이 리뷰 API 연동

네이버 페이 리뷰 API 네이버 측에 문의 하면 sandbox용 인증키를 받습니다. AccessLicense, SecretKey 그리고 받은 파일의 4. WSDL을 열어 주시고 Naver_Pay_API_MallService41_WSDL(sandbox)_20140925파일 압축 풀어주세요 그럼 파일이 BaseType.xsd, CheckoutAPI.wsdl, MallServiceMessage.xsd 세개의 파일이 나옵니다. 네이버페이 리뷰 리스트 가져오는 메소드는 getPurchaseReviewList입니다. BaseType.xsd를 켜신 후 MallID로 검색하면 <xs:complexType name="purchaseReview"> 안쪽의 MallID밑에  <xs:element minOccurs="0" name="PurchaseReviewClassType" type="xs:string"/> 추가해주세요 포토 리뷰를 가져오는 파라미터 값을 보내기 위해서 입니다. <xs:element minOccurs="0" name="Content" type="xs:string"/> 이값도 필요합니다 이미지 경로를 가져오기 위해서 입니다. <xs:complexType name="purchaseReview">     <xs:sequence>       <xs:element minOccurs="0" name="CreateYmdt" type="xs:dateTime"/>       <xs:element minOccurs="0" name="MallID" type="xs:string"/>   <xs:element minOccurs="0" nam...

mac 맥 맥북 Brew 완전 삭제

맥북에서 Brew 초기화 Brew를 써서 h2를 쓰려고 하는데 brew install h2가 안되서 이리 저리 알아보다가 완전 삭제 후 다시 설치 하니까 되서 그 방법을 남겨놈 1. 터미널에 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" 입력후 y랑 뭐 비번.. 2. /usr/local 폴더에서 Homebrew 폴더 삭제 rm -rf Homebrew/ 권한설정으로 잘.....삭제하고 3. 다시 설치 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 좀 오래걸리니까 기다려야한다는걸 배움... 출처.... https://discourse.brew.sh/t/error-no-formulae-found-in-taps/8331/9

OCI에 서버 세팅하기

    1. 서버 기본 준비      OCI A1 인스턴스를 만들고 Ubuntu 같은 OS를 설치합니다. A1은 ARM 기반이므로, 사용하는      Docker 이미지와 의존성이 linux/arm64를 지원하는지 먼저 확인해야 해요. 특히 일부 오래된      DB 이미지나 네이티브 모듈은 주의가 필요합니다.   2. 네트워크와 보안 설정      OCI 보안 목록/NSG와 서버 방화벽에서 최소한 80, 443, 22 포트를 정리합니다.       - 80: HTTP 및 인증서 발급       - 443: HTTPS       - 22: SSH 관리용 — 가능하면 내 IP만 허용      앱 컨테이너의 포트(예: 3000, 8080, DB 포트)는 인터넷에 직접 열지 않는 게 핵심입니다.   3. Docker 운영 기반 구성      서버에 Docker와 Docker Compose 플러그인을 설치하고, 프로젝트별 디렉터리를 분리합니다.      예를 들면:      /srv/apps/        promeditor/        other-project/        proxy/      각 프로젝트는 자기 compose.yml, 환경변수 파일, DB 볼륨을 독립적으로 가지게 합니다.   4. 공용 Nginx 리버스 프록시 구성      Nginx는 한 개만 앞단에서 실행하고, 도메인/서브도메인에 따라 내부 컨테이너로 프록시합니      다...