<
From version < 36.1 >
edited by msp
on 2012/10/16 14:34
To version < 40.1 >
edited by msp
on 2012/10/16 15:25
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -10,6 +10,8 @@
10 10  
11 11  = Creating Commits =
12 12  
13 +Most steps of this tutorial are done by typing shell commands. The grey boxes contain the commands you should enter, preceded by a {{code language="none"}}${{/code}} symbol, and followed by their output. While you may copy & paste these commands, some of them may require modifications to adapt them to your own projects. The output will be slightly different for many commands when you enter them, since it also depends on parameters such as the user name and time of execution.
14 +
13 13  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).
14 14  1. For Linux, Git is available in its own package. Windows users can install [[msysGit>>url:http://msysgit.github.com/||shape="rect"]]. For Mac OSX, 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"]].
15 15  1. (((
... ... @@ -126,7 +126,7 @@
126 126  + * The head is controlled by a finite state machine
127 127  {{/noformat}}
128 128  
129 -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. The commit hashes in your repository will be different from those seen in this tutorial, because the name of the author and the exact time of committing is also considered in the hash calculation. 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"]]).
131 +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. The commit hashes in your repository will be different from those seen in this tutorial, because the name of the author and the exact time of committing is also considered in the hash calculation. Also try the command {{code language="none"}}gitk{{/code}} to get an overview of your commits (a better alternative available for Mac OSX is [[GitX>>url:http://gitx.frim.nl/||shape="rect"]]).
130 130  
131 131  = Branching and Merging =
132 132  
... ... @@ -203,7 +203,7 @@
203 203  {{/noformat}}
204 204  )))
205 205  1. (((
206 -Switch back to the {{code language="none"}}sketches{{/code}} branch and commit something there. Note that the {{code language="none"}}checkout{{/code}} command modifies your working copy, hence you have to update your text editor's content if you opened one of the files.
208 +Switch back to the {{code language="none"}}sketches{{/code}} branch and modify it as shown below. Note that the {{code language="none"}}checkout{{/code}} command modifies your working copy, hence you have to update your text editor's content if you opened one of the files.
207 207  
208 208  {{noformat}}
209 209  $ git checkout sketches
... ... @@ -219,7 +219,7 @@
219 219   1 files changed, 5 insertions(+), 0 deletions(-)
220 220  {{/noformat}}
221 221  
222 -Now our two branches have //diverged//, which means that they cannot be fast-forwarded anymore.
224 +Now your two branches have //diverged//, which means that they cannot be fast-forwarded anymore.
223 223  )))
224 224  1. (((
225 225  Merge the {{code language="none"}}master{{/code}} branch into {{code language="none"}}sketches{{/code}}:
... ... @@ -243,8 +243,8 @@
243 243   * The finite state machine has an initial state and one or more final states
244 244  {{/noformat}}
245 245  )))
246 -1. Commit the change to {{code language="none"}}notes.txt{{/code}}.
247 -1. Check out {{code language="none"}}sketches{{/code}} (make sure to refresh your text editor so {{code language="none"}}notes.txt{{/code}} is reset to its previous state, without the change made above).
248 +1. Commit the change o{{code language="none"}}notes.txt{{/code}}.
249 +1. Check out {{code language="none"}}sketches{{/code}} (make sure to refresh your text editor so that {{code language="none"}}notes.txt{{/code}} is reset to its previous state, without the change made above).
248 248  1. (((
249 249  Insert the following line after line 4 of {{code language="none"}}notes.txt{{/code}}:
250 250  
... ... @@ -252,7 +252,7 @@
252 252   * Each state transition can trigger head movement and data read/write
253 253  {{/noformat}}
254 254  )))
255 -1. Commit the change to {{code language="none"}}notes.txt{{/code}}.
257 +1. Commit the change of {{code language="none"}}notes.txt{{/code}}.
256 256  )))
257 257  1. (((
258 258  Merge the {{code language="none"}}master{{/code}} branch into the current branch ({{code language="none"}}sketches{{/code}}):
... ... @@ -332,6 +332,8 @@
332 332  
333 333  In the previous sections you have worked only with a local repository. The next step is to share this content with a remote repository. Later we will use [[Stash>>url:https://www.atlassian.com/software/stash/overview||shape="rect"]] for repository management, but we need to create group accounts for you first, thus you will use another system called [[Gitorious>>url:https://git.rtsys.informatik.uni-kiel.de/||shape="rect"]] for now.
334 334  
337 +Usually it is sufficient to have only one local copy of a Git repository. However, in this tutorial you will create a second copy in order to "simulate" what can happen if two users access the same remote repository: imagine the directories {{code language="none"}}turing{{/code}} and {{code language="none"}}turing2{{/code}} are each managed by a different user. You will simulate the resulting interference by switching your working directory between these two.
338 +
335 335  1. Register to the Gitorious system: [[https:~~/~~/git.rtsys.informatik.uni-kiel.de/>>url:https://git.rtsys.informatik.uni-kiel.de/||shape="rect"]] (use your //Institut für Informatik// login name and email address)
336 336  1. Go to your //Dashboard// → //Manage SSH keys// → //Add SSH key//
337 337  1. Copy & paste the content of your public SSH key.\\
... ... @@ -338,7 +338,8 @@
338 338  1*. If you don't have an SSH key: use the shell command {{code language="none"}}ssh-keygen{{/code}}, confirm the default destination file {{code language="none"}}~/.ssh/id_rsa{{/code}}, and choose whether to give a passphrase. If you have a passphrase, you need to enter it whenever you use your SSH key for the first time in a session. You can omit the passphrase, but that makes the key less secure. As result, the tool generates a private key {{code language="none"}}~/.ssh/id_rsa{{/code}}, which has to be kept secret, and a public key {{code language="none"}}~/.ssh/id_rsa.pub{{/code}}.
339 339  1. Go to //Projects// → //Create a new project// and call it "personal-<login>", replacing <login> with your own login name.
340 340  1. On the next page, create a repository named "turing" (or select //Add repository// on your project page).
341 -1. Once you are on the repository page, copy the URL shown in //Clone & push urls//.
345 +1. On the repository page, go to //Manage collaborators// → //Add collaborators// and add the user msp.
346 +1. Once you are back on the repository page, copy the URL shown in //Clone & push urls//.
342 342  1. Email the copied URL to [[msp@informatik.uni-kiel.de>>mailto:msp@informatik.uni-kiel.de||shape="rect"]]. This will serve as proof for your work on this tutorial.
343 343  1. (((
344 344  Transfer your {{code language="none"}}master{{/code}} branch to the new server-side repository. Replace the URL in the following command by the one copied from Gitorious:
... ... @@ -373,7 +373,7 @@
373 373  $ cd turing2
374 374  {{/noformat}}
375 375  
376 -The {{code language="none"}}clone{{/code}} command automatically creates a remote named {{code language="none"}}origin{{/code}} in the new local repository, which is set to the given URL.
381 +The {{code language="none"}}clone{{/code}} command automatically creates a remote named {{code language="none"}}origin{{/code}} in the new local repository, which is set to the given URL. You will use this second clone to simulate another user with access to the repository.
377 377  )))
378 378  1. Edit the file {{code language="none"}}examples.txt{{/code}} in the new clone ({{code language="none"}}turing2{{/code}}): replace {{code language="none"}}"a"{{/code}} in line 6 by {{code language="none"}}"c"{{/code}} and correct the tape representations in lines 9, 14, and 19 accordingly. Commit the change.
379 379  1. (((
... ... @@ -540,10 +540,10 @@
540 540   957f686..b58ded7 master -> master
541 541  {{/noformat}}
542 542  
543 -While {{code language="none"}}pull{{/code}} performs a {{code language="none"}}fetch{{/code}} and a {{code language="none"}}merge{{/code}}, {{code language="none"}}push{{/code}} transfers the new merged branch to the server. Note that during the merge operation conflicts can occur. In that case you have to resolve them and commit the changes before you can push.
548 +While {{code language="none"}}pull{{/code}} performs a {{code language="none"}}fetch{{/code}} and a {{code language="none"}}merge{{/code}}, {{code language="none"}}push{{/code}} transfers the new merged branch to the server. Note that during the merge operation conflicts can occur. In that case you have to resolve them and commit the changes before you can push. When used without parameters like shown above, {{code language="none"}}pull{{/code}} lookes in {{code language="none"}}.git/config{{/code}} to determine which branches to pull from which remotes.
544 544  )))
545 545  1. (((
546 -In order to check out the {{code language="none"}}sketches{{/code}} branch, which was previously pushed to the server, simply type the following command:
551 +In order to check out the {{code language="none"}}sketches{{/code}} branch locally, which was previously pushed to the server, simply type the following command:
547 547  
548 548  {{noformat}}
549 549  $ git checkout sketches
... ... @@ -551,7 +551,7 @@
551 551  Switched to a new branch 'sketches'
552 552  {{/noformat}}
553 553  
554 -This branch can be pushed and pulled with the server in the same way as you did for the {{code language="none"}}master{{/code}} branch.
559 +This branch can be pushed and pulled with the server in the same way as you did for the {{code language="none"}}master{{/code}} branch. Never check out {{code language="none"}}origin/sketches{{/code}}, since that is a remote tracking branch!
555 555  )))
556 556  
557 557  The {{code language="none"}}master{{/code}} branch should look like this:
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -2982155
1 +2982163
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982155/Git
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982163/Git