본문 바로가기
Git

기본 - Git bash 사용법 - 시간 변경 및 commit 기록 되돌리기

by code2772 2024. 7. 1.

[ 목차 ]

    728x90
    반응형

     

    보안감사나 깃 기록을 관리 및 점검받는 경우 시간을 되돌려서 커밋을 하거나 커밋기록을 수정해야 하는 경우가 가끔있어 기록하게 되었다. 이클립스, 인텔리제이, vscode 에서도 가능하지만 오늘은 Git 에서 하는 방법에 대해서 정리해보겠다.

     

    Git 설치 주소

    https://git-scm.com/downloads

     

    Git - Downloads

    Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp

    git-scm.com

     

     

    Git 관리서버 시간 변경

     

    서버 날자 변경하는 방법

    date -s "2024-06-13 18:00:00"

     

    git 로그 확인

    $ git log

     

    branch 변경

    $ git checkout 변경 branch

     

    rebase : 3개의 커밋을 변경하는 방법

    $ git rebase -i HEAD~3

     

    최상단 commit, merge 날자 변경하는 방법

    $ GIT_COMMITER_DATE="2024-03-08T18:00:54" git commit --amend --no-edit --date "2024-03-08T18:00:54"

     

    원하는 커밋 상태로 돌아가는 방법

    $ git reflog

     

     

     

    $ git reset --hard d3db19a

     

    커밋 취소하기 - 변경사항 되도리기

    $ git revert <해시값>

     

    커밋 되돌리기

    $ git reset --hard HEAD~1

    이전 상태로 되돌리는 기능 -> 두 개의 커밋을 제거하고 싶으면 ~2

     

    깃 커밋 하는 방법

    $ git push origin wasgit --force

    반응형

    'Git' 카테고리의 다른 글

    [Git] 회사에서 GitLab 팀 프로젝트 관리  (0) 2024.07.04
    GitKraken  (0) 2022.12.22
    GitHub 홈페이지(바로가기) 등록  (0) 2022.11.17
    Github 기본 사용법  (0) 2022.11.02
    Git(버전관리, Cmder, 다운로드, 기본)  (0) 2022.11.02