Git 명령어 모음

정재훈·2022년 5월 9일
0

github

목록 보기
1/1

git 초기 설정

git config --global user.name [깃허브 가입 시 이름]

git config --global user.email [깃허브 가입 시 이메일]

git clone

git clone http://github.com/[내 이름]/[저장소 명].git

origin 삭제

git remote remove origin

origin 설정

git remote add origin https://github.com/[계정]/[레포지토리]

git 상태 확인

git status

git add

특정 파일 add

git add [파일이름]

add all

현재 디렉토리
git add .

전체 디렉토리
git add -A

git add 취소

git reset HEAD [file]

git commit

git commit -m ["커밋 로그를 작성해주세요"]

git commit 취소

취소할 commit 번호
git log --oneline

commit을 취소하고 해당 파일들은 staged 상태로 워킹 디렉터리에 보존
git reset --soft [HEAD]

commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에 보존
git reset --mixed [HEAD]

사용주의
commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에서 삭제
$ git reset --hard [HEAD]

git push

git push origin main

branch 변경

git checkout [branch]

git branch 병합

git merge [branch]

원격 branch 가져오기

error 해결

pathspec 'main' did not match any file(s) known to git

git remote update
git fetch

error: The following untracked working tree files would be overwritten by checkout

git checkout -f main

profile
게임 개발 공부중!

0개의 댓글