git - basic

혜성·2022년 3월 10일
0

깃 기본 사용법

1. 원하는 디렉토리를 깃 저장소로 init

원하는 디렉토리 % git init 

2. Checking the status - 상태확인

git status 

3. Staging files - Staging area에 파일 추가하기

git add . //모든파일  
git add file //선택한 파일 

4. 커밋 남기기

git commit -m "Commit message"

5. github repogitory에 파일 올리기

git push "리모트 저장소명" "원하는 branch"
git push origin master

* 원하는 커밋 로그로 돌아가기

git log //commit history

git reset --soft (commit 주소) 이전 커밋을 삭제하지 않고 원하는 커밋으로 돌아간다.
git reset --hard (commit 주소) 해당 커밋으로 돌아가며 이전 커밋은 삭제된다.

* repogitory 연결하기

git remote add origin (repogitory URL)
//git remote add "설정하고싶은 이름" (repogitory URL)

0개의 댓글