[완료] git 에서 특정 branch check out 시..

hyunya77의 이미지

$ git clone git://gittest.com/grit.git mygrit
$ cd mygrit
$ git checkout -b rev.1

예를 들어 위와 같이 "git://gittest.com/grit.git" repository를 clone한 후,
"rev.1"이라는 branch를 check out했습니다.
그런데 이렇게 해도 실제 mygrit안의 local file들이 "rev.1"의 버전으로 바뀌지는 않는 것 같습니다.
(즉, 소스코드 하나하나가 특정 branch(rev.1)로 변경되지는 않았습니다)

git repository를 전부 clone으로 가져오면 그 시점 이전의 모든 소스 갱신정보도 같이 포함되는 것으로
알고있는데, 그렇다면 분명 소스 또한 특정버전으로 바꾸는 방법이 있을 것 같은데 잘 모르겠습니다.
혹시 아시는 분 계신가요?

bushi의 이미지

[bushi@rose linux-2.6]$ head -4 Makefile 
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 34
EXTRAVERSION = -rc1
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ git branch 2.6.33 --track v2.6.33
Branch 2.6.33 set up to track local ref refs/tags/v2.6.33.
[bushi@rose linux-2.6]$ git checkout 2.6.33
Switched to branch '2.6.33'
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ head -4 Makefile 
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 33
EXTRAVERSION =
[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ git remote add stable <a href="//git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.33.y.git
" rel="nofollow">git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.33.y.git
</a>[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ git fetch stable
remote: Counting objects: 1009, done.
remote: Compressing objects: 100% (128/128), done.
remote: Total 771 (delta 637), reused 770 (delta 637)
Receiving objects: 100% (771/771), 117.36 KiB | 75 KiB/s, done.
Resolving deltas: 100% (637/637), completed with 233 local objects.
From <a href="//git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.33.y
" rel="nofollow">git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.33.y
</a> * [new branch]      master     -> stable/master
 * [new tag]         v2.6.33.1  -> v2.6.33.1
[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ git branch 2.6.33.1 --track v2.6.33.1
Branch 2.6.33.1 set up to track local ref refs/tags/v2.6.33.1.
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ git checkout 2.6.33.1
Switched to branch '2.6.33.1'
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ head -4 Makefile 
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 33
EXTRAVERSION = .1
[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ git diff 2.6.33 Makefile
diff --git a/Makefile b/Makefile
index 1b24895..61c7163 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 33
-EXTRAVERSION =
+EXTRAVERSION = .1
 NAME = Man-Eating Seals of Antiquity
 
 # *DOCUMENTATION*
[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ git checkout master
Switched to branch 'master'
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ git diff 2.6.33 Makefile
diff --git a/Makefile b/Makefile
index 1b24895..08ff02d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 33
-EXTRAVERSION =
+SUBLEVEL = 34
+EXTRAVERSION = -rc1
 NAME = Man-Eating Seals of Antiquity
 
 # *DOCUMENTATION*
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ git diff 2.6.33.1 Makefile
diff --git a/Makefile b/Makefile
index 61c7163..08ff02d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 33
-EXTRAVERSION = .1
+SUBLEVEL = 34
+EXTRAVERSION = -rc1
 NAME = Man-Eating Seals of Antiquity
 
 # *DOCUMENTATION*
[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ git checkout 2.6.33
Switched to branch '2.6.33'
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ git checkout -b my2.6.33_stable
Switched to a new branch 'my2.6.33_stable'
[bushi@rose linux-2.6]$ 
[bushi@rose linux-2.6]$ git merge 2.6.33.1
...
 139 files changed, 1281 insertions(+), 1408 deletions(-)
...
[bushi@rose linux-2.6]$ git branch -a
  2.6.33
  2.6.33.1
  master
* my2.6.33_stable
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/stable/master
[bushi@rose linux-2.6]$
[bushi@rose linux-2.6]$ mkdir ../patches.33.1
[bushi@rose linux-2.6]$ git format-patch 2.6.33 -o ../patches.33.1/
../patches.33.1/0001-ahci-disable-FPDMA-auto-activate-optimization-on-NVI.patch
...
...
../patches.33.1/0123-x86-mm-Allow-highmem-user-page-tables-to-be-disabled.patch
../patches.33.1/0124-Linux-2.6.33.1.patch

OTL

pastime의 이미지

위의 bushi님께서 자세한 사용법과 예제를 보여주셨으니 참고하시면 되고
간단히 말씀드리면 checkout 시에 -b 옵션을 주면 새로운 브랜치를 만듭니다.
기존의 브랜치를 이용하려면 -b 옵션을 빼고 실행하세요..

hyunya77의 이미지

우선 적어주신 command list에서 모르는 부분만 우선 git manual을 간단히 읽어보았습니다.
git에 익숙치 않아서 아직 remote/fetch등의 개념은 좀 더 공부할 필요가 있을 듯 합니다만,
제가 모르는 부분을 딱 집어서 설명해주신 듯 합니다.
감사합니다. ^^