사용자 도구

사이트 도구


git

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
git [2020/09/16 12:17]
kwon37xi
git [2023/10/14 13:47] (현재)
kwon37xi
줄 3: 줄 3:
   * [[git:cheatsheet|Git Cheatsheet]]   * [[git:cheatsheet|Git Cheatsheet]]
   * [[git:credential|git credential]]   * [[git:credential|git credential]]
 +  * [[https://ohmygit.org|OhMyGit]] - 게임으로 Git 배우기
  
 ===== Ubuntu 최신 버전 install ===== ===== Ubuntu 최신 버전 install =====
줄 55: 줄 56:
 </code> </code>
  
 +===== diff & difftool =====
 +  * ''git diff'' 명령에서 실행하는 것이 ''[diff]의 external'' 항목, ''git difftool''에서 실행하는 것이 ''[diff]의 tool'' 항목이다.
 +  * ''diff''는 기본값 그대로 두고 ''difftool''을 바꾸자. ''diff''는 pager 를 끼고 실행되는데, GUI diff 를 사용할 경우 pager가 중간에 끼어든다. "pager = " 설정으로 페이저를 없앨 수 있지만, log 등을 볼 때 페이저가 없어서 문제가 된다.
 +  * ''-t <difftool/mergetool이름>'' : diff/mergetool을 여러개 지정하고 원하는 이름의 tool 호출
 +
 +<code sh>
 +git difftool -t meld
 +git mergetool -t kdiff3
 +</code>
 ===== Git Diff/Merge -> kdiff3 ===== ===== Git Diff/Merge -> kdiff3 =====
   * [[https://docs.kde.org/trunk5/en/extragear-utils/kdiff3/git.html|Using KDiff3 as a Git Diff and Merging Tool]]   * [[https://docs.kde.org/trunk5/en/extragear-utils/kdiff3/git.html|Using KDiff3 as a Git Diff and Merging Tool]]
 +  * 파일 삭제 diff시에 잘 작동 안함.
 +    * https://github.com/KDE/kdiff3/blob/master/ChangeLog :  Version 1.8.3 부터 해결됨.
 <code> <code>
 [diff] [diff]
         tool = kdiff3         tool = kdiff3
 [difftool "kdiff3"] [difftool "kdiff3"]
-        path = <path to kdiff3 binary in your system>+        path = /usr/bin/kdiff3
 [difftool] [difftool]
         prompt = false         prompt = false
줄 73: 줄 85:
         keepTemporaries = false         keepTemporaries = false
 [mergetool "kdiff3"] [mergetool "kdiff3"]
-        path = <path to kdiff3 binary in your system>+        path = /usr/bin/kdiff3
 </code> </code>
  
-===== Git Diff -> meld ===== +===== Git Difftool/Mergetool -> meld ===== 
-  * http://wiredforcode.com/blog/2011/06/04/git-with-meld-diff-viewer-on-ubuntu/ +  * http://wiredforcode.com/blog/2011/06/04/git-with-meld-diff-viewer-on-ubuntu/ ''diff''를 바꾸는 방식 
-  * ''git-diff-meld.sh''<code sh> +  * [[https://stackoverflow.com/a/34119867/1051402|Git difftool의 기본과 meld설정에 대한 자세한 설명]] 
-#!/bin/sh +  * [[http://blog.marcinchwedczuk.pl/use-meld-as-git-merge-diff-tool|How to use Meld as git merge and diff tool]] : ''meld''를 difftool과 mergetool로 사용하는 간결한 설정.
-meld "$2" "$5"/dev/null 2>&+
-</code> +
-  * add to ''~/.gitconfig''<code> +
-git config --global diff.external '/path/to/git-diff-meld.sh' +
-</code>+
  
-===== Git Mergetool -> meld ===== +<code> 
-  전역 설정 <code sh> +# ------------------ M E R G E ------------------------- 
-git config --global merge.tool meld+[merge] 
 +    tool meld 
 + 
 +[mergetool "meld"
 +    cmd = meld --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\" --label \"MERGE (REMOTE BASE MY)\" 
 +    trustExitCode false 
 + 
 +[mergetool] 
 +    # don't ask if we want to skip merge 
 +    prompt false 
 + 
 +    # don't create backup *.orig files 
 +    keepBackup = false 
 + 
 +------------------ D I F F ------------------------- 
 +[diff] 
 +    guitool = meld 
 + 
 +[difftool "meld"
 +    cmd = meld \"$LOCAL\" \"$REMOTE\" --label \"DIFF (ORIGINAL MY)\"
 </code> </code>
  
 ===== Git Diff -> vimdiff ===== ===== Git Diff -> vimdiff =====
 +  * [[vim:vimdiff|vimdiff]]
   * [[http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/|Git Diff with Vimdiff]]   * [[http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/|Git Diff with Vimdiff]]
   * ''~/.gitconfig''<code>   * ''~/.gitconfig''<code>
줄 105: 줄 132:
   * 설정의 external 무시하고 vim을 pager로<code sh>   * 설정의 external 무시하고 vim을 pager로<code sh>
 git diff --no-ext-diff -w | vim -R - git diff --no-ext-diff -w | vim -R -
 +</code>
 +  * 그냥 명령을 직접 주기<code sh>
 +git diff -y -t vimdiff
 +# -y 는 no prompt
 </code> </code>
 ===== .gitignore ===== ===== .gitignore =====
줄 130: 줄 161:
 </code> </code>
  
-===== Git hook ===== 
-  * 기본적으로는 ''projectdir/.git/hooks''에 후킹 파일을 둔다. 
-  * 2.9 부터는 ''projectdir/.githooks'' 에 후킹 스크립트를 넣는다. 
-  * 전역 Hook 파일 설정 (git 2.9+)<code sh> 
-git config --global core.hooksPath /path/to/my/centralized/hooks 
-</code> 
-  * [[https://git-scm.com/book/ko/v2/Git%EB%A7%9E%EC%B6%A4-Git-Hooks|Git Hooks]] 
  
 ===== Commit Template ===== ===== Commit Template =====
줄 229: 줄 253:
   * [[https://live.gnome.org/giggle|Giggle]] GTK+ Git 관리   * [[https://live.gnome.org/giggle|Giggle]] GTK+ Git 관리
   * [[https://live.gnome.org/Gitg|Gitg]] GTK+ 리포지토리 브라우저   * [[https://live.gnome.org/Gitg|Gitg]] GTK+ 리포지토리 브라우저
-  * [[http://jonas.nitro.dk/tig/|tig]] 콘솔 기반 리포지토리 브라우저+  * [[git:tig|tig]] 콘솔 기반 리포지토리 브라우저
   * [[https://github.com/FredrikNoren/ungit|ungit]] 웹기반 Git 인터페이스   * [[https://github.com/FredrikNoren/ungit|ungit]] 웹기반 Git 인터페이스
   * [[http://gitignore.io/|gitignore.io]] 자동으로 ''.gitignore'' 파일을 생성해준다.   * [[http://gitignore.io/|gitignore.io]] 자동으로 ''.gitignore'' 파일을 생성해준다.
줄 236: 줄 260:
   * [[http://yobi.io/|Yobi]] Git 지원 협업 프로젝트 관리 툴   * [[http://yobi.io/|Yobi]] Git 지원 협업 프로젝트 관리 툴
   * [[http://www.maketecheasier.com/6-useful-graphical-git-client-for-linux/|6 Useful Graphical Git Client for Linux]]   * [[http://www.maketecheasier.com/6-useful-graphical-git-client-for-linux/|6 Useful Graphical Git Client for Linux]]
 +  * [[https://gogs.io|gogs]] self hosted git server
  
 ===== 빈 디렉토리 (empty directory) 유지 ===== ===== 빈 디렉토리 (empty directory) 유지 =====
줄 252: 줄 277:
   * commit 한다.   * commit 한다.
  
 +===== shallow update not allowed =====
 +  * ''clone --depth=x'' 로 클론한 로컬 리포지토리에서 수정해서 push 하면 ''! [remote rejected] master -> master (shallow update not allowed)'' 오류가 발생한다.
 +  * [[https://stackoverflow.com/questions/28983842/remote-rejected-shallow-update-not-allowed-after-changing-git-remote-url|! [remote rejected] master -> master (shallow update not allowed)]]
 +
 +<code sh>
 +git fetch --unshallow origin
 +
 +# 이후에
 +git push
 +</code>
 +
 +
 +===== git blame ignore =====
 +  * [[https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame|Ignoring bulk change commits with git blame - Moxio]]
 +  * bulk 갱신, 포맷팅 변경 같은 경우 blame 에 자꾸 나오면 오히려 불편함. 특정 commit 을 blame에서 제외하기
 +  * [[https://akrabat.com/ignoring-revisions-with-git-blame/|Ignoring mass reformatting commits with git blame – Rob Allen's DevNotes]]
 +
 +===== submodules =====
 +  * git 에서 다른 리포지토리를 디렉토리로 링크할 수 있음.
 +  * https://git-scm.com/book/en/v2/Git-Tools-Submodules
 +  * submodule 이 있는 리포지토리를 올바로 clone 하려면 ''--recursive'' 옵션 필요
 +
 +<code sh>
 +git clone --recursive <repos-url>
 +</code>
  
 ===== 문제 해결 ===== ===== 문제 해결 =====
줄 282: 줄 332:
   * [[https://www.javacodegeeks.com/2019/10/git-essentials-crash-course.html|Git Essentials Crash Course | Java Code Geeks - 2019]]   * [[https://www.javacodegeeks.com/2019/10/git-essentials-crash-course.html|Git Essentials Crash Course | Java Code Geeks - 2019]]
   * [[https://github.com/mingrammer/git-tips|Git Tips]]   * [[https://github.com/mingrammer/git-tips|Git Tips]]
 +  * [[https://github.com/ingydotnet/git-subrepo|ingydotnet/git-subrepo]]
 +  * [[https://subicura.com/git/|Git / GitHub 안내서]]
git.1600226247.txt.gz · 마지막으로 수정됨: 2020/09/16 12:17 저자 kwon37xi