22.05.03 / Today I Learned
Git Intro
Git 설치
Git Workflow
오늘의 나의 점수 95점 : 시작할 때 보다 훨씬 적극적으로 임한 것 같다. 확실히 필요성을 강력히 느낄 수 있어서 더욱 집중했던 것 같다.
해야할 일 : 오늘은 친구만나기, 내일은 부트캠프 열심히 참가하고, 코테(자료구조) 1시간 공부하기
git # 해당 명령어를 통해 설치되었는지 확인
git 환경설정
cat ~/.ssh/id_rsa.pub
git workflow
git 명령어 (혼자 작업시)
# 내 repository 복제해서 local 환경으로 가져오기
git clone https://github.com/leegwichan/forkTest.git
# 현재 directory를 git 관리에 들어가게 함(local Repository 사용)
# 또는 새로운 Repository를 초기화함
git init
# local Repository 내용을 Repository에 올림 (<> 제거)
git remote add origin <Repository 주소>
# 현재 파일 상태, stage에 올라간 파일 상태 확인
git status
# addtest.txt 파일 Stage에 올리기
git add addtest.txt
# 모든 변경사항 Stage에 올리기
git add .
# 아직 stage, commit 되지 않은 변경사항 삭제
git restore <파일명>
# Local에 변경사항 저장 ('' 안에 메세지 작성)
git commit -m 'commit test 1차'
# Local에 저장한 가장 최근 commit을 취소
git reset HEAD^
# Local Local Reposiory에서 main branch(온라인)에 push(변경사항 저장)
git push origin main
# 같은 Repository에서 fork한 다른 사람의 Repository와 연결 (<> 제거)
git remote add <등록할 이름> <Repository 주소>
# Local Repository와 연결된 모든 Remote Repository 확인
git remote -v
# 등록한 Remote Repository에서 내용을 가져옴
git pull <등록한 이름> <branch 이름>
# 충돌시에는 수정후 내 Remote Repository에 업로드 가능
git status # 이것을 통해 충돌한 파일 확인