[git] 깃 기초

Bik_Kyun·2022년 3월 10일
0
post-thumbnail

1. 깃 저장소 초기화 설정

{디렉토리명} % git init

2. 깃 상태 확인

git status

3. Staging files

git add . #모든 파일  
git add file #선택 파일

4. 커밋

git commit -m "커밋 내용 메시지"

5. 깃 로그

git log

6. repogitory 연결하기(연결O, 동기화X)

git remote add {이름} ({repogitory URL})

5. github repogitory에 업로드

git push "{리모트 명}" "{해당 branch}"
git push origin master

6. 깃 리셋

  • 원하는 버전의 커밋 로그로 돌아가는 것.
git reset --soft ({커밋 로그 주소값})
# 원하는 커밋의 이전 커밋을 삭제하지 않고 원하는 커밋으로 돌아간다.
git reset --hard ({커밋 로그 주소값})
# 원하는 커밋으로 돌아가며 이전 커밋은 삭제된다.

7. 치팅 페이지

1. git init
2. .gitignore 작성
3. git add .
4. git commit -m "커밋 내용"
5. 깃허브 repository 생성
6. git branch -M main
7. git remote add origin {repository 주소}
8. git push origin main
9. git branch {branch 이름} / git branch -D {branch 이름}
10. git checkout {branch 이름}
11. git push origin {branch 이름}
12. 깃허브 pull request
profile
비진

0개의 댓글