6월, 2021의 게시물 표시

Local 과 Remote 저장소 연결 및 작업

cd c:\workdspace  [로컬과 원격저장소 연결] git remote add 별칭 https://github.com/inet815/study.git git remote -v    연결확인 ===========로컬에서 작업======== git push origin --all   로컬 작업의 모든 브랜치를 push ==========리모트와 로컬의 같은 파일을 로컬에서 변경 git push origin master   로컬 작업을 리모트에 푸쉬 하면 충돌 발생 git fetch    리모트의 커밋정보를 가져옮 git merge origin/master    로컬의 마스터와 리모트의 msater를 통합 git diff vim 수정 git commit -a -m "confict resolved GitHub" fetch와 merge를 한번에 하는 Pull 명령어

Remote 저장소를 Local 저장소로 복제

 cd c:\workspace [원격저장소를 로컬로 복제해서 작업] git clone https://gihub.com/inet815/study.git cd study git status

Local Git 사용법

PC에 git 설치 http://git-scm.com git bash 실행 git config --global user.name "이름" git config --global user.email "이메일" c:\ mkdir workspace cd workspace git init   로컬 저장소 초기화    vim hello.py git status   깃 상태 git add hello.py   깃에서 파일 추적하도록 추가 git status   깃 상태 git commit   수정사항 커밋 git branch   브랜치 조회 git branch hotfix   hofix 브랜치 생성 git checkput (-b) hotfix    브랜치 이동   git commit -a    저장소 파일 모두 커밋 git checkout master git merge hotfix    마스터에 hotfix를 병합 touch .gitignore    http://www.gitignore.io/ 에서 OS 별로 생성되는 내용을 복사해서 붙혀넣기 git add .gitignore git commit -m ''added '.gitignore' file"    깃에서 추적이 불필요한 파일/폴더 무시 git checkout master git merge hotfix git commit -a -m "conflict resolved"    충동 발생시 vim으로 수정후 다시 커밋 git log --graph git log --stat