Git 요약
2022. 10. 4. 15:32ㆍAI/프로그래머스 AI 코스
Git의 동작 흐름
Structure : Working Directory - Local Repository - Remote Repository
Upload : git add - git commit - git push
Remove : git reset - x - git pull
![]() |
![]() |
Push 하기
git init # working directory에서 init
git add file_name.py # working stage에 file 추가
git commit -m 'commit contents' # local repository에 file 추가
git push remote_name branch_name # remote repository에 commit 내용 push
git log # 현재까지 commit 된 history 확인
Branch 조작
master가 default branch이며, banch - v 로 현재 branch 확인
git branch branch_name # branch 만들기
git checkout branch_name # branch 전환
git merge branch_name # branch 합치기(master node 에서 다른 branch를 합칠것)
git branch -d branch_name # branch 삭제
Pull Request
Base branch <- Compare branch
기타
commit 을 하면 file이 unstage 상태가 된다
git remote add nickname url # remote를 nickname으로 추가
git remote -v # 추가된 remote list
git branch -M main # branch 이름을 main으로 변경
git clone url directory_name # 저장할 directory 설정
git clone https://user-name@github.com/... # private repo clone하기
A 브랜치에서 B 브랜치 만들고 push, pull request 하기
# A에서 B 브랜치 만들기
git checkout A # A로 전환
git branch B # B 생성
git checkout B # B로 전환
git add *
git commit -m 'B branch'
git push origin B # origin 이라는 remote에 B 브랜치에 push
'AI > 프로그래머스 AI 코스' 카테고리의 다른 글
Django (0) | 2022.10.24 |
---|---|
Flask (0) | 2022.10.13 |
MySQL (0) | 2022.09.28 |
Selenium (0) | 2022.09.28 |
BeautifulSoup4 (0) | 2022.09.27 |