반응형

Git 4

[Git] 실수로 git push한 내역 안전하게 되돌리기

안녕하세요.이번 시간에는 실수로 git push를 잘못하였을 경우,이를 안전하게 되돌리는 방법에 대하여 살펴보도록 하겠습니다. 상황 가정만일, 다음과 같이 main 브랜치에 git push를 실수로 했던 상황을 가정해보겠습니다.git reset --hard 1bd654f # 커밋 번호 가정git push origin main --force이럴 때에 "내가 작업한 커밋들이 전부 사라진 건 아닐까?" 하는 생각에 당황하기 쉽습니다.하지만 git은 로컬 기록을 잘 관리하고 있어 침착하게 복구할 수 있습니다. 복구 방법다음 명령어로 내역을 조회할 수 있습니다.git reflog 그러면 다음과 같이 내역이 시간 순으로 출력되는데, 잘못 push한 내역의 이전을 기준으로되돌리고 싶은 커밋 해시 번호를 찾아주시면..

Git 2025.07.13

[Git] 파이썬 프로젝트에 대하여 pre-commit 적용 방법 예시

안녕하세요. 이번 시간에는 코드 커밋 이전에 자동으로 포맷팅, 린팅, 문법 검사 등을 수행하면서일관된 코드 스타일을 유지하고, CI 파이프라인 전단계에서 실수를 잡아낼 수 있도록pre-commit 프레임워크를 적용하는 방법을 예시를 통해서 간단하게 살펴보도록 하겠습니다. 해당 글에서는 파이썬 프로젝트 레포를 기준으로 설명을 진행하겠습니다. 1. 설정 파일 작성 예시원하는 커밋 훅 종류를 골라 다음과 같이 레포 내 루트 디렉토리에 .pre-commit-config.yaml이름의 파일로 작성해줍니다.fail_fast: falserepos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: tr..

Git 2025.06.14

[Git] warning: adding embedded git repository 원인 및 해결법

개요git 사용 과정에서 다음과 같은 경고 메시지가 발생하였습니다.warning: adding embedded git repository: frontendhint: You've added another git repository inside your current repository.hint: Clones of the outer repository will not contain the contents ofhint: the embedded repository and will not know how to obtain it.hint: If you meant to add a submodule, use:hint:hint: git submodule add frontendhint:hint: If you adde..

Git 2024.10.22

[Git] fatal: couldn't find remote ref ~~ fatal: the remote end hung up unexpectedly 원인 / 해결 방법

개요 git pull 과정에서 다음과 같은 형태의 오류 메시지가 발생하며, pull 진행이 불가능 하였습니다. ########################### W A R N I N G ############################ This equipment is privately owned. All access to this equipment is logged. Disconnect IMMEDIATELY, if you are not an authorized user Violators will be prosecuted to the fullest extent of the law. #####################################################################..

Git 2024.02.19
반응형