사용자 도구

사이트 도구


wiki:3party:scm:git

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
wiki:3party:scm:git [2020/08/11 09:54]
dhan
wiki:3party:scm:git [2023/04/26 11:42] (현재)
dhan
줄 8: 줄 8:
 <WRAP clear/> <WRAP clear/>
  
-[[wiki:3party:scm:git:github|GibHub]] \\ +[[wiki:3party:scm:git:github|GitHub]] \\ 
-[[wiki:3party:scm:git:gitlab|GibLab]] \\ +[[wiki:3party:scm:git:gitlab|GitLab]] \\ 
-[[wiki:3party:scm:git:gitbash|Gib Bash]] \\ +[[wiki:3party:scm:git:gitbash|GitBash]] \\
-===== 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://www.youtube.com/watch?v=Z9dvM7qgN9s , https://www.youtube.com/watch?v=lPrxhA4PLoA )
 +<code text>
 +1. git 
 +   git 명령어 OPTION
 +   https://git-scm.com/docs
 +
 +2. git client
 +  Github Desktop - Github
 +  Sourcetree - 아틀라시안
 +  GitKraken
 +  Git bash - Terminal
 +
 +3. Download
 +  https://git-scm.com/download/
 +
 +4. 설정
 +  .gitconfig (깃의 설정이 저장됨)
 +  $> git config --list
 +  $> git config --global -e // -e -> edit
 +  $> git config --global core.editor "code --wait" // git 기본 editor 지정 , --wait -> foreground
 +  $> git config --global user.name "Foo" 
 +  $> git config --global user.email "Bar@repia.com"
 +  
 +  $> 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 >.gitignoroe
 +
 +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 "vscode"]
 +  cmd = code --wait --diff $LOCAL $REMOTE // 추가
 +  $> git difftool // vscode에서 내용 확인 가능
 +  
 +9. commit
 +  $> git commit -m "...." // -m -> message
 +  $> git commit -am "...." // -a -> all, add
 +
 +  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 . (윈도우 탐색기가 열림)
 +</code>
 +
 +===== 자격 증명 =====
 +  * [[https://yunseul-light.blogspot.com/2017/08/github-windows-git.html|[Github] Windows 환경에서 Git 자격 증명 변경 (자격 증명 변경)]]
 +
 +===== Tip =====
 +원격 저장소 URL 변경하기
 +gitbash에서 다음과 같이 진행하면 됨
 +<code bash>
 +// 먼저 해당 git 저장소로 이동
 +// 현재 설정 보기
 +$> git remote -v
 +# View existing remotes
 +origin  https://github.com/user/sample.git (fetch)
 +origin  https://github.com/user/sample.git (push)
 +// 저장소 변경
 +$> git remote set-url origin https://github.com/user/new.git
 +// 변경된 저장소 확인
 +$> git remote -v
 +# View existing remotes
 +origin  https://github.com/user/new.git (fetch)
 +origin  https://github.com/user/new.git (push)
 +$> git remote -v
 +</code>
 +\\
 +[[https://23life.tistory.com/124|원격지 Git Repository 초기화하기]] \\
 +[[https://codingdog.tistory.com/entry/git-remote-get-url-%EC%9B%90%EA%B2%A9-url%EC%9D%84-%EC%96%BB%EC%96%B4%EC%98%A8%EB%8B%A4|git remote get-url : 원격 url을 얻어온다.]] \\
 +\\
 ===== Troubleshooting ===== ===== Troubleshooting =====
 Checkout conflict with files: 대상 파일 \\ Checkout conflict with files: 대상 파일 \\
 [[https://iamfreeman.tistory.com/entry/Checkout-conflict-with-files-%EB%8C%80%EC%83%81-%ED%8C%8C%EC%9D%BC-ProjectNamesourcefile|Checkout conflict with files: 대상 파일 (ProjectName/source/file...)]] [[https://iamfreeman.tistory.com/entry/Checkout-conflict-with-files-%EB%8C%80%EC%83%81-%ED%8C%8C%EC%9D%BC-ProjectNamesourcefile|Checkout conflict with files: 대상 파일 (ProjectName/source/file...)]]
 +Eclipse 에서 git pull 실행 시, The current branch is not configured for pull 에러 발생 \\ 
 +[[http://javakorean.com/eclipse-%EC%97%90%EC%84%9C-git-pull-%EC%8B%A4%ED%96%89-%EC%8B%9C-the-current-branch-is-not-configured-for-pull-%EC%97%90%EB%9F%AC-%EB%B0%9C%EC%83%9D/|Eclipse 에서 git pull 실행 시, The current branch is not configured for pull 에러 발생]] \\
  
 +\\
 +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 =====+// 계정 정보를 계속 물어볼 경우
  
 +</code>
 +
 +
 +\\
 +
 +
 +===== Ref =====
 +  * [[https://minsone.github.io/git/github-managing-remotes-changing-a-remotes-url|원격 저장소 URL 변경하기]]
 +  * {{wiki:3party:scm:git:211013wed-git-workflow-on-sts.pdf | Git-workflow pdf}}
  
-{{tag>주레피 git}}+{{tag>주레피 git heon}}
/volume1/web/dokuwiki/data/attic/wiki/3party/scm/git.1597107292.txt.gz · 마지막으로 수정됨: 2022/03/10 19:52 (바깥 편집)