'''git''' is a distributed revision control system with an emphasis on being fast. It was initially designed and developed by Linus Torvalds for Linux kernel development. The purpose of this lab is to get hands on experience with git to learn how it works and how to use it.

+

'''[[git]]''' is a distributed revision control system with an emphasis on being fast. It was initially designed and developed by Linus Torvalds for Linux kernel development. The purpose of this lab is to get hands on experience with git to learn how it works and how to use it.

Much of the material here has come from [http://progit.org/book/ Pro Git]. We'll be using [https://github.com/ github] to practice '''git'''ting.

Much of the material here has come from [http://progit.org/book/ Pro Git]. We'll be using [https://github.com/ github] to practice '''git'''ting.

−

== Set Up Git ==

+

== 0. Set Up Git ==

−

Go to [http://help.github.com/set-up-git-redirect github] and following the directions for installing and setting up git. No need to set up your own repository right now (unless you want to), I already have one set up for you the play with.

+

Go to [http://help.github.com/set-up-git-redirect github] and follow the directions for installing and setting up git. No need to set up your own repository right now (unless you want to), I already have one set up for you the play with.

I suggest you do this for both your host computer and your Beagle. On the Beagle use

I suggest you do this for both your host computer and your Beagle. On the Beagle use

−

<pre>

+

−

opkg install git

+

beagle$ '''opkg update'''

−

</pre>

+

beagle$ '''opkg install git'''

+

beagle$ '''opkg install openssh-keygen'''

+

+

The last opkg installs <code>ssh-keygen</code> which is needed to work with github.

+

+

On the host

+

+

host$ '''sudo apt-get install git-core'''

+

+

On my host computer I had to also run

+

+

host$ '''ssh-add id_rsa'''

+

+

after running <code>ssh-keygen</code> to get <code>ssh -T git@github.com</code> to work.

== 1. Play with git locally ==

== 1. Play with git locally ==

Line 44:

Line 58:

</pre>

</pre>

−

There is lots of good material here. I suggest you work through it all. In section 2.1 is shows how to clone a remote repository. Try using my repository.

+

There is lots of good material here. I suggest you work through it all. Section 2.1 shows how to clone a remote repository.

−

<pre>

+

−

git clone git@github.com:MarkAYoder/gitLearn.git

+

−

</pre>

+

'''gitk''' looks like a nice tool. Be sure to take a look at it.

'''gitk''' looks like a nice tool. Be sure to take a look at it.

=== Questions you should be able to answer after doing chapter 2 ===

=== Questions you should be able to answer after doing chapter 2 ===

−

* How do you stage a file?

+

# How do you stage a file?

−

* How do you view stated and unstaged changes?

+

# How do you view staged and unstaged changes?

−

* How do you view comment history?

+

# How do you view comment history?

−

* You've just committed something and realize you meant to have committed one more file. How do you add that file to the commit you just did?

+

# You've just committed something and realize you meant to have committed one more file. How do you add that file to the commit you just did?

−

* How do you unstage a file?

+

# How do you unstage a file?

−

* How do you unmodify a file?

+

# How do you unmodify a file?

−

* After running the <code>remove -v</code> how do you tell is a site is read only or read/write?

+

# After running the <code>remote -v</code> how do you tell if a site is read only or read/write?

−

* What's the difference between a lightweight and an annotated tag?

+

# What's the difference between a lightweight and an annotated tag?

−

== Download my gitLearn repository ==

+

== 3. Git Branching ==

−

== Nice git article ==

+

Chapter 3 is on branching. Here's the topics from the book:

+

<pre>

+

3.1 - What a Branch Is

+

3.2 - Basic Branching and Merging

+

3.3 - Branch Management

+

3.4 - Branching Workflows

+

3.5 - Remote Branches

+

3.6 - Rebasing

+

3.7 - Summary

+

</pre>

+

I'll work through 3.1 in class. Read through 3.2 and then do the following exercise.

+

+

=== Merging helloWorld.c ===

+

+

* clone my repository (The pass phrase is ''Hiapp'')

+

+

beagle$ '''git clone git@github.com:MarkAYoder/gitLearn.git'''

+

beagle$ '''cd gitLearn'''

+

+

* Edit <code>helloWorld.c</code> and add a <code>printf</code> with your name on it.

+

* Compile to be sure it works.

+

* stage and commit <code>helloWorld.c</code>. You may have to merge. Keep everyone else's name in the file.

+

* Push it to the repository.

+

+

Once everyone has done this we should have a file with everyone's name in it.

+

+

== Moving from svn ==

+

+

[http://yehudakatz.com/2010/05/13/common-git-workflows/ Here's] a nice article on a common git workflow for those who are moving from svn.

+

+

== Extra Notes ==

−

[http://yehudakatz.com/2010/05/13/common-git-workflows/ Here's] a nice article on a common git workflow.

Revision as of 05:40, 6 September 2012

git is a distributed revision control system with an emphasis on being fast. It was initially designed and developed by Linus Torvalds for Linux kernel development. The purpose of this lab is to get hands on experience with git to learn how it works and how to use it.

Much of the material here has come from Pro Git. We'll be using github to practice gitting.