- repository or repo: 저장소 (git 으로 버전 관리하는 directory)
- local repo: 작업자 PC 에 설정된 git 저장소
- remote repo: Github 등 외부 서버에 설정된 git 저장소
- commit: 특정 상태 기록 == 버전
- branch: 다른 작업공간
- merge: 특정 branch에서 작업한 내용을 또 다른 branch에 적용
- git init: local git 저장소 설정
- mkdir: create directory
- cd: go to specific directory
- touch: create empty file
- echo "text" >> file: file 에 text 추가
- git reset: 특정 commit 까지 이력 초기화
- git revert: 특정 commit 취소하는 새로운 commit 만들기
- git switch -c: crete branch and go to that branch
- 새 branch 만들 때 현재 branch 상태를 기준으로 만들기에 현재 branch 확인 필요
- git switch == gsw branch_name: change branch
- git merge: merge branch
- git push -u origin main == gp -u origin main
- git pull == gl
git switch main // gsw main, go to the main branch git merge penguin // gm penguin, penguin branch 의 내용을 main 에 merge
1) local repo 에서 작업 진행
2) create Github remote repository
3) git remote add origin github_repo_link
4) git branch -M main (메인 branch를 main 으로 설정, 이미 branch 가 main 이라면 생략)
5) git push -u origin main (gp -u origin main)
1) 원하는 local 위치로 이동
2) git clone github_repo_link
git pull # gl