The Computer Corner Take II (#19) by Bill Kibler

To see more Computer Corner articles look here: CCII page or check out the Home Page .

Version Control 101 Part II

Creating the Myforth git repository, step-by-step

In part I of the version control discussion, I covered most of the logic behind what had been done previously and suggested that git would work closer to how Charley and Bob do their daily development work. The previous MyForth version control was done using Subversion or SVN. There were numerous issues taken with the structure and the commands needed to use the system. Charley wanted a simpler more straight forward usage model and what I gave him in the svn setup was far from that.

What I want to do now, is create a new git repository for holding a simpler MyForth working model. There have been changes in what Charley is doing, he has moved from SiLabs devices to the Arduino, while Bob and myself are still using SiLab sytems. I later want to try out the Ardunio, so I am interested in making sure we all can use the git repo for keeping our work safe. So what follow will be the step-by-step process of creating the repo and laying out what I hope works for all of us.

Creating the basic structure

There are several ways to start using git. You can clone a repo as shown in part I. You can take a previous setup directory structure and turn it into a repo. You can import all the history and structure from a previous version control system such as svn. Since we didn't really like the svn results, we will not import the old structure, but instead create a new repo from scrath and add files one by one. So the first step is checking that we have git, and then create an empty git repository.


> git --version
git version 1.7.2.5

> git init myforth
Initialized empty Git repository in /home/kibler/myfg/myforth/.git/

> find myforth
myforth
myforth/.git
myforth/.git/branches
myforth/.git/objects
myforth/.git/objects/pack
myforth/.git/objects/info
myforth/.git/description
myforth/.git/hooks
myforth/.git/hooks/commit-msg.sample
myforth/.git/hooks/applypatch-msg.sample
myforth/.git/hooks/pre-applypatch.sample
myforth/.git/hooks/update.sample
myforth/.git/hooks/pre-commit.sample
myforth/.git/hooks/post-commit.sample
myforth/.git/hooks/prepare-commit-msg.sample
myforth/.git/hooks/post-update.sample
myforth/.git/hooks/post-receive.sample
myforth/.git/hooks/pre-rebase.sample
myforth/.git/HEAD
myforth/.git/config
myforth/.git/info
myforth/.git/info/exclude
myforth/.git/refs
myforth/.git/refs/tags
myforth/.git/refs/heads

At this point we now have an empty git repository ready for our first set of items to be added. MyForth works on gforth as the basic platform for doing all the development work. So it seems to me that we want to carry over all the gforth tools and information to the new project. We discovered recently that gforth version 7 changed the serial interface coding and thus broke myforth. So it becomes important to include rpm and deb versions of gforth as well as any documentation a first time user might need. So let us add gforth now.

> cd myforth

> mkdir gforth

> cd gforth

> cp ~/myf/gforth-0.6* ./

> cp ~/myf/gforth_0.6* ./

> ls -l
total 6712
-rwxr-xr-x 1 kibler users  724639 Apr 24 09:08 gforth-0.6.2-102.i586.rpm
-rwxr-xr-x 1 kibler users 1581350 Apr 24 09:08 gforth-0.6.2-102.src.rpm
-rw-r--r-- 1 kibler users  780756 Apr 24 09:11 gforth_0.6.2-7.3_amd64.deb
-rw-r--r-- 1 kibler users  763534 Apr 24 09:11 gforth_0.6.2-7.3_i386.deb
-rwxr-xr-x 1 kibler users 1081416 Apr 24 09:08 gforth-0.6.2.pdf
-rwxr-xr-x 1 kibler users 1925536 Apr 24 09:08 gforth-0.6.2.tar.gz
As you might notice, at this point we have a number of files now loaded into the git repo myforth, and have not used a single git command. Since we want these items in the repo, we need to tell git to add them. Notice how the git commands explain and provide helpful comments.

> git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#	./
nothing added to commit but untracked files present (use "git add" to track)

> git add .

> git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached ..." to unstage)
#
#	new file:   gforth-0.6.2-102.i586.rpm
#	new file:   gforth-0.6.2-102.src.rpm
#	new file:   gforth-0.6.2.pdf
#	new file:   gforth-0.6.2.tar.gz
#	new file:   gforth_0.6.2-7.3_amd64.deb
#	new file:   gforth_0.6.2-7.3_i386.deb
#

> git commit -m " intial adding of the gforth needed packages "
[master (root-commit) 5e131d3]  intial adding of the gforth needed packages
 Committer: Bill Kibler 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

    git commit --amend --author='Your Name '

 6 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100755 gforth/gforth-0.6.2-102.i586.rpm
 create mode 100755 gforth/gforth-0.6.2-102.src.rpm
 create mode 100755 gforth/gforth-0.6.2.pdf
 create mode 100755 gforth/gforth-0.6.2.tar.gz
 create mode 100644 gforth/gforth_0.6.2-7.3_amd64.deb
 create mode 100644 gforth/gforth_0.6.2-7.3_i386.deb

> git status
# On branch master
nothing to commit (working directory clean)

> git log
commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages

> cd ..

> ls -l
total 4
drwxr-xr-x 2 kibler users 4096 Apr 24 09:11 gforth
We now have a single directory in our repo with all the gforth support we should need. Let us setup next the rest of the file structure. Since there will be two different but similar devices supported by MyForth we should create two directories, one for each type - in this case ardunio and silab. Each directory will be divided into two structures, code and docs. Since Charley will be doing the arduino, I will leave the two directories empty for now, however git will ignore them if no files are present. I could put an empty ".dir" file in each, which normally will not show, but will be seen by git. In this case I will add a "README" under the code section, and a "note.txt" file in the docs section. These are typical files you might normally find and I often put them in myself. I will put a few words in each, but leave the main filling in for later.

> mkdir -p arduino/code arduino/docs

> mkdir -p silabs/code silabs/docs

> echo "Source code for myforth on arduino platform" > arduino/code/README

> echo "arduino documents for myforth and from http://arduino.cc/en/Tutorial/Links" > arduino/docs/notes.txt

> git status
# On branch master
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#	arduino/
nothing added to commit but untracked files present (use "git add" to track)

> git add .

> git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	new file:   arduino/code/README
#	new file:   arduino/docs/notes.txt
#

> git commit -m " added the main arduino directory and README and notes.txt"
[master f9e6fa3]  added the main arduino directory and README and notes.txt
 Committer: Bill Kibler 
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 arduino/code/README
 create mode 100644 arduino/docs/notes.txt
Note how my "add ." command didn't even see the empty directories and were not added when doing the commit. Before we get too big, it might help to see what is happening under the covers so to speak. We can do a find, look at logs, and see what it knows about.

> ls -al
total 24
drwxr-xr-x 6 kibler users 4096 Apr 24 09:33 .
drwxr-xr-x 3 kibler users 4096 Apr 24 09:07 ..
drwxr-xr-x 4 kibler users 4096 Apr 24 09:33 arduino
drwxr-xr-x 2 kibler users 4096 Apr 24 09:11 gforth
drwxr-xr-x 8 kibler users 4096 Apr 24 09:37 .git
drwxr-xr-x 4 kibler users 4096 Apr 24 09:33 silabs

> find .
.
./arduino
./arduino/code
./arduino/code/README
./arduino/docs
./arduino/docs/notes.txt
./gforth
./gforth/gforth-0.6.2.pdf
./gforth/gforth-0.6.2-102.i586.rpm
./gforth/gforth_0.6.2-7.3_i386.deb
./gforth/gforth-0.6.2.tar.gz
./gforth/gforth-0.6.2-102.src.rpm
./gforth/gforth_0.6.2-7.3_amd64.deb
./silabs
./silabs/code
./silabs/docs
./.git
./.git/branches
./.git/objects
./.git/objects/f7
./.git/objects/f7/b50275d422bbee4f437070d64c0f1d32bad19a
./.git/objects/97
./.git/objects/97/8531fad456c65f1e3b86434902c4a6024b1851
./.git/objects/5e
./.git/objects/5e/131d3b82bd65fb0668a671b630a02fed0a40cd
./.git/objects/95
./.git/objects/95/57980e2dbaab76f8c3bd8031f8ffe24c1b0e2d
./.git/objects/30
./.git/objects/30/52b927016745ece514f5b352b6c5dc8b54d7f8
./.git/objects/ca
./.git/objects/ca/74dfe4996af4d82fd7156014f40f02f7cf5de2
./.git/objects/73
./.git/objects/73/7357877b1ad98d6cfb00ed80ab7510adfd6bfd
./.git/objects/fc
./.git/objects/fc/6d25417d39e0d3b282186139327a24c4a7ea2b
./.git/objects/f3
./.git/objects/f3/326ef5af974db3a33533fba5327724bc1856b1
./.git/objects/55
./.git/objects/55/38664d0028b20e099b623e96f9a3d817224958
./.git/objects/pack
./.git/objects/af
./.git/objects/af/d46721439fb0ffd195c5bad0a8dbf1271b730b
./.git/objects/82
./.git/objects/82/6c85694c84923a1976d6d6929f53b0afe90b2e
./.git/objects/f9
./.git/objects/f9/e6fa3862cb7195b4957e1f5aa95211907b50bd
./.git/objects/99
./.git/objects/99/dbbb3c8da037a7b3af01250975f0b1a6af3c07
./.git/objects/f1
./.git/objects/f1/1952b1f2efb2e694c160f2cf1a0dbe56159287
./.git/objects/c2
./.git/objects/c2/2e70fde8379f13732da574650dc15a7e5dfa1f
./.git/objects/info
./.git/logs
./.git/logs/HEAD
./.git/logs/refs
./.git/logs/refs/heads
./.git/logs/refs/heads/master
./.git/description
./.git/index
./.git/hooks
./.git/hooks/commit-msg.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/pre-applypatch.sample
./.git/hooks/update.sample
./.git/hooks/pre-commit.sample
./.git/hooks/post-commit.sample
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/post-update.sample
./.git/hooks/post-receive.sample
./.git/hooks/pre-rebase.sample
./.git/HEAD
./.git/config
./.git/COMMIT_EDITMSG
./.git/info
./.git/info/exclude
./.git/refs
./.git/refs/tags
./.git/refs/heads
./.git/refs/heads/master

> git ls-files
arduino/code/README
arduino/docs/notes.txt
gforth/gforth-0.6.2-102.i586.rpm
gforth/gforth-0.6.2-102.src.rpm
gforth/gforth-0.6.2.pdf
gforth/gforth-0.6.2.tar.gz
gforth/gforth_0.6.2-7.3_amd64.deb
gforth/gforth_0.6.2-7.3_i386.deb

> git log
commit f9e6fa3862cb7195b4957e1f5aa95211907b50bd
Author: Bill Kibler 
Date:   Sun Apr 24 09:37:42 2011 -0700

     added the main arduino directory and README and notes.txt

commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages

Note the list of "objects", that is where git has compressed and stored the data representing the items it knows about. The "ls-files" commands returns a list of all the items that git knows about and has some object to represent those items. Our git log now shows the two commits that have been made. At this point we need to add the silabs structure and complete the basic setup of the myforth repo. Since the silabs addition steps are the same as adding arduino, I will skip them here and move on to braching.

branching

Our myforth repo now has all the old silabs trunk structure and I have setup a new version of the Test120 code that runs in the new version control system. I set up the build structure to be what I think might work well for charley and yet still use the common files located in separte tree struture. I did that by using links in the directory to point at where the actual code is loacted. You can still do "grep" and it will reurn hits even if the are actually not located in the current working directory. If you go to edit them, you must remember that your are actually editing a file located elsewhere. We will deal with that issue in a moment. First let us see what things look like.


> find silabs -type d
silabs
silabs/code
silabs/code/TB120
silabs/code/source
silabs/code/source/myforth
silabs/code/source/gforth
silabs/code/source/chip
silabs/code/source/amr
silabs/code/source/common
silabs/code/source/utils
silabs/code/projects
silabs/code/projects/Test120
silabs/code/projects/LCD
silabs/code/projects/3xx_delays
silabs/code/projects/examples
silabs/code/projects/Test410
silabs/docs
silabs/docs/silab
silabs/docs/vim

> cd silabs/code/TB120

> ls -l
total 148
lrwxrwxrwx 1 kibler users    31 Apr 24 10:55 bootloader120.fs -> ../source/chip/bootloader120.fs
-rwxr-xr-x 1 kibler users   353 Apr 24 11:17 c
-rw-r--r-- 1 kibler users 65536 Apr 24 11:16 chip.bin
-rw-r--r-- 1 kibler users  7618 Apr 24 11:16 chip.hex
-rwxr-xr-x 1 kibler users   359 Apr 24 11:16 d
lrwxrwxrwx 1 kibler users    26 Apr 24 10:59 debug.fs -> ../source/myforth/debug.fs
-rwxr-xr-x 1 kibler users  6047 Feb 20  2009 functions.txt
-rwxr-xr-x 1 kibler users  4542 Feb 20  2009 get_temp.fs
lrwxrwxrwx 1 kibler users    31 Apr 24 10:56 interactive.fs -> ../source/common/interactive.fs
-rwxr-xr-x 1 kibler users  1961 Apr 24 10:59 job.fs
lrwxrwxrwx 1 kibler users    26 Apr 24 10:54 loader.fs -> ../source/common/loader.fs
-rwxr-xr-x 1 kibler users  2771 Feb 20  2009 main.fs
-rwxr-xr-x 1 kibler users  7504 Feb 20  2009 ram_tools.fs
-rw-r--r-- 1 kibler users   825 Apr 24 10:51 README
-rwxr-xr-x 1 kibler users 11285 Feb 20  2009 set120xbr.fs
lrwxrwxrwx 1 kibler users    24 Apr 24 10:55 sfr120.fs -> ../source/chip/sfr120.fs
lrwxrwxrwx 1 kibler users    31 Apr 24 10:56 standalone.fs -> ../source/myforth/standalone.fs
-rw-r--r-- 1 kibler users 17035 Apr 24 11:16 tags
lrwxrwxrwx 1 kibler users    23 Apr 24 10:55 tether.fs -> ../source/amr/tether.fs

> git log
commit 278f49a35c6cae6615947710cc85d0a919f129c8
Author: Bill Kibler 
Date:   Sun Apr 24 11:20:01 2011 -0700

      updated the code/TB120 files to compile/download using the new setup - works fine

commit c342e605209fca15b57f1d0d797377afe4c04e04
Author: Bill Kibler 
Date:   Sun Apr 24 10:42:54 2011 -0700

     added all the silabs stuff from the myf0909.tar file into new structure - most likely broken

commit f9e6fa3862cb7195b4957e1f5aa95211907b50bd
Author: Bill Kibler 
Date:   Sun Apr 24 09:37:42 2011 -0700

     added the main arduino directory and README and notes.txt

commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages

You might not be able to tell, but the directory "source" contains all the old rarely changed stock includes used to build the running forth for silabs products. You can see some of them by looking at the link source locations from the directory listing. Right off I have some issues with this, for me it is just too messy. However I don't want to change the master version, I just want my view or usage to be set for what I like. This is where branching in git comes in. Since this is my repository and what I do in it, will not effect or alter anyone else, unless I choose to do so, I can pretty much change it all to my hearts content. I like the links, but find their random placement in the directory listing troublesome. Let's rename all the links with a "x_" so they will be at the bottom of the list and clearly defined as "external" source files. We start by checking the current branch usage.

> git branch -a
* master

> git checkout -b myway
Switched to a new branch 'myway'

> git branch -a
  master
* myway
We checked to see what branches if any are being used, by doing a "list all branches" git command. It shows we are on "master", the default base branch. I did a quick context switch and created a new branch by using one command, the "checkout" and "-b" together. This command creates the new branch and switches me to it all in one step. I can now make changes that are my own and will not effect master. I will skip the typing and show you the changes and then commit those changes and show how they did not effect master - notice how the log entries between master and myway are different.

> ll
total 148
-rwxr-xr-x 1 kibler users   353 Apr 24 11:17 c
-rw-r--r-- 1 kibler users 65536 Apr 24 11:16 chip.bin
-rw-r--r-- 1 kibler users  7618 Apr 24 11:16 chip.hex
-rwxr-xr-x 1 kibler users   359 Apr 24 11:16 d
-rwxr-xr-x 1 kibler users  6047 Feb 20  2009 functions.txt
-rwxr-xr-x 1 kibler users  4542 Feb 20  2009 get_temp.fs
-rwxr-xr-x 1 kibler users  1961 Apr 24 10:59 job.fs
-rwxr-xr-x 1 kibler users  2771 Feb 20  2009 main.fs
-rwxr-xr-x 1 kibler users  7504 Feb 20  2009 ram_tools.fs
-rw-r--r-- 1 kibler users   825 Apr 24 10:51 README
-rwxr-xr-x 1 kibler users 11285 Feb 20  2009 set120xbr.fs
-rw-r--r-- 1 kibler users 17035 Apr 24 11:16 tags
lrwxrwxrwx 1 kibler users    31 Apr 24 10:55 x_bootloader120.fs -> ../source/chip/bootloader120.fs
lrwxrwxrwx 1 kibler users    26 Apr 24 10:59 x_debug.fs -> ../source/myforth/debug.fs
lrwxrwxrwx 1 kibler users    31 Apr 24 10:56 x_interactive.fs -> ../source/common/interactive.fs
lrwxrwxrwx 1 kibler users    26 Apr 24 10:54 x_loader.fs -> ../source/common/loader.fs
lrwxrwxrwx 1 kibler users    24 Apr 24 10:55 x_sfr120.fs -> ../source/chip/sfr120.fs
lrwxrwxrwx 1 kibler users    31 Apr 24 10:56 x_standalone.fs -> ../source/myforth/standalone.fs
lrwxrwxrwx 1 kibler users    23 Apr 24 10:55 x_tether.fs -> ../source/amr/tether.fs

> vi job.fs

> git add .

> git commit -am "changed all the links and references to start with x_ to signal it is an external reference "
[myway 1bf50e0] changed all the links and references to start with x_ to signal it is an external reference
 8 files changed, 7 insertions(+), 7 deletions(-)
 rename silabs/code/TB120/{bootloader120.fs => x_bootloader120.fs} (100%)
 rename silabs/code/TB120/{debug.fs => x_debug.fs} (100%)
 rename silabs/code/TB120/{interactive.fs => x_interactive.fs} (100%)
 rename silabs/code/TB120/{loader.fs => x_loader.fs} (100%)
 rename silabs/code/TB120/{sfr120.fs => x_sfr120.fs} (100%)
 rename silabs/code/TB120/{standalone.fs => x_standalone.fs} (100%)
 rename silabs/code/TB120/{tether.fs => x_tether.fs} (100%)

> git log
commit 1bf50e0a582348048bb75cc58cd38ba76b22384b
Author: bill 
Date:   Sun Apr 24 12:46:09 2011 -0700

    changed all the links and references to start with x_ to signal it is an external reference

commit 278f49a35c6cae6615947710cc85d0a919f129c8
Author: Bill Kibler 
Date:   Sun Apr 24 11:20:01 2011 -0700

      updated the code/TB120 files to compile/download using the new setup - works fine

commit c342e605209fca15b57f1d0d797377afe4c04e04
Author: Bill Kibler 
Date:   Sun Apr 24 10:42:54 2011 -0700

     added all the silabs stuff from the myf0909.tar file into new structure - most likely broken

commit f9e6fa3862cb7195b4957e1f5aa95211907b50bd
Author: Bill Kibler 
Date:   Sun Apr 24 09:37:42 2011 -0700

     added the main arduino directory and README and notes.txt

commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages

> git checkout master
Switched to branch 'master'

> git log
commit 278f49a35c6cae6615947710cc85d0a919f129c8
Author: Bill Kibler 
Date:   Sun Apr 24 11:20:01 2011 -0700

      updated the code/TB120 files to compile/download using the new setup - works fine

commit c342e605209fca15b57f1d0d797377afe4c04e04
Author: Bill Kibler 
Date:   Sun Apr 24 10:42:54 2011 -0700

     added all the silabs stuff from the myf0909.tar file into new structure - most likely broken

commit f9e6fa3862cb7195b4957e1f5aa95211907b50bd
Author: Bill Kibler 
Date:   Sun Apr 24 09:37:42 2011 -0700

     added the main arduino directory and README and notes.txt

commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages

Notice how the log for master doesn't show the commits for branch myway. What happens on "myway" is isolated from the changes and status of master. I made changes in the file "job.fs" to reflect the name changes of the links and we can see those changes using diff. We get the sha1 values from the git log and tell it to select the indicated versions and tell us the diff, which is in a patch format.

> git diff 278f49a35 -- 1bf50e0a job.fs
diff --git a/silabs/code/TB120/job.fs b/silabs/code/TB120/job.fs
index 063fab0..c5a56b6 100755
--- a/silabs/code/TB120/job.fs
+++ b/silabs/code/TB120/job.fs
@@ -12,11 +12,11 @@ $10000 constant target-size
 
 \ now load the support/debug files for gforth
 \ should be project independent - 8051 general files.
-include loader.fs
+include x_loader.fs
 
 \ now load the project board/chip specific support files
-include sfr120.fs
-include bootloader120.fs
+include x_sfr120.fs
+include x_bootloader120.fs
 rom-start org
 
 \ Choose an interpreter.
@@ -24,12 +24,12 @@ rom-start org
 -1 constant standalone  \ Standalone Target
 
 tethered [if]
-       include tether.fs
-[else] include standalone.fs
+       include x_tether.fs
+[else] include x_standalone.fs
 [then]
 
 \ --- Then load the application --- /
-include myforth/debug.fs  \ Comes before application, useful tools.
+include x_debug.fs  \ Comes before application, useful tools.
 
 \ now set the xbr and assign pins - defines init-hdwre ...
 include set120xbr.fs            \ default hardware setup for 120 chips
@@ -37,7 +37,7 @@ include ram_tools.fs            \ tools for extended ram access, display
 include get_temp.fs             \ stock get temperature routines
 
 include main.fs                 \ main functions to interface with PC
-include interactive.fs   \ Should come _after_ application for efficiency.
+include x_interactive.fs   \ Should come _after_ application for efficiency.
 
 \ --- Finally patch the reset vector --- /
Well that works pretty well, but what about the time I want to make one of the common files unique to this stream of code work. Simply remove the link and replace it with the file and edit away. Let's do it with the serial-linux.fs file.

> vi c

> cp ../source/amr/serial-linux.fs ./

> vi serial-linux.fs

> diff serial-linux.fs ../source/amr/serial-linux.fs
37,38c37,38
< here ," /dev/ttyUSB1"
< here ," /dev/ttyUSB0"
---
> here ," /dev/ttyS3"
> here ," /dev/ttyS2"

> git add .

> git status
# On branch myway
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	modified:   c
#	new file:   serial-linux.fs
#

> git commit -am " replaced the path in c with actual local copy of serial-linux.fs"
[myway 926f74a]  replaced the path in c with actual local copy of serial-linux.fs
 2 files changed, 106 insertions(+), 1 deletions(-)
 create mode 100755 silabs/code/TB120/serial-linux.fs

> git log
commit 926f74a7828160b3efe47f589592ac2faec6b25e
Author: bill 
Date:   Sun Apr 24 13:10:00 2011 -0700

     replaced the path in c with actual local copy of serial-linux.fs

commit 1bf50e0a582348048bb75cc58cd38ba76b22384b
Author: bill 
Date:   Sun Apr 24 12:46:09 2011 -0700

    changed all the links and references to start with x_ to signal it is an external reference

commit 278f49a35c6cae6615947710cc85d0a919f129c8
Author: Bill Kibler 
Date:   Sun Apr 24 11:20:01 2011 -0700

      updated the code/TB120 files to compile/download using the new setup - works fine

commit c342e605209fca15b57f1d0d797377afe4c04e04
Author: Bill Kibler 
Date:   Sun Apr 24 10:42:54 2011 -0700

     added all the silabs stuff from the myf0909.tar file into new structure - most likely broken

commit f9e6fa3862cb7195b4957e1f5aa95211907b50bd
Author: Bill Kibler 
Date:   Sun Apr 24 09:37:42 2011 -0700

     added the main arduino directory and README and notes.txt

commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages

> git diff 926f74a7 1bf50e0a5 c
diff --git a/silabs/code/TB120/c b/silabs/code/TB120/c
index 7b01e28..0554c2c 100755
--- a/silabs/code/TB120/c
+++ b/silabs/code/TB120/c
@@ -6,6 +6,6 @@ gforth -e "fpath path+ ./ " \
        -e "fpath path+ ../source .fpath" \
        -e " 1 value com? " \
        -e " 38400 value current-baudrate " \
-       ./serial-linux.fs \
+       ../source/amr/serial-linux.fs \
        ./job.fs \
        -e '( open-comm) target talking'
If I were to go back to master, you would again find that nothing has changed there, yet my current work setup is being adjusted to my own personal needs. Let us say however that I want to do some work using the stock serial-linux.fs files from before it was changed. Let us suggest as well that this change become the basis for another whole new stream of development work. We simply checkout the sha1 from before the last change, and create a new branch and start work there.

> git checkout 1bf50e0a58
Note: checking out '1bf50e0a58'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 1bf50e0... changed all the links and references to start with x_ to signal it is an external reference

> git checkout -b newstream
Switched to a new branch 'newstream'

> ll
total 148
-rwxr-xr-x 1 kibler users   353 Apr 24 13:20 c
-rw-r--r-- 1 kibler users 65536 Apr 24 11:16 chip.bin
-rw-r--r-- 1 kibler users  7618 Apr 24 11:16 chip.hex
-rwxr-xr-x 1 kibler users   359 Apr 24 11:16 d
-rwxr-xr-x 1 kibler users  6047 Feb 20  2009 functions.txt
-rwxr-xr-x 1 kibler users  4542 Feb 20  2009 get_temp.fs
-rwxr-xr-x 1 kibler users  1967 Apr 24 12:57 job.fs
-rwxr-xr-x 1 kibler users  2771 Feb 20  2009 main.fs
-rwxr-xr-x 1 kibler users  7504 Feb 20  2009 ram_tools.fs
-rw-r--r-- 1 kibler users   825 Apr 24 10:51 README
-rwxr-xr-x 1 kibler users 11285 Feb 20  2009 set120xbr.fs
-rw-r--r-- 1 kibler users 17035 Apr 24 11:16 tags
lrwxrwxrwx 1 kibler users    31 Apr 24 12:57 x_bootloader120.fs -> ../source/chip/bootloader120.fs
lrwxrwxrwx 1 kibler users    26 Apr 24 12:57 x_debug.fs -> ../source/myforth/debug.fs
lrwxrwxrwx 1 kibler users    31 Apr 24 12:57 x_interactive.fs -> ../source/common/interactive.fs
lrwxrwxrwx 1 kibler users    26 Apr 24 12:57 x_loader.fs -> ../source/common/loader.fs
lrwxrwxrwx 1 kibler users    24 Apr 24 12:57 x_sfr120.fs -> ../source/chip/sfr120.fs
lrwxrwxrwx 1 kibler users    31 Apr 24 12:57 x_standalone.fs -> ../source/myforth/standalone.fs
lrwxrwxrwx 1 kibler users    23 Apr 24 12:57 x_tether.fs -> ../source/amr/tether.fs

> vi README

> git add .

> git commit -am " modified README to show this new branch "
[newstream 83cf326]  modified README to show this new branch
 1 files changed, 2 insertions(+), 0 deletions(-)

> git log
commit 83cf326fc3fa6c1d3250bc9320fcac9ef85de050
Author: bill 
Date:   Sun Apr 24 13:24:50 2011 -0700

     modified README to show this new branch

commit 1bf50e0a582348048bb75cc58cd38ba76b22384b
Author: bill 
Date:   Sun Apr 24 12:46:09 2011 -0700

    changed all the links and references to start with x_ to signal it is an external reference

commit 278f49a35c6cae6615947710cc85d0a919f129c8
Author: Bill Kibler 
Date:   Sun Apr 24 11:20:01 2011 -0700

      updated the code/TB120 files to compile/download using the new setup - works fine

commit c342e605209fca15b57f1d0d797377afe4c04e04
Author: Bill Kibler 
Date:   Sun Apr 24 10:42:54 2011 -0700

     added all the silabs stuff from the myf0909.tar file into new structure - most likely broken

commit f9e6fa3862cb7195b4957e1f5aa95211907b50bd
Author: Bill Kibler 
Date:   Sun Apr 24 09:37:42 2011 -0700

     added the main arduino directory and README and notes.txt

commit 5e131d3b82bd65fb0668a671b630a02fed0a40cd
Author: Bill Kibler 
Date:   Sun Apr 24 09:16:16 2011 -0700

     intial adding of the gforth needed packages
Note the missing entry in the log from the previous update where I changed the job.fs file and instead we see the altered README file notes from the new branch. If you look at the directory listing you do not see the serial-linux.fs file as well. At this point I think we have a good overview and some examples of using branching in git. Next is pushing and pulling from a repo.

Pushing and Pulling

"git" is great for one person projects, but works well with sharing between repos and remote masters. The MyForth master repo is located on ..... to be filled in...


Kibler Electronics, PO Box 535, Lincoln, CA 95648-0535, USA.
Email: bill@kiblerelectronics.com
Copyright © 2011, Kibler Electronics