-

[github] 파일 업로드, 수정, 삭제

beaksul 2022. 10. 8. 14:20

초기 업로드

 

1. git 파일 생성 (초기화)

git init

 

2. 업로드 할 파일 선택

git add 파일명

폴더내 전체 파일 업로드

git add .

 

3. 커밋(주석)

git commit -m "주석 내용"

 

4. 원격 저장소 설정

git remote add origin 주소

 

5. 업로드

git push origin master

 

강제로 푸쉬

git push origin +master

 

 

수정 및 추가 업로드

 

1. 버전 상태 확인

수정사항이 있다면 "modified: index.html" 라고 뜸

git status

 

2. 업로드 할 파일 선택

git add 파일명

폴더내 전체 파일 업로드

git add .

 

3. 커밋(주석)

git commit -m "주석 내용"

 

4. 업로드

git push origin master

 

 

삭제

 

1. 로컬 디렉토리와 git 저장소 모두 삭제

git rm 파일명
git commit -m "주석 내용"

 

2. git 저장소에서만 삭제

git rm --cached 파일명
git commit -m "주석 내용"

 

3. 업로드

git push origin master