Search Results for 'git'


3 POSTS

  1. 2009/03/27 GIT branch 사용
  2. 2009/02/24 Vim with git plugin (git-vim)
  3. 2009/02/18 git pull & patch 간략 정리

GIT branch 사용

Posted 2009/03/27 10:13 by kdsoo
Git 의 기본 branch(?)는 master 이다

master 에 새로운 브랜치를 만들어서 작업하려면

git branch kdsoo_branch

와 같이 브랜치를 생성하고 

git checkout kdsoo_branch

하면 해당 브랜치로 전환된다.

작업한 내용을 다시 master 로 머지하려면

git checkout master
git merge kdsoo_branch
와 같이 하면 된다.

만약 conflict 가 나면 차근차근 수정하고 다시 머지하자.

머지가 완료된 브랜치를 삭제할땐

git branch -d kdsoo_branch

머지 안하고 그냥 지우고 싶을땐

git branch -D kdsoo_branch
즐 GIT 하시라능


저작자 표시 비영리 동일 조건 변경 허락
크리에이티브 커먼즈 라이선스
Creative Commons License

'[3] My specialty' 카테고리의 다른 글

Alcoholic Tux  (2) 2009/04/09
Linux collaboration summit 2009  (0) 2009/04/09
GIT branch 사용  (0) 2009/03/27
Linux kernel 2.6.29 TUX to TUZ devil  (0) 2009/03/24
Color temperature in kelvin for White Balance  (0) 2009/03/18
Not to miss email sent to me on mailing list  (0) 2009/03/08

Tag : branch, git

Vim with git plugin (git-vim)

Posted 2009/02/24 19:42 by kdsoo

vi(vim)로 git repository 에서 작업하다 보면 터미널을 하나 더 띄우거나 쉘을 vim 에서 fork 해서 띄워서 git 을 확인해야 할 경우가 많다.

 

간편하게 vim plugin 으로 이 작업들을 해결 가능하다.

 

Git plugin

Plugin : http://github.com/motemen/git-vim/tree/master

 

위의 repository 에서 받을수 있다.

주의할 점은 vim 7.1 이상만 지원하는 듯 하다.

 

Git plugin 설치

plugin 디렉토리와 syntax 디렉토리가 있고 각각의 디렉토리 안에 .vim 플러그인들이 있다.

본인의 계정에

 

    1. .vim/ 디렉토리가 없으면 만들고
    2. 그 안에 plugin 과 syntax 디렉토리를 없으면 만들고
    3. plugin, syntax 디렉토리에 앞서 받은 git-vim plugin 들을 카피해 넣는다.

 

kdsoo@chromatix:~$ pwd
/home/kdsoo
kdsoo@chromatix:~$ ls -al .vim
total 64
drwxr-xr-x  6 kdsoo kdsoo       4096 2009-02-24 19:05 .
drwxr-xr-x 73 kdsoo kdsoo       4096 2009-02-24 19:38 ..
drwxr-xr-x  2 kdsoo kdsoo       4096 2008-10-17 09:32 colors
drwxr-xr-x  2 kdsoo kdsoo       4096 2009-02-24 19:06 doc
drwxr-xr-x  2 kdsoo kdsoo       4096 2009-02-24 19:30 plugin
drwxr-xr-x  2 kdsoo kdsoo       4096 2009-02-24 19:18 syntax

 

git-vim 의 사용

기본 키맵은 다음과 같이 매핑 되어있다.

 

== Keymaps
[<Leader>gd] :GitDiff
[<Leader>gD] :GitDiff --cached
[<Leader>gs] :GitStatus
[<Leader>gl] :GitLog
[<Leader>ga] :GitAdd
[<Leader>gA] :GitAdd <cfile>
[<Leader>gc] :GitCommit

 

=== In git-status buffer
[<Enter>]    :GitAdd <cfile>

 

쉽게 설명하면 vim 의 command mode, 즉 esc 를 한번 누른 상태에서

 

\gs

 

라고 입력하면 GitStatus 명령을 친것과 같이 동작한다.

 

즐거운 vi & git 생활 되시길.

크리에이티브 커먼즈 라이선스
Creative Commons License

Tag : git, git-vim, Linux, vim

git pull & patch 간략 정리

Posted 2009/02/18 19:10 by kdsoo

1. modified 파일이 있나 확인.

kdsoo@chromatix:/home/share/GIT/OMAP3430/linux-2.6.29-rc3-omap$ git status

# On branch master

# Changed but not updated:

#   (use "git add <file>..." to update what will be committed)

#

#   modified:   arch/arm/mach-omap2/board-xxx.c

#   modified:   arch/arm/mach-omap2/mux.c

#   modified:   arch/arm/plat-omap/include/mach/mux.h

#   modified:   drivers/media/video/xxxx.h

#

# Untracked files:

#   (use "git add <file>..." to include in what will be committed)

#

#   090202

#   work.patch

#   work.patch2

no changes added to commit (use "git add" and/or "git commit -a")

 

modified 파일이 있으면 pull 이 안될수 있습니다.

 

2. modified 파일이 있으면 patch 뜬다.

kdsoo@chromatix:/home/share/GIT/OMAP3430/linux-2.6.29-rc3-omap$ git diff > work.patch

 

패치가 work.patch 파일로 저장됩니다.

 

3. local git repository를 리셋

가장 마지막으로 pull 해왔던 상태로 리셋합니다.

 kdsoo@chromatix:/home/share/GIT/OMAP3430/linux-2.6.29-rc3-omap$ git reset --hard

 

이때 주의할것은 git status 에서 untracked file 이 있으면 리셋할때 파일이 지워집니다.

untracked file 이 없도록 commit 해놓고 reset 하세요.

 

4. git pull

kdsoo@chromatix:/home/share/GIT/OMAP3430/linux-2.6.29-rc3-omap$ git pull

 

하시면 깨끗하게 최신으로 패치 됩니다.

 

5. 본인이 수정한 파일을 패치로 적용

  • 우선 패치해도 에러가 안나는지 테스트 합니다.
    • patch -p1 --dry-run < work.patch
  • patch fail 이 되지 않으면 패치 해도 됩니다.
    • patch -p1 <work.patch
  • patch fail 이 하나라도 나면 fail 난 파일의 diff 내용만 따로 파일로 보관하고 work.patch 에서 삭제합니다.
  • fail 난 파일의 diff 를 수작업으로 붙여넣어 줍니다.

 

6. 정리하면

  1. git diff > work.patch
  2. git reset --hard
  3. git pull
  4. patch -p1 --dry-run < work.patch
    1. 성공시 : patch -p1 <work.patch
    2. fail 시 : fail 되는 파일의 diff 만 따로 파일로 저장해두고 work.patch 에서 해당 파일 패치는 삭제후 다시 patch
크리에이티브 커먼즈 라이선스
Creative Commons License

Tag : git, git pull, kernel, Linux, Patch