사용자 도구

사이트 도구


git

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
git [2019/08/29 16:15]
kwon37xi
git [2020/11/13 22:47]
kwon37xi
줄 2: 줄 2:
   * http://git-scm.com/   * http://git-scm.com/
   * [[git:cheatsheet|Git Cheatsheet]]   * [[git:cheatsheet|Git Cheatsheet]]
 +  * [[git:credential|git credential]]
 +
 +===== Ubuntu 최신 버전 install =====
 +  * [[https://itsfoss.com/install-git-ubuntu/|How to Install the Latest Git Version on Ubuntu]]
 +  * [[https://launchpad.net/~git-core/+archive/ubuntu/ppa|git-core/ppa]]
 +<code sh>
 +sudo add-apt-repository ppa:git-core/ppa
 +sudo apt update
 +sudo apt install git
 +</code>
  
 ===== Client 설정 ===== ===== Client 설정 =====
줄 15: 줄 25:
 git config --global core.filemode false git config --global core.filemode false
  
-# Mac OS X 유니코드 문제 +# Mac OS X 유니코드 문제? 아직도 발생하나? 
-git config --global core.precomposeunicode true +git config --global core.precomposeunicode true 
  
 </code> </code>
줄 37: 줄 47:
   name = KwonNamSon   name = KwonNamSon
 </code> </code>
 +  * **includeIf 는 맨 마지막에 두는 것이 좋다.** 이 이후에 나오는 설정은 ''includeIf''에 있는 설정을 덮어쓴다.
 ===== Ubuntu Git 최신 버전 ===== ===== Ubuntu Git 최신 버전 =====
   * https://launchpad.net/~git-core/+archive/ubuntu/ppa<code sh>   * https://launchpad.net/~git-core/+archive/ubuntu/ppa<code sh>
줄 45: 줄 55:
 </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 호출
  
-===== Password Cache ===== +<code sh> 
-  * HTTP(S) 프로토콜의 경우 명령행에서는 비밀번호 저장해두기가 곤란하다. 그래서 캐시를 사용한다. +git difftool -t meld 
-  * [[http://dogfeet.github.io/articles/2013/git-password-caching.html|Git Password Caching]] +git mergetool -t kdiff3
-  * Linux에서는 다음 처리로 간편하게 캐시가 끝난다.<code sh> +
-# 기본 캐시 시간 15분 +
-git config --global credential.helper cache +
- +
-# 캐시 시간 지정 +
-git config --global credential.helper 'cache --timeout=7200'+
 </code> </code>
- +===== Git Diff/Merge -> kdiff3 ===== 
-===== Password with Gnome-Keyring  ===== +  * [[https://docs.kde.org/trunk5/en/extragear-utils/kdiff3/git.html|Using KDiff3 as a Git Diff and Merging Tool]] 
-  * [[http://blog.iqandreas.com/git/storing-https-authentication-in-ubuntu-and-arch-linux/|GIT: Storing HTTPS Authentication in Ubuntu (and Arch Linux) - The Programming Blog of Andreas Renberg (IQAndreas)]]<code sh> +  * 파일 삭제 diff시에 잘 작동 안함. 
-# on Ubuntu +    * https://github.com/KDE/kdiff3/blob/master/ChangeLog :  Version 1.8.3 부터 해결됨. 
-sudo apt-get install libgnome-keyring-dev +<code> 
-sudo make --directory=/usr/share/doc/git/contrib/credential/gnome-keyring +[diff] 
-git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring+        tool = kdiff3 
 +[difftool "kdiff3"
 +        path = /usr/bin/kdiff3 
 +[difftool] 
 +        prompt = false 
 +        keepBackup = false 
 +        trustExitCode = false 
 +[merge] 
 +        tool = kdiff3 
 +[mergetool] 
 +        prompt = false 
 +        keepBackup = false 
 +        keepTemporaries = false 
 +[mergetool "kdiff3"
 +        path = /usr/bin/kdiff3
 </code> </code>
  
-===== Windows ===== +===== Git Difftool/Mergetool -> meld ===== 
-  * [[https://github.com/Microsoft/Git-Credential-Manager-for-Windows|Git credential manager for windows]] +  * http://wiredforcode.com/blog/2011/06/04/git-with-meld-diff-viewer-on-ubuntu/ : ''diff''를 바꾸는 방식 
-  * Unicode 깨짐 문제가 발생함 [[https://stackoverflow.com/questions/41139067/git-log-output-encoding-issues-on-windows-10-command-prompt|git log output encoding issues on Windows 10 command prompt - Stack Overflow]]<code sh> +  * [[https://stackoverflow.com/a/34119867/1051402|Git difftool의 기본과 meld설정에 대한 자세한 설명]] 
-# cmd +  * [[http://blog.marcinchwedczuk.pl/use-meld-as-git-merge-diff-tool|How to use Meld as git merge and diff tool]] : ''meld''를 difftool과 mergetool로 사용하는 간결한 설정.
-set LC_ALL=C.UTF-8+
  
-powershell +<code> 
-$env:LC_ALL='C.UTF-8'+------------------ M E R G E ------------------------- 
 +[merge] 
 +    tool meld
  
-# 시스템 환경변수에 넣어둘 것 +[mergetool "meld"] 
-</code>+    cmd = meld --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\" --label \"MERGE (REMOTE BASE MY)\" 
 +    trustExitCode = false
  
-===== Git Diff -> meld ===== +[mergetool] 
-  http://wiredforcode.com/blog/2011/06/04/git-with-meld-diff-viewer-on-ubuntu/ +    # don't ask if we want to skip merge 
-  * ''git-diff-meld.sh''<code sh> +    prompt false 
-#!/bin/sh + 
-meld "$2" "$5" > /dev/null 2>&+    # don't create backup *.orig files 
-</code> +    keepBackup = false 
-  * add to ''~/.gitconfig''<code> + 
-git config --global diff.external '/path/to/git-diff-meld.sh' +# ------------------ D I F F ------------------------- 
-</code>+[diff] 
 +    guitool = meld
  
-===== Git Mergetool -> meld ===== +[difftool "meld"
-  * 전역 설정 <code sh> +    cmd = meld \"$LOCAL\" \"$REMOTE\" --label \"DIFF (ORIGINAL MY)\"
-git config --global merge.tool meld+
 </code> </code>
  
줄 190: 줄 214:
 export PS1="\[\033[01;32m\][\[\033[01;33m\]\u\[\033[01;36m\]@\[\033[01;31m\]\h\[\033[01;37m\]:\[\033[01;34m\]\w\[\033[01;32m\]\$(__git_ps1)]\[\033[01;35m\]\\$\[\033[00m\] " export PS1="\[\033[01;32m\][\[\033[01;33m\]\u\[\033[01;36m\]@\[\033[01;31m\]\h\[\033[01;37m\]:\[\033[01;34m\]\w\[\033[01;32m\]\$(__git_ps1)]\[\033[01;35m\]\\$\[\033[00m\] "
  
 +</code>
 +
 +===== bash auto completion =====
 +  * 대부분의 리눅스는 git 을 설치하면 이미 bash-completion 설정 파일을 함께 설치한다.<code sh>
 +source /etc/bash_completion.d/git
 +# or
 +source /usr/share/bash-completion/completions/git
 +</code>
 +  * [[https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion|Install Bash git completion · bobthecow/git-flow-completion Wiki]]
 +  * Arch/Manjaro <code>
 +sudo pacman -S git bash-completion
 +# shell 재실행
 </code> </code>
  
줄 240: 줄 276:
   * ''git ls-files %%--%%stage''로 다시 확인해보면 **100755**로 변경됨.   * ''git ls-files %%--%%stage''로 다시 확인해보면 **100755**로 변경됨.
   * 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>
  
  
줄 269: 줄 316:
   * [[https://johngrib.github.io/wiki/git-alias/|편리한 git alias 설정하기 - 기계인간 John Grib]]   * [[https://johngrib.github.io/wiki/git-alias/|편리한 git alias 설정하기 - 기계인간 John Grib]]
   * [[https://blog.ull.im/engineering/2019/03/10/logs-on-git.html|좋은 git commit 메시지를 위한 영어 사전]]   * [[https://blog.ull.im/engineering/2019/03/10/logs-on-git.html|좋은 git commit 메시지를 위한 영어 사전]]
 +  * [[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]]
git.txt · 마지막으로 수정됨: 2023/10/14 13:47 저자 kwon37xi