사용자 도구

사이트 도구


wiki:3party:scm:git

문서의 이전 판입니다!


Git

  • description : GIT 관련 내용 기술
  • author : 주레피
  • email : dhan@repia.com
  • lastupdate : 2020-05-19

GitHub
GitLab
GitBash

Git 온라인 강의

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 . (윈도우 탐색기가 열림)

Tip

Troubleshooting

Checkout conflict with files: 대상 파일
Checkout conflict with files: 대상 파일 (ProjectName/source/file...) Eclipse 에서 git pull 실행 시, The current branch is not configured for pull 에러 발생
Eclipse 에서 git pull 실행 시, The current branch is not configured for pull 에러 발생

Ref

/volume1/web/dokuwiki/data/attic/wiki/3party/scm/git.1630316810.txt.gz · 마지막으로 수정됨: 2022/03/10 19:52 (바깥 편집)