Difference between revisions of "EBC Exercise 16 git"

From eLinux.org
Jump to: navigation, search
m (Adding lab material)
m (Undo revision 260576 by Yoder (talk))
(32 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
[[Category:ECE497]]
 
[[Category:ECE497]]
 +
{{YoderHead}}
  
'''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 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.
+
If you haven't done so already, go to [[EBC_Exercise_05_Getting_Exercise_Support_Materials#Set_Up_Git]] and follow the directions for installing and setting up git.
  
== Nice git article ==
+
== 1. Play with git locally ==
  
[http://yehudakatz.com/2010/05/13/common-git-workflows/ Here's] a nice article on a common git workflow.
+
[http://progit.org Pro Git] has a nice on-line book with lots of good details.  I'll lead you through many parts of it.  The [http://progit.org/book/ first chapter] is '''Getting Started'''. Here are the topics:
  
== Access ti/staging ==
+
<pre>
 +
1.1 - About Version Control
 +
1.2 - A Short History of Git
 +
1.3 - Git Basics
 +
1.4 - Installing Git
 +
1.5 - First-Time Git Setup
 +
1.6 - Getting Help
 +
1.7 - Summary
 +
</pre>
 +
 
 +
I'll cover Git Basics in class and you have already done parts 1.5 and 1.6 to set up for github.  I suggest you take a look at [http://progit.org/book/ch1-6.html Getting Help] and then move on.
  
Here is what I did to access the ti/staging stuff.
+
== 2. Git Basics ==
  
 +
Chapter is on '''Git Basics'''.  The topics are:
 
<pre>
 
<pre>
host $ cd ~/oe/openembedded
+
2.1 - Getting a Git Repository
host $ git remote add gitor git://gitorious.org/angstrom/openembedded.git
+
2.2 - Recording Changes to the Repository
host $ git fetch gitor
+
2.3 - Viewing the Commit History
host $ git checkout gitor/ti/staging -b ti/staging
+
2.4 - Undoing Things
host $ cd ${OETREE}
+
2.5 - Working with Remotes
host $ wget http://download.berlios.de/bitbake/bitbake-1.8.18.tar.gz
+
2.6 - Tagging
host $ tar -xvf bitbake-1.8.18.tar.g
+
2.7 - Tips and Tricks
host $ gedit source-me.txt
+
2.8 - Summary
 
</pre>
 
</pre>
Change
+
 
 +
There is lots of good material here.  I suggest you work through it all.  Section 2.1 shows how to clone a remote repository.
 +
 
 +
'''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 ===
 +
 
 +
# How do you stage a file?
 +
# How do you view staged and unstaged changes?
 +
# 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?
 +
# How do you unstage a file?
 +
# How do you unmodify a file?
 +
# 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?
 +
 
 +
== 3. Git Branching ==
 +
 
 +
Chapter 3 is on branching.  Here's the topics from the book:
 
<pre>
 
<pre>
PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}
+
3.1 - What a Branch Is
</pre>
+
3.2 - Basic Branching and Merging
to
+
3.3 - Branch Management
<pre>
+
3.4 - Branching Workflows
PATH=${OETREE}/bitbake-1.8.18/bin:${ORG_PATH}
+
3.5 - Remote Branches
</pre>
+
3.6 - Rebasing
Save and quit gedit
+
3.7 - Summary
<pre>
 
host $ . source-me.txt
 
host $ cd ~/oe
 
host $ mv angstrom-dev angstrom-dev.v0
 
host $ bitbake console-image
 
 
</pre>
 
</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.
 +
 +
{{YoderFoot}}

Revision as of 08:47, 3 June 2013

thumb‎ Embedded Linux Class by Mark A. Yoder


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.

0. Set Up Git

If you haven't done so already, go to EBC_Exercise_05_Getting_Exercise_Support_Materials#Set_Up_Git and follow the directions for installing and setting up git.

1. Play with git locally

Pro Git has a nice on-line book with lots of good details. I'll lead you through many parts of it. The first chapter is Getting Started. Here are the topics:

1.1 - About Version Control
1.2 - A Short History of Git
1.3 - Git Basics
1.4 - Installing Git
1.5 - First-Time Git Setup
1.6 - Getting Help
1.7 - Summary

I'll cover Git Basics in class and you have already done parts 1.5 and 1.6 to set up for github. I suggest you take a look at Getting Help and then move on.

2. Git Basics

Chapter is on Git Basics. The topics are:

2.1 - Getting a Git Repository
2.2 - Recording Changes to the Repository
2.3 - Viewing the Commit History
2.4 - Undoing Things
2.5 - Working with Remotes
2.6 - Tagging
2.7 - Tips and Tricks
2.8 - Summary

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

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

  1. How do you stage a file?
  2. How do you view staged and unstaged changes?
  3. How do you view comment history?
  4. 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?
  5. How do you unstage a file?
  6. How do you unmodify a file?
  7. After running the remote -v how do you tell if a site is read only or read/write?
  8. What's the difference between a lightweight and an annotated tag?

3. Git Branching

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

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

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 helloWorld.c and add a printf with your name on it.
  • Compile to be sure it works.
  • stage and commit helloWorld.c. 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

Here's a nice article on a common git workflow for those who are moving from svn.




thumb‎ Embedded Linux Class by Mark A. Yoder