Moonss
Moon's
Moonss
전체 방문자
오늘
어제
  • 분류 전체보기 (24)
    • 환경 설정 (2)
    • git 사용법 (2)
    • Pandas (1)
    • 알고리즘 (7)
    • Pytorch (4)
    • GCP 환경 설정 (1)
    • cs231n (0)
    • Error (1)
    • 데이터 분석 (1)
    • 작성 전 글 저장 (0)

블로그 메뉴

  • ABOUT
  • POST
  • GUEST BOOK

공지사항

인기 글

태그

  • git config global --unset
  • Blender
  • 3d
  • git
  • GPU
  • Linux
  • 환경설정
  • user.email
  • Python
  • IP
  • ifconfig
  • 가상환경
  • gcp
  • git config --unset
  • git init
  • Linux OS
  • github
  • 알고리즘
  • git config
  • user.name
  • BIG-O
  • error
  • git config --global

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Moonss

Moon's

Git-Github 사용법 2)git add,commit,push
git 사용법

Git-Github 사용법 2)git add,commit,push

2024. 3. 19. 12:55
git init
git add *.py # 해당 Directory에 있는 py파일을 전부 add 
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/[github 이름]/[github repo 이름]
git push origin main
  • git init : .git이라는 하위 디렉토리를 만든다. .git파일은 저장소에 필요한 뼈대 파일이 있다.
  • Git이 파일을 관리하게 하려면 저장소에 파일을 추가(git add)하고 커밋(git commit)해야한다.
  • git add은 staged에 올리고, commit은 Local repo에 올리는 명령어 
  • git remote : git의 Local repo와 Remote repository(github)에 연결하기 위해 실행한다. 
  • git push :  Local repo에서 Remote repo로 파일을 업로드 명령어 이다.

Directory 내에 Tracked(관리대상) , UnTracked(비 관리대상)으로 나뉜다.
Tracked : Unmodified, Modified , Staged

git add [파일명]을 하면 파일은 staged 상태로 들어간다. 

git status를 실행하면, Changes to be committed 에 들어 있는 Staged상태의 파일이라는 것을 확인 할 수 있다. 

git status 

git status -s # git status --short
# 위 명령어는 status를 간단하게 보여주는 옵션이다. 
# 새파일 앞에는 ?? , Staged상태로 추가한 파일은 A
# 수정한 파일 앞에는 M

예시) 

 

https://git-scm.com/book/ko/v2/Git%EC%9D%98-%EA%B8%B0%EC%B4%88-%EC%88%98%EC%A0%95%ED%95%98%EA%B3%A0-%EC%A0%80%EC%9E%A5%EC%86%8C%EC%97%90-%EC%A0%80%EC%9E%A5%ED%95%98%EA%B8%B0

저작자표시 (새창열림)

'git 사용법' 카테고리의 다른 글

Git-Github 사용법 - 1) 초기 세팅(git config) 및 수정  (0) 2023.01.23
    'git 사용법' 카테고리의 다른 글
    • Git-Github 사용법 - 1) 초기 세팅(git config) 및 수정
    Moonss
    Moonss

    티스토리툴바