github의practice레포지토리 소스 코드 복제 및 다운로드하는 명령어
$ git clone https://github.com/jbro321/practice.git
변경된 파일을
stage상태로 만드는 명령어
practice.py를 stage한다.$ git add practice.py
Q.
Stage란?
A. 수정 및 생성한 파일을 깃허브에 올리기 전 단계라고 보시면 됩니다. 이 파일들을 올릴거다하는확인단계입니다.
practice repository의 변경사항이 있는 파일을 모두 stage 상태로 만드는 명령어입니다. (add 뒤에 띄어쓰기해야됩니다. 주의해주세요.)$ git add .
stage한 파일들 전부를 unstage하는 명령어입니다.$ git reset HEAD --
stage한 practice.py 파일을 unstage하는 명령어입니다.$ git reset HEAD practice.py
Stage한 파일을github에 올리기 직전 단계로push되기 전 단계
1st commit이라는 메세지로 commit합니다. `git commit -m "1st commit"
커밋된 이력들을 github에 올리는 명령어
github에 연결된 main이라는 branch로 commit된 변경사항들을 업로드$ git push origin main
test branch에 push$ git push --set-upstream origin test
github에서 변경된 내용들을 가져오는 명령어
github의 변경 내용을 현재 내 directory로 가져오고(fetch) 병합(merge)합니다.$ git pull
git remote를 통해서 기존 폴더를github에 연결하는 방법
$ git init
git 파일을 stage합니다$ git add .
stage한 파일을 1st commit 이라는 메세지로 commit$ git commit -m "1st commit"
$ git remote add origin [github_url.git]
$ git push -u origin main
github에 branch 현황을 보여줍니다.$ git branch
github에 new_branch이라는 이름으로 branch를 만듭니다.$ git branch "new_branch"
new_branch로 이동합니다.$ git checkout new_branch
main에서 test branch로 복사$ git push origin main:test
감사합니다.