Git

Git 02. Git 명령어

shin96bc 2022. 6. 14. 13:05

(1) github 에 있는 소스파일을 로컬파일에 강제로 덮어쓰기

     1) 해당 폴더위치로 이동해서 아래의 명령어를 입력합니다.

git reset --hard HEAD
git pull

(2) 로컬파일을 github Repository 에 강제로 덮어쓰기

     1) 해당 폴더위치로 이동해서 아래의 명령어를 입력합니다.

     2) 주의: 이 명령어의 사용으로 인해 원격 저장소에 커밋들이 유실되는 현상이 발생할 수 있습니다.

git push --force
// 또는
git push -f

 

(3) pull 에서 충돌이 날때

git pull --rebase

 

(4) checkout

git checkout 브런치 이름

 

(5)  clone

git clone url입력

 

(6)  자동로그인 

git config --global credential.helper store

// 유저 정보 삭제
git config --unset user.name
git config --unset user.email
// 글로벌로 설정 했다면 --global 을 추가합니다
git config --unset --global user.name "이름"
git config --unset --global user.email "이메일"

// 다시 등록하기
git config --global user.name "이름"
git config --global user.email "이메일"