2023.11.17(금)
GitHub 계정 > Settings > Developer Settings > Personal access tokens > Tokens (classic)에서 Generate new token
으로 원하는 기한 및 권한으로 Token 생성
생성된 Token 값 확인 및 복사
git clone
또는 git push
명령 시, Password로 발급 받은 Token 입력
git push origin main
Username for 'https://github.com':
Password for 'https://user@github.com': '발급 받은 토큰'
GitHub에 project 올리기 (Local → GitHub)
git remote add
로 생성한 repository(원격 저장소) 연결 git add, commit
후 push
로 source code 올리기GitHub repository를 local로 받아오기 (GitHub → Local)
git clone <복사한 URL>
로 받아오기![]() | ![]() |
---|
👉 Git의 Branch = Commit 사이를 가볍게 이동할 수 있는 Pointer
git init
을 하면 master
branch를 만들고 처음 commit하면 이 master
branch가 생성된 commit을 pointingmaster
branch는 자동으로 가장 마지막 commit을 pointinggit branch <branch>
HEAD
라는 특수한 pointer를 이용해 확인 가능HEAD
는 지금 작업하는 local branch를 pointinggit branch -d <branch>
git branch -m <oldbranch> <newbranch>
git branch -c <oldbranch> <newbranch>
git branch
--merged
와 --no-merged
flag로 merged branch list와 no-merged branch list 확인 가능HEAD
가 pointing하고 있는 branch 확인 가능* master
testing
git log
git log --oneline --graph --all --decorate
--oneline
: log를 한 줄로 약식으로 보여줌--graph
: log를 graph 형태로 보여줌--all
: 모든 branch, all을 쓰지 않으면 현재 branch만 보여줌--decorate
: 각 branch가 어떻게 위치해 있는지 (어떤 commit을 point하는지)git checkout <branch>
HEAD
가 해당 branch를 pointing!git checkout -
-b
flag로 branch 생성과 checkout 동시에 : git checkout -b <branch>
git merge에 관해서는 다음 시간에!