<
From version < 22.1 >
edited by cds
on 2012/10/15 11:19
To version < 27.1 >
edited by msp
on 2012/10/15 15:02
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.cds
1 +XWiki.msp
Content
... ... @@ -1,19 +1,108 @@
1 -This tutorial will address the source code management (SCM) tool named [[Git>>url:http://git-scm.com/||shape="rect"]].
1 +This tutorial will address the source code management (SCM) tool named [[Git>>url:http://git-scm.com/||shape="rect"]]. By following these steps you should learn about the basic usage of Git, which is required for the whole practical course. Furthermore, Git is a great SCM tool, and it's good to know how to use it. During this tutorial, we will follow Alan Turing's thoughts towards developing the [[Turing Machine>>url:http://en.wikipedia.org/wiki/Turing_machine||shape="rect"]].
2 2  
3 -= Repositories and Commits =
3 + More in-depth documentation can be found on the [[official home page>>url:http://git-scm.com/documentation||shape="rect"]], which mentions books, videos, and links to other tutorials and references.
4 4  
5 -{{task-list}}
6 -{{task id="1" status="incomplete"}}
7 -test1
8 -{{/task}}
5 += Creating Commits =
9 9  
10 -{{task id="2" status="incomplete"}}
11 -test2
12 -{{/task}}
7 +1. Read the [[Git for Computer Scientists>>url:http://eagain.net/articles/git-for-computer-scientists/||shape="rect"]] introduction (skip this if you are already familiar with Git).
8 +1. For Linux, Git is available in its own package. Windows users can install [[msysGit>>url:http://msysgit.github.com/||shape="rect"]]. For MacOS, Git is available as part of [[Xcode>>url:https://developer.apple.com/xcode/||shape="rect"]]; if you cannot install that, use [[Git for OSX>>url:http://code.google.com/p/git-osx-installer/||shape="rect"]].
9 +1. (((
10 +Create a local repository for the "//Turing Project//":
13 13  
14 -{{task id="3" status="incomplete"}}
15 -test 3
16 -{{/task}}
17 -{{/task-list}}
12 +{{noformat}}
13 +$ mkdir turing
14 +$ cd turing
15 +$ git init
16 +Initialized empty Git repository in ~/turing/.git/
17 +{{/noformat}}
18 +)))
19 +1. (((
20 +Add and commit some content: copy [[attach:notes.txt]]{{code language="none"}}{{/code}} to your {{code language="none"}}turing{{/code}} directory.
18 18  
19 -\\
22 +{{noformat}}
23 +$ git add notes.txt
24 +$ git commit -m "wrote some first notes"
25 +[master (root-commit) 2e73b34] wrote some first notes
26 + 1 files changed, 5 insertions(+), 0 deletions(-)
27 + create mode 100644 notes.txt
28 +{{/noformat}}
29 +)))
30 +1. Edit {{code language="none"}}notes.txt{{/code}}:\\
31 +11. Replace "fixed" with "infinite" in line 1.
32 +11. Replace "... (TODO)" with "a finite state machine" in line 4.
33 +1. (((
34 +View the status of your current working copy:
35 +
36 +{{noformat}}
37 +$ git status
38 +# On branch master
39 +# Changed but not updated:
40 +# (use "git add <file>..." to update what will be committed)
41 +# (use "git checkout -- <file>..." to discard changes in working directory)
42 +#
43 +# modified: notes.txt
44 +#
45 +no changes added to commit (use "git add" and/or "git commit -a")
46 +{{/noformat}}
47 +)))
48 +1. (((
49 +Mark the modified file to include it in the next commit, then view the status again and compare with the previous output:
50 +
51 +{{noformat}}
52 +$ git add notes.txt
53 +$ git status
54 +# On branch master
55 +# Changes to be committed:
56 +# (use "git reset HEAD <file>..." to unstage)
57 +#
58 +# modified: notes.txt
59 +#
60 +{{/noformat}}
61 +)))
62 +1. (((
63 +Commit the modified content to your local repository:
64 +
65 +{{noformat}}
66 +$ git commit -m "modified tape length, found a controller for tape head"
67 +[master 52e2d49] modified tape length, found a controller for tape head
68 + 1 files changed, 2 insertions(+), 2 deletions(-)
69 +{{/noformat}}
70 +)))
71 +
72 +After the preceding steps you have two commits in your local repository, each with one file in the index. You have different commands for viewing these commits:
73 +
74 +{{noformat}}
75 +$ git log
76 +commit 52e2d4946791c2725015853e5e261ce143c6fe8a
77 +Author: Miro Spoenemann <msp@informatik.uni-kiel.de>
78 +Date: Mon Oct 15 15:00:14 2012 +0200
79 +
80 + modified tape length, found a controller for tape head
81 +
82 +commit 2e73b34ac44480773fc0e52875b7353a087d8c6d
83 +Author: Miro Spoenemann <msp@informatik.uni-kiel.de>
84 +Date: Mon Oct 15 12:14:06 2012 +0200
85 +
86 + wrote some first notes
87
88 +$ $ git show 52e2d49
89 +commit 52e2d4946791c2725015853e5e261ce143c6fe8a
90 +Author: Miro Spoenemann <msp@informatik.uni-kiel.de>
91 +Date: Mon Oct 15 15:00:14 2012 +0200
92 +
93 + modified tape length, found a controller for tape head
94 +
95 +diff --git a/notes.txt b/notes.txt
96 +index 4ded2b3..bd422b3 100644
97 +--- a/notes.txt
98 ++++ b/notes.txt
99 +@@ -1,5 +1,5 @@
100 +- * A tape with fixed length
101 ++ * A tape with infinite length
102 + * Tape head can read or write data
103 + * Tape head can move left or right
104 +- * The head is controlled by ... (TODO)
105 ++ * The head is controlled by a finite state machine
106 +{{/noformat}}
107 +
108 +Note that each commit is identified by a looong hash value, but it is possible to use only a prefix when referencing them (if the prefix is not ambiguous): the example above uses {{code language="none"}}52e2d49{{/code}} to identify the second commit. Also try the command {{code language="none"}}gitk{{/code}} to get an overview of your commits (a better alternative available for MacOS is [[GitX>>url:http://gitx.frim.nl/||shape="rect"]]).
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -2982107
1 +2982123
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982107/Git
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982123/Git