문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
wiki:3party:scm:git [2020/07/22 20:27] dhan |
wiki:3party:scm:git [2023/04/26 11:42] (현재) dhan |
||
---|---|---|---|
줄 8: | 줄 8: | ||
<WRAP clear/> | <WRAP clear/> | ||
- | [[wiki: | + | [[wiki: |
- | [[wiki: | + | [[wiki: |
+ | [[wiki: | ||
- | ===== Tip ===== | + | ===== VCS (Version Control System) |
+ | Centralized Version Control: CVS, Subversion, Perforce \\ | ||
+ | Distributed Version Control: git, mercurial, darcs \\ | ||
+ | Server : github, bitbucket \\ | ||
+ | |||
+ | ===== Git 온라인 강의 ===== | ||
+ | * Linux Torvalds 2005년 개발 | ||
+ | * 널리 이용되어지며, | ||
+ | * 깃, 깃허브 제대로 배우기 정리 (기본 마스트편, | ||
+ | * 드림코딩 by 엘리 ( https:// | ||
+ | <code text> | ||
+ | 1. git | ||
+ | git 명령어 OPTION | ||
+ | | ||
+ | 2. git client | ||
+ | Github Desktop - Github | ||
+ | Sourcetree - 아틀라시안 | ||
+ | GitKraken | ||
+ | Git bash - Terminal | ||
+ | |||
+ | 3. Download | ||
+ | https:// | ||
+ | |||
+ | 4. 설정 | ||
+ | .gitconfig (깃의 설정이 저장됨) | ||
+ | $> git config --list | ||
+ | $> git config --global -e // -e -> edit | ||
+ | $> git config --global core.editor "code --wait" | ||
+ | $> git config --global user.name " | ||
+ | $> git config --global user.email " | ||
+ | | ||
+ | $> git config user.name | ||
+ | Foo | ||
+ | $> git config user.email | ||
+ | Bar@repia.com | ||
+ | |||
+ | $> git config core.autocrlf true // windows | ||
+ | $> git config core.autocrlf input // macOS | ||
+ | | ||
+ | $> git status | ||
+ | $> git config --global alias.st status // status에 대한 alias 지정 | ||
+ | $> git st | ||
+ | $> git --h | ||
+ | | ||
+ | 5. 명령어 | ||
+ | $> cd projects | ||
+ | $> mkdir GitFolder | ||
+ | $> cd ${GitFoler} | ||
+ | $> git init // 1. 깃 초기화, .git 폴더 생성, master branch 생성, 삭제시 .git 폴더 삭제하면 됨 | ||
+ | $> git config -h // 도움말 | ||
+ | $> git status -h | ||
+ | $> git status -s // short | ||
+ | |||
+ | 6. git workflow | ||
+ | working directory | ||
+ | untracked (git이 모름) | ||
+ | -> git add * | ||
+ | -> git rm --cached * | ||
+ | |||
+ | tracked (git이 알고 있음) | ||
+ | unmodified | ||
+ | modified | ||
+ | | ||
+ | <- checkout | ||
+ | -> git add | ||
+ | |||
+ | stating area | ||
+ | | ||
+ | -> commit | ||
+ | | ||
+ | .git directgory | ||
+ | git history | ||
+ | | ||
+ | -> push | ||
+ | <- pull | ||
+ | | ||
+ | remote | ||
+ | | ||
+ | 7. ignore | ||
+ | tracking이 필요 없을 때 사용 | ||
+ | $> echo *.log > | ||
+ | |||
+ | 8. diff | ||
+ | $> git diff | ||
+ | diff --git a/c.txt b/c.txt | ||
+ | index a042389..f5be8ac 100644 | ||
+ | --- a/c.txt | ||
+ | --- b/c.txt | ||
+ | @@ -1 +1,2 @@ // - 이전 파일 의미, +1 최근 파일 | ||
+ | // stated, cached 비슷한 의미로 | ||
+ | hello world! | ||
+ | +add | ||
+ | (END) | ||
+ | |||
+ | $> git config --global -e | ||
+ | [diff] | ||
+ | tool = vscode | ||
+ | [difftool " | ||
+ | cmd = code --wait --diff $LOCAL $REMOTE // 추가 | ||
+ | $> git difftool // vscode에서 내용 확인 가능 | ||
+ | | ||
+ | 9. commit | ||
+ | $> git commit -m " | ||
+ | $> git commit -am " | ||
+ | |||
+ | commit message | ||
+ | commit 0, commit1, commit2, ... (X) | ||
+ | Initialise project, Add LoginService module, Add UserRepository module, Add Welcome page, Add About page, Add light theme, ... | ||
+ | | ||
+ | 과하게 커밋하지 말고, 메시지에 맞게 조절합시다. | ||
+ | 수정, 여러가지 하지 말고, 수정 첫번째, 수정 두번째.... 향후 코드별 리뷰나 수정이 쉬움 | ||
+ | | ||
+ | 10. log | ||
+ | $> git log | ||
+ | | ||
+ | | ||
+ | 11. source tree | ||
+ | Hunk 블럭 단위 | ||
+ | Line 라인 단위 | ||
+ | | ||
+ | x터미널 제안 | ||
+ | macOS: iTerm21 | ||
+ | Windows: cmder | ||
+ | |||
+ | PowerShell | ||
+ | $> code . (윈도우는 디폴트로 설정되어 있음) // | ||
+ | $> open . (macOS 에디터로 열기) | ||
+ | $> explorer . (윈도우 탐색기가 열림) | ||
+ | </ | ||
+ | |||
+ | ===== 자격 증명 ===== | ||
+ | * [[https:// | ||
+ | |||
+ | ===== Tip ===== | ||
+ | 원격 저장소 URL 변경하기 | ||
+ | gitbash에서 다음과 같이 진행하면 됨 | ||
+ | <code bash> | ||
+ | // 먼저 해당 git 저장소로 이동 | ||
+ | // 현재 설정 보기 | ||
+ | $> git remote -v | ||
+ | # View existing remotes | ||
+ | origin | ||
+ | origin | ||
+ | // 저장소 변경 | ||
+ | $> git remote set-url origin https:// | ||
+ | // 변경된 저장소 확인 | ||
+ | $> git remote -v | ||
+ | # View existing remotes | ||
+ | origin | ||
+ | origin | ||
+ | $> git remote -v | ||
+ | </ | ||
+ | \\ | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | \\ | ||
===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
+ | Checkout conflict with files: 대상 파일 \\ | ||
+ | [[https:// | ||
+ | Eclipse 에서 git pull 실행 시, The current branch is not configured for pull 에러 발생 \\ | ||
+ | [[http:// | ||
- | ===== Ref ===== | + | \\ |
+ | remote: HTTP Basic: Access denied 오류 처리 방법 | ||
+ | > 잘못된 계정이 저장된 경우 | ||
+ | git bash에서 차례대로 아래의 명령어를 실행한 수 pull 실행 | ||
+ | <code bash> | ||
+ | $> git config --local --unset credential.helper | ||
+ | $> git config --global --unset credential.helper | ||
+ | $> git config --system --unset credential.helper | ||
+ | // 계정 정보를 계속 물어볼 경우 | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | ===== Ref ===== | ||
+ | * [[https:// | ||
+ | * {{wiki: | ||
- | {{tag> | + | {{tag> |