public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Kernel Hackers Guide to git (v3)
@ 2005-06-25  5:13 Jeff Garzik
  2005-06-25  9:51 ` Toufeeq Hussain
  2005-06-25 18:40 ` Valdis.Kletnieks
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Garzik @ 2005-06-25  5:13 UTC (permalink / raw)
  To: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 96 bytes --]

See attached.

An HTML version is also available at http://linux.yyz.us/git-howto.html

	Jeff



[-- Attachment #2: git-howto.txt --]
[-- Type: text/plain, Size: 3721 bytes --]



Kernel Hackers' Guide to git


1) installing git

git requires bootstrapping, since you must have git installed in order
to check out git.git (git repo), and linux-2.6.git (kernel repo).  I
have put together a bootstrap tarball of a recent git repository.

Download tarball from:
http://www.kernel.org/pub/linux/kernel/people/jgarzik/git-20050622.tar.bz2

tarball build-deps:  zlib, libcurl, libcrypto (openssl)

install tarball:  unpack && make && sudo make prefix=/usr/local install

jgarzik helper scripts, not in official git distribution:
http://www.kernel.org/pub/linux/kernel/people/jgarzik/git-new-branch
http://www.kernel.org/pub/linux/kernel/people/jgarzik/git-changes-script

After reading the rest of this document, come back and update your copy
of git to the latest:
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/git.git


2) download a linux kernel tree for the very first time

$ git clone \
   rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git \
   linux-2.6
$ cd linux-2.6
$ rsync -a --delete --verbose --stats --progress \
   rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/ \
   .git/


NOTE:  The kernel tree is very large.  This constitutes downloading
several hundred megabytes of data.


3) update local kernel tree to latest 2.6.x upstream ("fast-forward merge")

$ cd linux-2.6
$ git-pull-script \
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git


4) check out files from the git repository into the working directory

$ git checkout -f


5) check in your own modifications (e.g. do some hacking, or apply a
patch)

# go to repo
$ cd linux-2.6

# make some modifications
$ vi drivers/net/sk98lin/skdim.c

# NOTE: add '--add' and/or '--remove' if files were added or removed
$ git-update-cache <list of all files changed>

# check in changes
$ git commit


6) List all changes in working dir, in diff format.

$ git diff


7) Obtain summary of all changes in working dir

$ git status


8) List all changesets (i.e. show each cset's description text) in local
branch of local tree, that are not present in remote tree.

$ cd my-kernel-tree-2.6
$ git-changes-script -L ../linux-2.6 | less


9) List all changesets:

$ git log


10) apply all patches in a Berkeley mbox-format file

First, download and add to your PATH Linus's git tools:
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/git-tools.git

$ cd my-kernel-tree-2.6
$ dotest /path/to/mbox  # yes, Linus has no taste in naming scripts


11) don't forget to download tags from time to time.

git-pull-script only downloads sha1-indexed object data, and the
requested remote head.  This misses updates to the .git/refs/tags/ and
.git/refs/heads directories.  It is advisable to update your kernel .git
directories periodically with a full rsync command, to make sure you got
everything:

$ cd linux-2.6
$ rsync -a --delete --verbose --stats --progress \
   rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/ \
   .git/


12) list all branches

$ ls .git/refs/heads/


13) make desired branch current in working directory

$ git checkout -f $branch


14) create a new branch, and make it current

$ cp .git/refs/heads/master .git/refs/heads/my-new-branch-name
$ git checkout -f my-new-branch-name


15) examine which branch is current

$ ls -l .git/HEAD


16) undo all local modifications (same as checkout):

$ git checkout -f


17) obtain a diff between current branch, and master branch

In most trees WITH BRANCHES, .git/refs/heads/master contains the current
'vanilla' upstream tree, for easy diffing and merging.  (in trees
without branches, 'master' simply contains your latest changes)

$ git diff master..HEAD


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel Hackers Guide to git (v3)
  2005-06-25  5:13 Kernel Hackers Guide to git (v3) Jeff Garzik
@ 2005-06-25  9:51 ` Toufeeq Hussain
  2005-06-25 18:40 ` Valdis.Kletnieks
  1 sibling, 0 replies; 4+ messages in thread
From: Toufeeq Hussain @ 2005-06-25  9:51 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linux Kernel


[-- Attachment #1.1: Type: text/plain, Size: 258 bytes --]

Jeff Garzik wrote:

> 2) download a linux kernel tree for the very first time
> 
> $ git clone \
>    rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git \
>    linux-2.6

Git "clone" command not found error with git-20050622.

-toufeeq

[-- Attachment #1.2: toufeeqh.vcf --]
[-- Type: text/x-vcard, Size: 177 bytes --]

begin:vcard
fn:Toufeeq Hussain
n:Hussain;Toufeeq
email;internet:toufeeqh@gmail.com
tel;home:091-044-24832063
tel;cell:091-9840196690
x-mozilla-html:FALSE
version:2.1
end:vcard


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel Hackers Guide to git (v3)
  2005-06-25  5:13 Kernel Hackers Guide to git (v3) Jeff Garzik
  2005-06-25  9:51 ` Toufeeq Hussain
@ 2005-06-25 18:40 ` Valdis.Kletnieks
  2005-06-26 20:58   ` Jeff Garzik
  1 sibling, 1 reply; 4+ messages in thread
From: Valdis.Kletnieks @ 2005-06-25 18:40 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

On Sat, 25 Jun 2005 01:13:46 EDT, Jeff Garzik said:

> Kernel Hackers' Guide to git
> 
> 
> 1) installing git

A nice document.  Unfortunately, my brain is tiny, and there's some
usage questions you don't cover, and I can't seem to figure out myself...

Let's say I've cloned Linus's git tree, and now I want to build a kernel
that has Linus's stuff, the 'audit' tree that's (last I checked) located at
kernel.org/pub/scm/linux/kernel/git/dwmw2/audit-2.6, and another tree (foobar-2.6).

1) How do I do this merge?

2) How do I handle if an audit-2.6 and foobar-2.6 patch conflict -
   a) for right now...
   b) so it gets it right the *next* time I pull both and there's a collision
      (possibly between the next foobar-2.6 changeset and my modification of
      the previous changeset's results to clean the conflict)

Another (possibly even more important to me at the moment) usage question:

I have a non-git 2.6.12-mm1 tree. Given a Linus git tree and an audit-2.6 git
tree, how do I create a tree that contains "2.6.12-mm1 plus additional
audit-2.6 changes since Andrew cut -mm1"?  (I'm chasing a bug that was
supposedly fixed in userspace audit-0.9.10, but is still borked for me in
0.9.13 - I'm suspecting the bugfix is dependent on a divergence between the
Fedora kernel (basically 2.6.12-git5 for this discussion) and -mm1...)


[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel Hackers Guide to git (v3)
  2005-06-25 18:40 ` Valdis.Kletnieks
@ 2005-06-26 20:58   ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2005-06-26 20:58 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Linux Kernel

Valdis.Kletnieks@vt.edu wrote:
> On Sat, 25 Jun 2005 01:13:46 EDT, Jeff Garzik said:
> 
> 
>>Kernel Hackers' Guide to git
>>
>>
>>1) installing git
> 
> 
> A nice document.  Unfortunately, my brain is tiny, and there's some
> usage questions you don't cover, and I can't seem to figure out myself...
> 
> Let's say I've cloned Linus's git tree, and now I want to build a kernel
> that has Linus's stuff, the 'audit' tree that's (last I checked) located at
> kernel.org/pub/scm/linux/kernel/git/dwmw2/audit-2.6, and another tree (foobar-2.6).
> 
> 1) How do I do this merge?
> 
> 2) How do I handle if an audit-2.6 and foobar-2.6 patch conflict -
>    a) for right now...
>    b) so it gets it right the *next* time I pull both and there's a collision
>       (possibly between the next foobar-2.6 changeset and my modification of
>       the previous changeset's results to clean the conflict)

Just 'git pull $url' all into the same repo.  If git cannot auto-merge 
the changes together, it will spit out a conflict for you to manually 
merge.  You merge just like CVS or BK:  correct the code between 
'<<<<<<' and '>>>>>>'.


> Another (possibly even more important to me at the moment) usage question:
> 
> I have a non-git 2.6.12-mm1 tree. Given a Linus git tree and an audit-2.6 git
> tree, how do I create a tree that contains "2.6.12-mm1 plus additional
> audit-2.6 changes since Andrew cut -mm1"?  (I'm chasing a bug that was
> supposedly fixed in userspace audit-0.9.10, but is still borked for me in
> 0.9.13 - I'm suspecting the bugfix is dependent on a divergence between the
> Fedora kernel (basically 2.6.12-git5 for this discussion) and -mm1...)

That's a bit tougher, since Andrew doesn't keep his stuff in git.

	Jeff




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-26 20:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-25  5:13 Kernel Hackers Guide to git (v3) Jeff Garzik
2005-06-25  9:51 ` Toufeeq Hussain
2005-06-25 18:40 ` Valdis.Kletnieks
2005-06-26 20:58   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox