From 46e8200ce73a3dbf7c65fd07d38e244ed373082f Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sat, 17 Jul 2010 23:03:28 +1200 Subject: [PATCH 01/61] Added link to Stellar nucleosynthesis --- gamow.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamow.txt b/gamow.txt index 7cc8f7c..5165600 100644 --- a/gamow.txt +++ b/gamow.txt @@ -6,7 +6,7 @@ Gamow humorously decided to add the name of his friend—the eminent physicist H Alpher, at the time only a graduate student, was generally dismayed by the inclusion of Bethe's name on this paper. He felt that the inclusion of another eminent physicist would overshadow his personal contribution to this work and prevent him from receiving proper recognition for such an important discovery. He expressed resentment over Gamow's decision as late as 1999.[ The theory originally proposed that all atomic nuclei are produced by the successive capture of neutrons, one mass unit at a time. However, later study challenged the universality of the successive capture theory. No element was found to have a stable isotope with an atomic mass of five or eight. Physicists soon noticed that these mass gaps would hinder the production of elements beyond helium. Just as it's impossible to climb a staircase one step at a time when one of the steps is missing, this discovery meant that the successive capture theory could not account for higher elements. -It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis in stars, a theory largely developed by Bethe. +It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis (http://en.wikipedia.org/wiki/Stellar_nucleosynthesis) in stars, a theory largely developed by Bethe. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details. http://creativecommons.org/licenses/by-sa/3.0/ From 9d6b53500ffbb0ae7d02d1b986f49b2f40a0a442 Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sat, 17 Jul 2010 23:49:44 +1200 Subject: [PATCH 02/61] Added git diff --- README.textile | 76 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/README.textile b/README.textile index e39544b..2d5076f 100644 --- a/README.textile +++ b/README.textile @@ -101,24 +101,40 @@ You should always aim for this state. h2. Basics (II) +A very useful command is @git diff@. This is very useful to see exactly what changes you have done. + +

+$ nano alice.txt   #EDIT the file here
+$ git diff
+diff --git a/alice.txt b/alice.txt
+index e39544b..8b89796 100644
+--- a/alice.txt
++++ b/alice.txt
+@@ -1,6 +1,6 @@ 
+ This is my first line 
+ 
++This is a new line
++
+
+ If you have changed your mind, or wish to organize your commits or staging area differently, Git allows you to do that. -Say, you edited @gamow.txt@ and added it to the staging area, and then do not wish to proceed. Here's how to undo adding files to the staging area. +Say, you edited @alice.txt@ and added it to the staging area, and then do not wish to proceed. Here's how to undo adding files to the staging area.

 $ git status -s
- M gamow.txt 
-$ git add gamow.txt
+ M alice.txt 
+$ git add alice.txt
 $ git status
 # On branch master
 # Changes to be committed:
 #   (use "git reset HEAD ..." to unstage)
 #
-#	modified:   gamow.txt
+#	modified:   alice.txt
 #
-$ git reset HEAD gamow.txt
+$ git reset HEAD alice.txt
 Unstaged changes after reset:
-M	gamow.txt
+M	alice.txt
 
@@ -132,9 +148,9 @@ $ git status # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # -# modified: gamow.txt +# modified: alice.txt # -$ git checkout -- gamow.txt +$ git checkout -- alice.txt @@ -217,5 +233,49 @@ some situations where the same line of code is edited there is no way a computer h2. Merge Conflicts +We now practise fixing merge conflicts. Recall that conflicts are caused by merges which affect the same block of code. + +Here's a branch I prepared earlier. Run the code below to set it up (don't worry if you can't understand it) +

+$ git branch --track alpher origin/alpher
+Branch alpher set up to track remote branch alpher from origin.
+
+ +You should now have a new branch called alpher. Try merging that branch now and fix the ensuing conflict. + +

+$ git branch
+  alpher
+  exp1
+* master
+$ git merge alpher 
+Auto-merging gamow.txt
+CONFLICT (content): Merge conflict in gamow.txt
+Automatic merge failed; fix conflicts and then commit the result.
+
+$ cat gamow.txt
+<<<<<<< HEAD
+It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis (http://en.wikipedia.org/wiki/Stellar_nucleosynthesis) in stars, a theory largely developed by Bethe.
+=======
+
+http://en.wikipedia.org/wiki/Stellar_nucleosynthesis
+Stellar nucleosynthesis is the collective term for the nuclear reactions taking place in stars to build the nuclei of the elements heavier than hydrogen. Some small quantity of these reactions also occur on the stellar surface under various circumstances. For the creation of elements during the explosion of a star, the term supernova nucleosynthesis is used.
+>>>>>>> alpher
+$ nano gamow.txt   # YOU FIX the conflict here. 
+
+$ git add gamow.txt
+$ git commit -m "Fixed conflict"
+[master f03b09c] Fixed conflict
+
+ +Congratulations. You have fixed the conflict. +You have learnt : +# Clone a repository +# Commit files +# Check status +# Check diff +# Undoing changes +# Branching and merging +# Fixing conflicts From d9edd12bc20089c3f6e11d27bbd34b63534915fd Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sat, 17 Jul 2010 23:52:48 +1200 Subject: [PATCH 03/61] Better diff --- README.textile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.textile b/README.textile index 2d5076f..c449d5e 100644 --- a/README.textile +++ b/README.textile @@ -104,17 +104,14 @@ h2. Basics (II) A very useful command is @git diff@. This is very useful to see exactly what changes you have done.

-$ nano alice.txt   #EDIT the file here
+$ nano alice.txt   # EDIT the file here
 $ git diff
 diff --git a/alice.txt b/alice.txt
-index e39544b..8b89796 100644
+index e69de29..1ac99b8 100644
 --- a/alice.txt
 +++ b/alice.txt
-@@ -1,6 +1,6 @@ 
- This is my first line 
- 
+@@ -0,0 +1 @@
 +This is a new line
-+
 
If you have changed your mind, or wish to organize your commits or staging area differently, Git allows you to do that. From fc03f6ac7083a2f3f1c52ce3e51558e8d20126eb Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sun, 18 Jul 2010 01:17:35 +1200 Subject: [PATCH 04/61] Some fixes to the editorial of the README --- README.textile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.textile b/README.textile index c449d5e..bff99de 100644 --- a/README.textile +++ b/README.textile @@ -49,11 +49,11 @@ branches config description HEAD hooks info objects refs h2. Basics -Now, let's try to adding some files into the project. Create a couple of files. For example, I +Now, let's try adding some files into the project. Create a couple of files. For example, I create two files named @bob.txt@ and @alice.txt@. -In Git, you have to add content to the 'staging area' first by using @git add@ -and then finalizing the process to record it into the git index by using @git commit@ +In Git, you add content to the 'staging area' first by using @git add@ and then +finalizing the process to record it into the git index by using @git commit@ We use @git status@ to determine the status of any changes, whether they are untracked, in the staging area, or committed. @@ -63,6 +63,7 @@ $ git status -s ?? bob.txt +The @??@ means that the files are not indexed by Git yet, or 'untracked'. Now to add the files to the staging area @@ -79,6 +80,7 @@ A alice.txt A bob.txt +The @A@ signifies that the files are now Added to the staging area. You are now ready to commit. The @-m@ flag allows you to enter a message to go with the commit at the same time. @@ -166,7 +168,7 @@ $ git branch The @*@ should indicate the current branch you are on, which is @master@. -If you wish to start another branch: +If you wish to start another branch, use @git branch (new-branch)@ :

 $ git branch exp1
@@ -226,7 +228,8 @@ You always specify the branch you want to merge from, and you have to be in the
 At this point, you can also try out @gitk@ to visualize the changes and various branches
 
 Git is pretty good at merging automagically, even when the same file is edited. There are however, 
-some situations where the same line of code is edited there is no way a computer can figure out how to merge.
+some situations where the same line of code is edited there is no way a computer can figure out how to merge. 
+This will trigger a conflict which you will have to fix. 
 
 h2. Merge Conflicts
 
@@ -265,7 +268,9 @@ $ git commit -m "Fixed conflict"
 [master f03b09c] Fixed conflict
 
-Congratulations. You have fixed the conflict. +Congratulations. You have fixed the conflict. All is good in the world. + +h2. Fin You have learnt : From f9f9a14b95159c84cd7b307eb51411eb0a32fe3e Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sun, 18 Jul 2010 01:24:09 +1200 Subject: [PATCH 05/61] Add license to my work --- README.textile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.textile b/README.textile index bff99de..b2c7551 100644 --- a/README.textile +++ b/README.textile @@ -281,3 +281,7 @@ You have learnt : # Undoing changes # Branching and merging # Fixing conflicts + +This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License +http://creativecommons.org/licenses/by-nc-sa/3.0/ +Author: Thong Kuah From 13bdcd3d711728f1ac148ba7d30cda8266fab165 Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sun, 18 Jul 2010 01:28:01 +1200 Subject: [PATCH 06/61] References --- README.textile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.textile b/README.textile index b2c7551..56441f1 100644 --- a/README.textile +++ b/README.textile @@ -282,6 +282,12 @@ You have learnt : # Branching and merging # Fixing conflicts +h3. References and Further reading +I throughly recommend these resources to continue your Git practice: + +* http://progit.org (buy the book at http://tinyurl.com/amazonprogit) +* http://gitref.org + This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License http://creativecommons.org/licenses/by-nc-sa/3.0/ Author: Thong Kuah From f968d1d0e88351e5427bfd28bdcfc5097fbc63ae Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sun, 18 Jul 2010 01:28:46 +1200 Subject: [PATCH 07/61] Fix formatting and Authorship --- README.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.textile b/README.textile index 56441f1..59e2a09 100644 --- a/README.textile +++ b/README.textile @@ -283,11 +283,13 @@ You have learnt : # Fixing conflicts h3. References and Further reading + I throughly recommend these resources to continue your Git practice: * http://progit.org (buy the book at http://tinyurl.com/amazonprogit) * http://gitref.org +h2. Author This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License http://creativecommons.org/licenses/by-nc-sa/3.0/ Author: Thong Kuah From b8d24f19ed7cad7bc79c0637f58552019129a9c1 Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Sun, 18 Jul 2010 01:29:51 +1200 Subject: [PATCH 08/61] License --- README.textile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.textile b/README.textile index 59e2a09..5fe081e 100644 --- a/README.textile +++ b/README.textile @@ -289,7 +289,10 @@ I throughly recommend these resources to continue your Git practice: * http://progit.org (buy the book at http://tinyurl.com/amazonprogit) * http://gitref.org + + h2. Author + This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License http://creativecommons.org/licenses/by-nc-sa/3.0/ Author: Thong Kuah From 3680eb53078edbc6bda66d6c63974c0cac067979 Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Thu, 22 Jul 2010 12:01:18 +1200 Subject: [PATCH 09/61] Make into real links --- README.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.textile b/README.textile index 5fe081e..0cfca35 100644 --- a/README.textile +++ b/README.textile @@ -286,13 +286,13 @@ h3. References and Further reading I throughly recommend these resources to continue your Git practice: -* http://progit.org (buy the book at http://tinyurl.com/amazonprogit) -* http://gitref.org +* http://progit.org (buy the book at http://tinyurl.com/amazonprogit) +* http://gitref.org h2. Author This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License -http://creativecommons.org/licenses/by-nc-sa/3.0/ +http://creativecommons.org/licenses/by-nc-sa/3.0/ Author: Thong Kuah From 6cf0d4d34dd8022547de4c3896b42ed9cbb7af6f Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Fri, 23 Jul 2010 00:47:14 +1200 Subject: [PATCH 10/61] Adding some explanations about merge conflict syntax and what to do --- README.textile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 0cfca35..cfbf98f 100644 --- a/README.textile +++ b/README.textile @@ -87,7 +87,9 @@ You are now ready to commit. The @-m@ flag allows you to enter a message to go w

 $ git commit -m "I am adding two new files"
 [master 4e7c6cf] I am adding two new files
- 2 files changed, 2 insertions(+), 0 deletions(-)
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+ create mode 100644 alice.txt
+ create mode 100644 bob.txt
 
@@ -261,8 +263,15 @@ It was eventually recognized that most of the heavy elements observed in the pre http://en.wikipedia.org/wiki/Stellar_nucleosynthesis Stellar nucleosynthesis is the collective term for the nuclear reactions taking place in stars to build the nuclei of the elements heavier than hydrogen. Some small quantity of these reactions also occur on the stellar surface under various circumstances. For the creation of elements during the explosion of a star, the term supernova nucleosynthesis is used. >>>>>>> alpher -$ nano gamow.txt # YOU FIX the conflict here. + + +Git uses pretty much standard conflict resolution markers. The top part of the block, which is everything between @<<<<<< HEAD@ and @======@ is what was in your current branch. +The bottom half is the version that is present from the @alpher@ branch. To resolve the conflict, you either choose one side or merge them as you see fit. +For example, I decide to choose the version from the @alpher@ branch. + +

+$ nano gamow.txt   # YOU FIX the conflict here. 
 $ git add gamow.txt
 $ git commit -m "Fixed conflict"
 [master f03b09c] Fixed conflict

From 757ca2651c466ce38df934d0de1f7898213c9eeb Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Fri, 23 Jul 2010 00:49:32 +1200
Subject: [PATCH 11/61] A bit more comments about git conflicts

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index cfbf98f..cfb1e57 100644
--- a/README.textile
+++ b/README.textile
@@ -268,7 +268,7 @@ Stellar nucleosynthesis is the collective term for the nuclear reactions taking
 Git uses pretty much standard conflict resolution markers. The top part of the block, which is everything between @<<<<<< HEAD@ and @======@ is what was in your current branch.
 The bottom half is the version that is present from the @alpher@ branch. To resolve the conflict, you either choose one side or merge them as you see fit.
 
-For example, I decide to choose the version from the @alpher@ branch.
+For example, I decide to choose the version from the @alpher@ branch. Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@.
 
 

 $ nano gamow.txt   # YOU FIX the conflict here. 

From d8fd45c8f93c21216ece6c9635f63dc268240c80 Mon Sep 17 00:00:00 2001
From: Thong Kuah 
Date: Tue, 12 Jul 2011 02:47:44 -0700
Subject: [PATCH 12/61] Added another reference link

---
 README.textile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.textile b/README.textile
index cfb1e57..c3c001c 100644
--- a/README.textile
+++ b/README.textile
@@ -297,6 +297,7 @@ I throughly recommend these resources to continue your Git practice:
 
 * http://progit.org (buy the book at http://tinyurl.com/amazonprogit)
 * http://gitref.org
+* http://www.kernel.org/pub/software/scm/git/docs/everyday.html
 
 
 

From ddb166bbb7842dcf79b2ee765f580aaaa9cbc6de Mon Sep 17 00:00:00 2001
From: Thong Kuah 
Date: Sat, 16 Jul 2011 22:36:24 -0700
Subject: [PATCH 13/61] Update git clone url to http read-only

---
 README.textile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.textile b/README.textile
index c3c001c..a3c503e 100644
--- a/README.textile
+++ b/README.textile
@@ -1,6 +1,6 @@
 h2. Setup
 
-Some house-cleaning here. We assume of course you have Git installed, (hopefully >= 1.6.0).
+Some house-cleaning here. We assume of course you have Git installed, (hopefully >= 1.7.0).
 
 First thing to do is to setup your identity. This identifies you to other people who download the project.
 
@@ -25,7 +25,7 @@ h2. Start
 First, clone this repository:
 
 

-$ git clone git://github.com/kuahyeow/git-workshop.git
+$ git clone https://github.com/kuahyeow/git-workshop.git
 Initialized empty Git repository in /home/kuahyeow/git-workshop/.git/
 remote: Counting objects: 17, done.
 remote: Compressing objects: 100% (11/11), done.

From c47b56ae867f216bda3d8029987f4caf8e98229e Mon Sep 17 00:00:00 2001
From: Thong Kuah 
Date: Sat, 16 Jul 2011 23:55:42 -0700
Subject: [PATCH 14/61] git clone - updated

---
 README.textile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/README.textile b/README.textile
index a3c503e..0d35032 100644
--- a/README.textile
+++ b/README.textile
@@ -32,14 +32,16 @@ remote: Compressing objects: 100% (11/11), done.
 remote: Total 17 (delta 4), reused 0 (delta 0)
 Receiving objects: 100% (17/17), done.
 Resolving deltas: 100% (4/4), done.
-$ cd git-workshop
-$ ls
 
+Once you have cloned your repository, you should now see a directory called @git-workshop@. This is your @working directory@ -Once you have cloned your repository, you should see your projects files. +

+$ cd git-workshop
+$ ls
+
-You should also see the @.git@ subdirectory. This is where all your repository's data and history is kept +For the curious, you should also see the @.git@ subdirectory. This is where all your repository's data and history is kept.

 $ ls -a .git

From 0b8cf4c57d01b8925145631d6f473b3e01e3a526 Mon Sep 17 00:00:00 2001
From: Thong Kuah 
Date: Sat, 16 Jul 2011 23:59:09 -0700
Subject: [PATCH 15/61] Added more explicit instruction

---
 README.textile | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/README.textile b/README.textile
index 0d35032..9b41b97 100644
--- a/README.textile
+++ b/README.textile
@@ -54,8 +54,11 @@ h2. Basics
 Now, let's try adding some files into the project. Create a couple of files. For example, I
 create two files named @bob.txt@ and @alice.txt@.
 
-In Git, you add content to the 'staging area' first by using @git add@ and then 
-finalizing the process to record it into the git index by using @git commit@
+
+
+In your working directory, create two files named alice.txt and bob.txt
+
+
We use @git status@ to determine the status of any changes, whether they are untracked, in the staging area, or committed. @@ -65,6 +68,9 @@ $ git status -s ?? bob.txt
+In Git, you add content to the 'staging area' first by using @git add@ and then +finalizing the process to record it into the git index by using @git commit@ + The @??@ means that the files are not indexed by Git yet, or 'untracked'. Now to add the files to the staging area @@ -73,7 +79,6 @@ Now to add the files to the staging area $ git add alice.txt bob.txt
- Try running @git status -s@ again to see what's changed.


From f660090f0cec7e896a254e1ec1517eea152a4d0b Mon Sep 17 00:00:00 2001
From: Thong Kuah 
Date: Sun, 17 Jul 2011 00:13:03 -0700
Subject: [PATCH 16/61] simplify first part - pare it down to just add and
 commit

---
 README.textile | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/README.textile b/README.textile
index 9b41b97..fc0cfe7 100644
--- a/README.textile
+++ b/README.textile
@@ -60,35 +60,15 @@ In your working directory, create two files named alice.txt and bob.txt
 
 
-We use @git status@ to determine the status of any changes, whether they are untracked, in the staging area, or committed. - -

-$ git status -s
-?? alice.txt
-?? bob.txt
-
- In Git, you add content to the 'staging area' first by using @git add@ and then finalizing the process to record it into the git index by using @git commit@ -The @??@ means that the files are not indexed by Git yet, or 'untracked'. - Now to add the files to the staging area

 $ git add alice.txt bob.txt
 
-Try running @git status -s@ again to see what's changed. - -

-$ git status -s
-A  alice.txt
-A  bob.txt
-
- -The @A@ signifies that the files are now Added to the staging area. - You are now ready to commit. The @-m@ flag allows you to enter a message to go with the commit at the same time.

@@ -100,16 +80,6 @@ $ git commit -m "I am adding two new files"
 
-On a final note, if you try @git status@ now you will see the following: - -

-$ git status
-On branch master
-nothing to commit (working directory clean) 
-
- -You should always aim for this state. - h2. Basics (II) A very useful command is @git diff@. This is very useful to see exactly what changes you have done. From 9772dfc652497bebcccaec057b7482f8b884969d Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Sun, 17 Jul 2011 00:25:16 -0700 Subject: [PATCH 17/61] added git log and git show section --- README.textile | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/README.textile b/README.textile index fc0cfe7..7f56f8e 100644 --- a/README.textile +++ b/README.textile @@ -19,7 +19,7 @@ $ git config --global core.editor emacs
-h2. Start +h2. Starting your journey First, clone this repository: @@ -49,7 +49,7 @@ branches config description HEAD hooks info objects refs -h2. Basics +h2. Adding new files Now, let's try adding some files into the project. Create a couple of files. For example, I create two files named @bob.txt@ and @alice.txt@. @@ -79,8 +79,39 @@ $ git commit -m "I am adding two new files" create mode 100644 bob.txt +h2. Let's see what just happened + +We should now have a new commit. To see all the commits so far, use @git log@ + +

+$ git log
+
+ +The log should show all commits listed from most recent first to least recent. You would see various information like the name of the author, the date it was commited, a commit SHA number, and the message for the commit. + +You should also see your most recent commit, where you added the two new files in the previous section. However git log does not show the files involved in each commit. To view more information about a commit, use @git show@. + +

+$ git show
+
+commit 5a1fad96c8584b2c194c229de7e112e4c84e5089
+Author: kuahyeow 
+Date:   Sun Jul 17 19:13:42 2011 +1200
+
+    I am adding two new files
+
+diff --git a/alice.txt b/alice.txt
+new file mode 100644
+index 0000000..e69de29
+diff --git a/bob.txt b/bob.txt
+new file mode 100644
+index 0000000..e69de29
+
+ + +h2. Adding more files and changes + -h2. Basics (II) A very useful command is @git diff@. This is very useful to see exactly what changes you have done. From 996cdf7e78f6b5bf9cbe7956536ab3f542ee9648 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Sun, 17 Jul 2011 00:51:55 -0700 Subject: [PATCH 18/61] Simplified git commit section, and added reset --- README.textile | 88 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/README.textile b/README.textile index 7f56f8e..1594fa8 100644 --- a/README.textile +++ b/README.textile @@ -60,7 +60,7 @@ In your working directory, create two files named alice.txt and bob.txt -In Git, you add content to the 'staging area' first by using @git add@ and then +In Git, you add content to the @staging area@ first by using @git add@ and then finalizing the process to record it into the git index by using @git commit@ Now to add the files to the staging area @@ -109,63 +109,81 @@ index 0000000..e69de29 -h2. Adding more files and changes +h2. Adding more changes and backing out +In this section, we are going to add more changes, and try to recover from mistakes. +Be forewarned, this next step is going to be hard. We will need to add some content to alice.txt. -A very useful command is @git diff@. This is very useful to see exactly what changes you have done. +
+Open alice.txt and type in something, anything. 
+
+e.g. Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
+
+Then save.
+
+
+ +So we have updated @alice.txt@ and we wish to commit it to our @repository@. + +What did we change? A very useful command is @git diff@. This is very useful to see exactly what changes you have done.

-$ nano alice.txt   # EDIT the file here
 $ git diff
+
 diff --git a/alice.txt b/alice.txt
-index e69de29..1ac99b8 100644
+index e69de29..2aedcab 100644
 --- a/alice.txt
 +++ b/alice.txt
 @@ -0,0 +1 @@
-+This is a new line
++Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
+
 
-If you have changed your mind, or wish to organize your commits or staging area differently, Git allows you to do that. -Say, you edited @alice.txt@ and added it to the staging area, and then do not wish to proceed. Here's how to undo adding files to the staging area. +Now let's add our updated file to the staging area -

-$ git status -s
- M alice.txt 
-$ git add alice.txt
-$ git status
-# On branch master
-# Changes to be committed:
-#   (use "git reset HEAD ..." to unstage)
-#
-#	modified:   alice.txt
-#
-$ git reset HEAD alice.txt
-Unstaged changes after reset:
-M	alice.txt
-
+
+
+Add @alice.txt@ to the staging area. (Ask for help if you are stumped)
+
+
+ +
+
+Now, check the @status@ of @alice.txt@. Is it in the staging area now?
+
+
 
 
-Say, you now realise you do not want your changes now at all, and wish to revert back to the file back before when you started editing it.
-This happens a lot especially when dealing with complicated code. Fortunately, the command to check for status actually tells you how to do it.
+Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of a staging area is to enable us to back out before we commit - which is a bit harder to back out of. Here's how to back out of the staging area :
 
 

-$ git status
-# On branch master
-# Changed but not updated:
-#   (use "git add ..." to update what will be committed)
-#   (use "git checkout -- ..." to discard changes in working directory)
-#
-#	modified:   alice.txt
-#
-$ git checkout -- alice.txt
 
- You have now un-done your changes. +And then commit our file to the repository + +
+
+Commit your changes with the message "Added Lorem Ipsum to alice.txt as requested" (Ask for help if needed)
+
+
+ +Did you manage to commit your changes? Try using @git log@ or @git show@ to verify that your last commit was "Added Lorem Ipsum to alice.txt as requested". + +
+
+Verify that your last commit in the git log
+
+
+ + + + + h2. Branching and merging Creating a branch in Git is easy. The @git branch@ command, used by itself will list the branches you currently have From 107bcff1aa64eef2d96f0aeceea1917f5a91d947 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Sun, 17 Jul 2011 01:15:11 -0700 Subject: [PATCH 19/61] added reset instructions --- README.textile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 1594fa8..c98841e 100644 --- a/README.textile +++ b/README.textile @@ -153,12 +153,17 @@ Add @alice.txt@ to the staging area. (Ask for help if you are stumped) Now, check the @status@ of @alice.txt@. Is it in the staging area now? -
+
Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of a staging area is to enable us to back out before we commit - which is a bit harder to back out of. Here's how to back out of the staging area :

+$ git reset HEAD alice.txt
+
+Unstaged changes after reset:
+M	alice.txt
+
 
You have now un-done your changes. From 8a167271eb6a3620b68bcf4f0142df1112e08582 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Sun, 17 Jul 2011 01:31:20 -0700 Subject: [PATCH 20/61] Complete reset instructions --- README.textile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.textile b/README.textile index c98841e..49a4470 100644 --- a/README.textile +++ b/README.textile @@ -141,7 +141,7 @@ index e69de29..2aedcab 100644
-Now let's add our updated file to the staging area +Now let's add our modified file to the staging area
 
@@ -166,25 +166,23 @@ M	alice.txt
 
 
-You have now un-done your changes. - - -And then commit our file to the repository +Your staging area should now be empty. What's happened to the Lorem Ipsum changes? It's still there. We are now back to the state just before we added this file to staging area.
 
-Commit your changes with the message "Added Lorem Ipsum to alice.txt as requested" (Ask for help if needed)
+What do we call this state?
 
 
-Did you manage to commit your changes? Try using @git log@ or @git show@ to verify that your last commit was "Added Lorem Ipsum to alice.txt as requested". +To undo your changes entirely, we use @git checkout@, like so: -
+

 
-Verify that your last commit in the git log
+$ git checkout alice.txt
 
-
+
+You have now un-done your changes. From e0381ce1a84fe0aa40849b2eda6cc4789579ad4b Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Sun, 17 Jul 2011 01:50:23 -0700 Subject: [PATCH 21/61] branching instructions --- README.textile | 56 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/README.textile b/README.textile index 49a4470..5ea6028 100644 --- a/README.textile +++ b/README.textile @@ -182,23 +182,22 @@ $ git checkout alice.txt
-You have now un-done your changes. +You have now un-done your changes. Your file is now empty - -h2. Branching and merging +h2. Branching Creating a branch in Git is easy. The @git branch@ command, used by itself will list the branches you currently have

 $ git branch
+
 * master
 
The @*@ should indicate the current branch you are on, which is @master@. - If you wish to start another branch, use @git branch (new-branch)@ :

@@ -212,11 +211,14 @@ The new branch is now created. Now let's work in that branch. To switch to the n
 
 

 $ git checkout exp1
+
 Switched to branch 'exp1'
 
+@git checkout (branch)@ is used to switch branches. -@git checkout (branch)@ is used to switch branches. Let's perform some commits now, + +Let's perform some commits now,

 $ echo 'some content' > test.txt
@@ -227,21 +229,49 @@ $ git commit -m "Added experimental txt"
  create mode 100644 test.txt
 
-Now, let's compare them to the master branch +Now, let's compare them to the master branch. Use @git diff@ + +

+$ git diff master
+
+diff --git a/test.txt b/test.txt
+new file mode 100644
+index 0000000..2ef267e
+--- /dev/null
++++ b/test.txt
+@@ -0,0 +1 @@
++some content
+
+ +Basically what the above output says is that test.txt is present on the @exp1@ branch, but is absent on the @master@ branch. + + +Git is good enough to handle your files when you switch between branches. Switch back to the @master@ branch + +
+
+Switch back to the master branch (Hint: It's the same command we used to switch the the exp1 branch above)
+
+
+ +Now, where's our @test.txt@ file ?

 $ ls
-gamow.txt  README.textile  test.txt
-$ git checkout master
-Switched to branch 'master'
-$ ls
-gamow.txt  README.textile
+README.textile	alice.txt	bob.txt		gamow.txt
 
- -As you can see the new file you created in the other branch has dissappeared. Not to worry, they are safely tucked away, +As you can see the new file you created in the other branch has disappeared. Not to worry, they are safely tucked away, and will re-appear when you switch back to that branch. +
+
+Switch back to the exp1 branch, and check that the test.txt is now present.
+
+
+ + +h2. Merging We now try out merging. Eventually you will want to merge two branches together after the conclusion of work. @git merge@ allows you to do that. To merge the @exp1@ branch into @master@ From 6bac854b584c553b8731485babce33089ecd31eb Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Sun, 17 Jul 2011 02:16:09 -0700 Subject: [PATCH 22/61] Merge instructions and conflict resolution --- README.textile | 56 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/README.textile b/README.textile index 5ea6028..fc39f13 100644 --- a/README.textile +++ b/README.textile @@ -274,7 +274,17 @@ Switch back to the exp1 branch, and check that the test.txt is now present. h2. Merging We now try out merging. Eventually you will want to merge two branches together after the conclusion of work. -@git merge@ allows you to do that. To merge the @exp1@ branch into @master@ +@git merge@ allows you to do that. + +First, make sure you are on the @master@ branch. + +
+
+Switch to the master branch if you haven't already
+
+
+ +To merge the @exp1@ branch into @master@

 $ git merge exp1
@@ -286,7 +296,7 @@ Merge made by recursive.
 
 You always specify the branch you want to merge from, and you have to be in the branch you want merge into.
 
-At this point, you can also try out @gitk@ to visualize the changes and various branches
+At this point, you can also try out @gitk@ to visualize the changes and how the two branches have merged
 
 Git is pretty good at merging automagically, even when the same file is edited. There are however, 
 some situations where the same line of code is edited there is no way a computer can figure out how to merge. 
@@ -296,24 +306,37 @@ h2. Merge Conflicts
 
 We now practise fixing merge conflicts. Recall that conflicts are caused by merges which affect the same block of code.
 
-Here's a branch I prepared earlier. Run the code below to set it up (don't worry if you can't understand it)
+Here's a branch I prepared earlier. The branch is called @alpher@. Run the code below to set it up (don't worry if you can't understand it)
 

-$ git branch --track alpher origin/alpher
+$ git checkout alpher
+
 Branch alpher set up to track remote branch alpher from origin.
+Switched to a new branch 'alpher'
 
-You should now have a new branch called alpher. Try merging that branch now and fix the ensuing conflict. +You should now have a new branch called alpher. Try merging that branch into master now and fix the ensuing conflict. + +
+
+Merge the @alper@ branch into @master (as you did when you merged exp1 into master) (Ask for help if stumped)
+
+
+ + +You should see a @conflict@ with the gamow.txt file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation

-$ git branch
-  alpher
-  exp1
-* master
-$ git merge alpher 
+ 
 Auto-merging gamow.txt
 CONFLICT (content): Merge conflict in gamow.txt
 Automatic merge failed; fix conflicts and then commit the result.
 
+
+ +If you open the @gamow.txt@ file, you will see something similar as below: + +
+
 $ cat gamow.txt
 <<<<<<< HEAD
 It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis (http://en.wikipedia.org/wiki/Stellar_nucleosynthesis) in stars, a theory largely developed by Bethe.
@@ -322,15 +345,22 @@ It was eventually recognized that most of the heavy elements observed in the pre
 http://en.wikipedia.org/wiki/Stellar_nucleosynthesis
 Stellar nucleosynthesis is the collective term for the nuclear reactions taking place in stars to build the nuclei of the elements heavier than hydrogen. Some small quantity of these reactions also occur on the stellar surface under various circumstances. For the creation of elements during the explosion of a star, the term supernova nucleosynthesis is used.
 >>>>>>> alpher
-
+
Git uses pretty much standard conflict resolution markers. The top part of the block, which is everything between @<<<<<< HEAD@ and @======@ is what was in your current branch. The bottom half is the version that is present from the @alpher@ branch. To resolve the conflict, you either choose one side or merge them as you see fit. -For example, I decide to choose the version from the @alpher@ branch. Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@. +For example, I might decide to choose the version from the @alpher@ branch. + +
+
+Fix the merge conflict. Pick the text that you think is better (Ask for help if stumped)
+
+
+ +Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@.

-$ nano gamow.txt   # YOU FIX the conflict here. 
 $ git add gamow.txt
 $ git commit -m "Fixed conflict"
 [master f03b09c] Fixed conflict

From 80442fd0fb586aa7367e43e918eb9351729bf4c2 Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 09:31:06 +1200
Subject: [PATCH 23/61] Uses a mail analogy.. not sure if useful

---
 README.textile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/README.textile b/README.textile
index fc39f13..0396354 100644
--- a/README.textile
+++ b/README.textile
@@ -60,10 +60,11 @@ In your working directory, create two files named alice.txt and bob.txt
 
 
-In Git, you add content to the @staging area@ first by using @git add@ and then -finalizing the process to record it into the git index by using @git commit@ +Let's use a mail analogy. -Now to add the files to the staging area +In Git, you first add content to the @staging area@ by using @git add@. This is like putting the stuff you want to send into a cardboard box. You finalize the process and record it into the git index by using @git commit@. This is like sealing the box - it's now ready to send. + +Let's add the files to the staging area

 $ git add alice.txt bob.txt

From 3d7dd6efcd6de5d33800c07a647e5b61f9a5c5da Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 09:39:10 +1200
Subject: [PATCH 24/61] Fixes some @s in the wrong places

---
 README.textile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.textile b/README.textile
index 0396354..513cb99 100644
--- a/README.textile
+++ b/README.textile
@@ -146,13 +146,13 @@ Now let's add our modified file to the staging area
 
 
 
-Add @alice.txt@ to the staging area. (Ask for help if you are stumped)
+Add alice.txt to the staging area. (Ask for help if you are stumped)
 
 
 
-Now, check the @status@ of @alice.txt@. Is it in the staging area now?
+Now, check the status of alice.txt. Is it in the staging area now?
 
 
From e062f66409884a7686a8347da396c110d1fc02e9 Mon Sep 17 00:00:00 2001 From: Nick Malcolm Date: Mon, 18 Jul 2011 09:40:20 +1200 Subject: [PATCH 25/61] Mail analogy again --- README.textile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 513cb99..a92d3d2 100644 --- a/README.textile +++ b/README.textile @@ -157,7 +157,9 @@ Now, check the status of alice.txt. Is it in the staging area now?
-Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of a staging area is to enable us to back out before we commit - which is a bit harder to back out of. Here's how to back out of the staging area : +Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of a staging area is to enable us to back out before we commit - which is a bit harder to back out of. Remembering the mail analogy - it's easier to take mail out of the cardboard box before you seal it than after. + +Here's how to back out of the staging area :

 $ git reset HEAD alice.txt

From b8ef8d86c9c368019145b31bd4b30c0424f13e1d Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 09:41:47 +1200
Subject: [PATCH 26/61] Grammar tweak

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index a92d3d2..57922b0 100644
--- a/README.textile
+++ b/README.textile
@@ -191,7 +191,7 @@ You have now un-done your changes. Your file is now empty
 
 h2. Branching
 
-Creating a branch in Git is easy. The @git branch@ command, used by itself will list the branches you currently have
+Creating a branch in Git is easy. The @git branch@ command, when used by itself, will list the branches you currently have
 
 

 $ git branch

From 82caf1302aceea18a7eb1cec0e1f673ce7568b6e Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 09:43:36 +1200
Subject: [PATCH 27/61] Makes variable a bit clearer

---
 README.textile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.textile b/README.textile
index 57922b0..d71ef73 100644
--- a/README.textile
+++ b/README.textile
@@ -201,7 +201,7 @@ $ git branch
 
 The @*@ should indicate the current branch you are on, which is @master@.
 
-If you wish to start another branch, use @git branch (new-branch)@ :
+If you wish to start another branch, use @git branch (new-branch-name)@ :
 
 

 $ git branch exp1
@@ -218,7 +218,7 @@ $ git checkout exp1
 Switched to branch 'exp1'
 
-@git checkout (branch)@ is used to switch branches. +@git checkout (branch-name)@ is used to switch branches. Let's perform some commits now, From 37e11a77aa777f9c7451a7fc2d307bd7a1d21df9 Mon Sep 17 00:00:00 2001 From: Nick Malcolm Date: Mon, 18 Jul 2011 09:53:29 +1200 Subject: [PATCH 28/61] Adds a description of what a branch actually is --- README.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.textile b/README.textile index d71ef73..2549842 100644 --- a/README.textile +++ b/README.textile @@ -191,6 +191,8 @@ You have now un-done your changes. Your file is now empty h2. Branching +Most large code bases have at least two branches - a 'live' branch and a 'development' branch. The live branch is code which is OK to be deployed on to a website, or downloaded by customers. The development branch allows developers to work on features which might not be bug free. Only once everyone is happy with the development branch would it be merged with the live branch. + Creating a branch in Git is easy. The @git branch@ command, when used by itself, will list the branches you currently have


From 5f5776c2d28ae1143c4ed82d95103a9689ae701c Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 09:59:53 +1200
Subject: [PATCH 29/61] Formatting

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index 2549842..720dc3c 100644
--- a/README.textile
+++ b/README.textile
@@ -248,7 +248,7 @@ index 0000000..2ef267e
 +some content
 
-Basically what the above output says is that test.txt is present on the @exp1@ branch, but is absent on the @master@ branch. +Basically what the above output says is that @test.txt@ is present on the @exp1@ branch, but is absent on the @master@ branch. Git is good enough to handle your files when you switch between branches. Switch back to the @master@ branch From ef961c9f1a41ef2d157b82763922a35b88d20bb7 Mon Sep 17 00:00:00 2001 From: Nick Malcolm Date: Mon, 18 Jul 2011 10:00:25 +1200 Subject: [PATCH 30/61] Grammar --- README.textile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 720dc3c..2a7dad0 100644 --- a/README.textile +++ b/README.textile @@ -266,8 +266,7 @@ $ ls README.textile alice.txt bob.txt gamow.txt
-As you can see the new file you created in the other branch has disappeared. Not to worry, they are safely tucked away, -and will re-appear when you switch back to that branch. +As you can see the new file you created in the other branch has disappeared. Not to worry, it is safely tucked away, and will re-appear when you switch back to that branch.
 

From de6508c2e0d2d98cdce6b841f7e9e274c2c98fb2 Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 10:03:39 +1200
Subject: [PATCH 31/61] Formatting

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index 2a7dad0..106de2b 100644
--- a/README.textile
+++ b/README.textile
@@ -322,7 +322,7 @@ You should now have a new branch called alpher. Try merging that branch into mas
 
 
 
-Merge the @alper@ branch into @master (as you did when you merged exp1 into master) (Ask for help if stumped)
+Merge the alpher branch into master (as you did when you merged exp1 into master) (Ask for help if stumped)
 
 
From df2f553627eb08bf14c3803c53ccf75fc294dc2a Mon Sep 17 00:00:00 2001 From: Nick Malcolm Date: Mon, 18 Jul 2011 10:09:15 +1200 Subject: [PATCH 32/61] Linkifies some text --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 106de2b..71e0f85 100644 --- a/README.textile +++ b/README.textile @@ -390,7 +390,7 @@ I throughly recommend these resources to continue your Git practice: * http://progit.org (buy the book at http://tinyurl.com/amazonprogit) * http://gitref.org -* http://www.kernel.org/pub/software/scm/git/docs/everyday.html +* http://www.kernel.org/pub/software/scm/git/docs/everyday.html From 0aeb5fe90d9d3eb7cb4171bc2f5fdf5cdd6d227c Mon Sep 17 00:00:00 2001 From: Nick Malcolm Date: Mon, 18 Jul 2011 10:09:38 +1200 Subject: [PATCH 33/61] Adds contributors to Author section --- README.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/README.textile b/README.textile index 71e0f85..6af834e 100644 --- a/README.textile +++ b/README.textile @@ -399,3 +399,4 @@ h2. Author This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License http://creativecommons.org/licenses/by-nc-sa/3.0/ Author: Thong Kuah +Contributors: Nick Malcolm From 2964f2d77069ce457d4e2b7f461ec0f9a8dc52f2 Mon Sep 17 00:00:00 2001 From: Nick Malcolm Date: Mon, 18 Jul 2011 10:10:33 +1200 Subject: [PATCH 34/61] Formatting --- README.textile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 6af834e..81a2e60 100644 --- a/README.textile +++ b/README.textile @@ -51,8 +51,7 @@ branches config description HEAD hooks info objects refs h2. Adding new files -Now, let's try adding some files into the project. Create a couple of files. For example, I -create two files named @bob.txt@ and @alice.txt@. +Now, let's try adding some files into the project. Create a couple of files. For example, I create two files named @bob.txt@ and @alice.txt@.
 

From bcd24a2be730561afa80fdfb28be82e6011f19ad Mon Sep 17 00:00:00 2001
From: Nick Malcolm 
Date: Mon, 18 Jul 2011 10:14:04 +1200
Subject: [PATCH 35/61] More formatting

---
 README.textile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/README.textile b/README.textile
index 81a2e60..f688590 100644
--- a/README.textile
+++ b/README.textile
@@ -301,8 +301,7 @@ You always specify the branch you want to merge from, and you have to be in the
 
 At this point, you can also try out @gitk@ to visualize the changes and how the two branches have merged
 
-Git is pretty good at merging automagically, even when the same file is edited. There are however, 
-some situations where the same line of code is edited there is no way a computer can figure out how to merge. 
+Git is pretty good at merging automagically, even when the same file is edited. There are however, some situations where the same line of code is edited there is no way a computer can figure out how to merge. 
 This will trigger a conflict which you will have to fix. 
 
 h2. Merge Conflicts
@@ -317,7 +316,7 @@ Branch alpher set up to track remote branch alpher from origin.
 Switched to a new branch 'alpher'
 
-You should now have a new branch called alpher. Try merging that branch into master now and fix the ensuing conflict. +You should now have a new branch called @alpher@. Try merging that branch into @master@ now and fix the ensuing conflict.
 
@@ -326,7 +325,7 @@ Merge the alpher branch into master (as you did when you merged exp1 into master
 
-You should see a @conflict@ with the gamow.txt file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation +You should see a @conflict@ with the @gamow.txt@ file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation

  

From 1ffa0db86a8df5b6a951ca80e81ae0534b032aab Mon Sep 17 00:00:00 2001
From: Thong Kuah 
Date: Sat, 6 Aug 2011 13:08:03 +1200
Subject: [PATCH 36/61] use http version of git clone url

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index f688590..e34aef7 100644
--- a/README.textile
+++ b/README.textile
@@ -25,7 +25,7 @@ h2. Starting your journey
 First, clone this repository:
 
 

-$ git clone https://github.com/kuahyeow/git-workshop.git
+$ git clone http://github.com/kuahyeow/git-workshop.git
 Initialized empty Git repository in /home/kuahyeow/git-workshop/.git/
 remote: Counting objects: 17, done.
 remote: Compressing objects: 100% (11/11), done.

From 141cf05b7c49566168b9b6e539ecea5c3ae25a6a Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Mon, 23 Jul 2012 23:53:19 +1200
Subject: [PATCH 37/61] Update some links

---
 README.textile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index e34aef7..4cf3ca4 100644
--- a/README.textile
+++ b/README.textile
@@ -25,7 +25,7 @@ h2. Starting your journey
 First, clone this repository:
 
 

-$ git clone http://github.com/kuahyeow/git-workshop.git
+$ git clone https://github.com/kuahyeow/git-workshop.git
 Initialized empty Git repository in /home/kuahyeow/git-workshop/.git/
 remote: Counting objects: 17, done.
 remote: Compressing objects: 100% (11/11), done.
@@ -386,6 +386,7 @@ h3. References and Further reading
 
 I throughly recommend these resources to continue your Git practice:
 
+*  Another beginners tutorial for git
 * http://progit.org (buy the book at http://tinyurl.com/amazonprogit)
 * http://gitref.org
 * http://www.kernel.org/pub/software/scm/git/docs/everyday.html

From 3e1d1f8e8eb81f6ab859c320dccc7284f8755362 Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Tue, 24 Jul 2012 00:17:24 +1200
Subject: [PATCH 38/61] Fix link

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index 4cf3ca4..c8986d0 100644
--- a/README.textile
+++ b/README.textile
@@ -386,7 +386,7 @@ h3. References and Further reading
 
 I throughly recommend these resources to continue your Git practice:
 
-*  Another beginners tutorial for git
+* http://try.github.com Another beginners tutorial for git
 * http://progit.org (buy the book at http://tinyurl.com/amazonprogit)
 * http://gitref.org
 * http://www.kernel.org/pub/software/scm/git/docs/everyday.html

From c9fa7b471396948ab48a75ea0415d4e30eb166bd Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Tue, 24 Jul 2012 00:16:04 +1200
Subject: [PATCH 39/61] Add Part II - forking, push and pulling

---
 README.textile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/README.textile b/README.textile
index c8986d0..7f1c6d6 100644
--- a/README.textile
+++ b/README.textile
@@ -1,3 +1,9 @@
+h1. What is Git ?
+
+Git is a _distributed_ *version control* system [1]
+
+[1] http://git-scm.com/about
+
 h2. Setup
 
 Some house-cleaning here. We assume of course you have Git installed, (hopefully >= 1.7.0).
@@ -370,6 +376,7 @@ $ git commit -m "Fixed conflict"
 
 Congratulations. You have fixed the conflict. All is good in the world.
 
+
 h2. Fin
 
 You have learnt :
@@ -382,6 +389,49 @@ You have learnt :
 # Branching and merging
 # Fixing conflicts
 
+
+h1. Part II
+
+h2. GitHub
+
+But, wait. There's more. What about this distributed sharing thing with Git ?
+
+To be able to share, we'll need a server to host our git repositiories. GitHub (github.com) is probably the easiest place to begin with.
+
+h2. Login or sign up with GitHub
+
+Go sign up for an account at GitHub; Or login into your GitHub account if you had previously signed up.
+
+Hint: You may need to setup git cache your GitHub password - see https://help.github.com/articles/set-up-git
+
+Then come back here, we'll wait.
+
+h2. Create your first GitHub repository
+
+A repository (repo) is a place where you would store your code. You were practising on your very own repo just now in Part 1!
+
+The following  tutorial will show you how to create a GitHub repo - which you can then share with others
+
+Then come back here, we'll wait.
+
+h2. Fork a repo
+
+Go to this tutorial
+
+Then come back here, we'll wait.
+
+h2. Let's collaborate !
+
+...
+
+h2. Fin
+
+You have learnt:
+
+# Forking a repo at GitHub
+# Git push
+# Git pull
+
 h3. References and Further reading
 
 I throughly recommend these resources to continue your Git practice:

From 79943e14b8e49e5eac51f154273527bae4521da9 Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Tue, 24 Jul 2012 01:51:00 +1200
Subject: [PATCH 40/61] Removed un-nessacary shell output, cleaned up code to
 run, and added far more section headers for clarity

---
 README.textile | 186 +++++++++++++++++++++++--------------------------
 1 file changed, 88 insertions(+), 98 deletions(-)

diff --git a/README.textile b/README.textile
index 7f1c6d6..ff41cae 100644
--- a/README.textile
+++ b/README.textile
@@ -32,12 +32,6 @@ First, clone this repository:
 
 

 $ git clone https://github.com/kuahyeow/git-workshop.git
-Initialized empty Git repository in /home/kuahyeow/git-workshop/.git/
-remote: Counting objects: 17, done.
-remote: Compressing objects: 100% (11/11), done.
-remote: Total 17 (delta 4), reused 0 (delta 0)
-Receiving objects: 100% (17/17), done.
-Resolving deltas: 100% (4/4), done.
 
Once you have cloned your repository, you should now see a directory called @git-workshop@. This is your @working directory@ @@ -47,15 +41,23 @@ $ cd git-workshop $ ls
+[?] Stuck? ask for help from the workshop staff + + For the curious, you should also see the @.git@ subdirectory. This is where all your repository's data and history is kept.

 $ ls -a .git
+
+ +You will see : + +
 branches  config  description  HEAD  hooks  info  objects  refs
-
+
-h2. Adding new files +h2. The staging area Now, let's try adding some files into the project. Create a couple of files. For example, I create two files named @bob.txt@ and @alice.txt@. @@ -75,16 +77,17 @@ Let's add the files to the staging area $ git add alice.txt bob.txt
+h2. Committing + You are now ready to commit. The @-m@ flag allows you to enter a message to go with the commit at the same time.

 $ git commit -m "I am adding two new files"
-[master 4e7c6cf] I am adding two new files
- 0 files changed, 0 insertions(+), 0 deletions(-)
- create mode 100644 alice.txt
- create mode 100644 bob.txt
 
+[?] Stuck? ask for help from the workshop staff + + h2. Let's see what just happened We should now have a new commit. To see all the commits so far, use @git log@ @@ -99,7 +102,11 @@ You should also see your most recent commit, where you added the two new files i

 $ git show
+
+You should see something similar to: + +
 commit 5a1fad96c8584b2c194c229de7e112e4c84e5089
 Author: kuahyeow 
 Date:   Sun Jul 17 19:13:42 2011 +1200
@@ -112,55 +119,52 @@ index 0000000..e69de29
 diff --git a/bob.txt b/bob.txt
 new file mode 100644
 index 0000000..e69de29
-
+
+ +[?] Stuck? ask for help from the workshop staff -h2. Adding more changes and backing out +h2. A necessary digression In this section, we are going to add more changes, and try to recover from mistakes. Be forewarned, this next step is going to be hard. We will need to add some content to alice.txt. -
-Open alice.txt and type in something, anything. 
+Open @alice.txt@ and type in your favourite line from a song, or:
 
 e.g. Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
 
-Then save.
-
-
+Then *save* the file -So we have updated @alice.txt@ and we wish to commit it to our @repository@. +So now, we have updated @alice.txt@ and we wish to commit it to our @repository@. What did we change? A very useful command is @git diff@. This is very useful to see exactly what changes you have done.

 $ git diff
+
+You should see something like the following: +
 diff --git a/alice.txt b/alice.txt
 index e69de29..2aedcab 100644
 --- a/alice.txt
 +++ b/alice.txt
 @@ -0,0 +1 @@
 +Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
+
-
- - -Now let's add our modified file to the staging area - -
-
-Add alice.txt to the staging area. (Ask for help if you are stumped)
+[?] Stuck? ask for help from the workshop staff
 
-
+h2. Staging area again -
+Now let's add our modified file, @alice.txt@ to the staging area. Do you remember how ?
 
-Now, check the status of alice.txt. Is it in the staging area now?
+Next, check the @status@ of @alice.txt@. Is it in the staging area now?
 
-
+[?] Stuck? ask for help from the workshop staff +h2. Undoing Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of a staging area is to enable us to back out before we commit - which is a bit harder to back out of. Remembering the mail analogy - it's easier to take mail out of the cardboard box before you seal it than after. @@ -168,30 +172,32 @@ Here's how to back out of the staging area :

 $ git reset HEAD alice.txt
+
+
 Unstaged changes after reset:
 M	alice.txt
+
-
+Compare the @git status@ now to the git status from the previous section. How does it differ? -Your staging area should now be empty. What's happened to the Lorem Ipsum changes? It's still there. We are now back to the state just before we added this file to staging area. +[?] Stuck? ask for help from the workshop staff -
+Your staging area should now be empty. What's happened to the Lorem Ipsum changes? It's still there. We are now back to the state just before we added this file to staging area. Going back to the mail analogy, we just took our letter out of the box.
 
-What do we call this state?
+h2. Undoing II
 
-
+Sometimes we did not like what we have done and we wish to go back to the last _recorded_ state. In this case, we wish to go back to the state just before we added the Lorrem ipsum text to @alice.txt@. -To undo your changes entirely, we use @git checkout@, like so: +To accomplish this, we use @git checkout@, like so:

-
 $ git checkout alice.txt
-
 
-You have now un-done your changes. Your file is now empty +You have now un-done your changes. Your file is now empty. +[?] Stuck? ask for help from the workshop staff h2. Branching @@ -202,16 +208,19 @@ Creating a branch in Git is easy. The @git branch@ command, when used by itself,

 $ git branch
-
-* master
 
The @*@ should indicate the current branch you are on, which is @master@. -If you wish to start another branch, use @git branch (new-branch-name)@ : +If you wish to start another branch, use @git checkout -b (new-branch-name)@ : + +

+$ git checkout -b exp1
+
+ +Try git branch again to check which branch you are currently on:

-$ git branch exp1
 $ git branch
   exp1
 * master
@@ -221,11 +230,9 @@ The new branch is now created. Now let's work in that branch. To switch to the n
 
 

 $ git checkout exp1
-
-Switched to branch 'exp1'
 
-@git checkout (branch-name)@ is used to switch branches. +@git checkout (branch-name)@ is used to switch branches. Let's perform some commits now, @@ -234,35 +241,25 @@ Let's perform some commits now, $ echo 'some content' > test.txt $ git add test.txt $ git commit -m "Added experimental txt" -[exp1 1520634] Added experimental txt - 1 files changed, 1 insertions(+), 0 deletions(-) - create mode 100644 test.txt
Now, let's compare them to the master branch. Use @git diff@

 $ git diff master
-
-diff --git a/test.txt b/test.txt
-new file mode 100644
-index 0000000..2ef267e
---- /dev/null
-+++ b/test.txt
-@@ -0,0 +1 @@
-+some content
 
Basically what the above output says is that @test.txt@ is present on the @exp1@ branch, but is absent on the @master@ branch. +[?] Stuck? ask for help from the workshop staff -Git is good enough to handle your files when you switch between branches. Switch back to the @master@ branch -
+h2. Now you see me, now you don't
 
-Switch back to the master branch (Hint: It's the same command we used to switch the the exp1 branch above)
+Git is good enough to handle your files when you switch between branches. Switch back to the @master@ branch
+
+Try switching back to the master branch (Hint: It's the same command we used to switch to the exp1 branch above)
 
-
Now, where's our @test.txt@ file ? @@ -273,75 +270,71 @@ README.textile alice.txt bob.txt gamow.txt As you can see the new file you created in the other branch has disappeared. Not to worry, it is safely tucked away, and will re-appear when you switch back to that branch. -
-
-Switch back to the exp1 branch, and check that the test.txt is now present.
+Now, switch back to the exp1 branch, and check that the @test.txt@ is now present.
 
-
+[?] Stuck? ask for help from the workshop staff h2. Merging We now try out merging. Eventually you will want to merge two branches together after the conclusion of work. -@git merge@ allows you to do that. +@git merge@ allows you to do that. -First, make sure you are on the @master@ branch. +Git merging works by first switching the branch you want to _into_, and then running the command to merge the other branch in. -
+We now want to merge our @exp1@ branch into @master@. First, switch to the @master@ branch.
 
-Switch to the master branch if you haven't already
-
-
+

+git checkout master
+
-To merge the @exp1@ branch into @master@ +Next, we merge the @exp1@ branch into @master@ :

 $ git merge exp1
+
+ +Do you see the following output ? + +
 Merge made by recursive.
  test.txt |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 test.txt
-
+ -You always specify the branch you want to merge from, and you have to be in the branch you want merge into. +You have to be in the branch you want merge _into_ and then you always specify the branch you want to merge. At this point, you can also try out @gitk@ to visualize the changes and how the two branches have merged -Git is pretty good at merging automagically, even when the same file is edited. There are however, some situations where the same line of code is edited there is no way a computer can figure out how to merge. -This will trigger a conflict which you will have to fix. - h2. Merge Conflicts +Git is pretty good at merging automagically, even when the same file is edited. There are however, some situations where the same line of code is edited there is no way a computer can figure out how to merge. +This will trigger a conflict which you will have to fix. + We now practise fixing merge conflicts. Recall that conflicts are caused by merges which affect the same block of code. Here's a branch I prepared earlier. The branch is called @alpher@. Run the code below to set it up (don't worry if you can't understand it)

 $ git checkout alpher
-
-Branch alpher set up to track remote branch alpher from origin.
-Switched to a new branch 'alpher'
 
You should now have a new branch called @alpher@. Try merging that branch into @master@ now and fix the ensuing conflict. -
-
-Merge the alpher branch into master (as you did when you merged exp1 into master) (Ask for help if stumped)
-
-
+[?] Stuck? ask for help from the workshop staff +h2. Fixing a conflict -You should see a @conflict@ with the @gamow.txt@ file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation +You should see a @conflict@ with the @gamow.txt@ file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation :

- 
 Auto-merging gamow.txt
 CONFLICT (content): Merge conflict in gamow.txt
 Automatic merge failed; fix conflicts and then commit the result.
 
 
-If you open the @gamow.txt@ file, you will see something similar as below: +If you open the @gamow.txt@ file, you will see something similar as below:
 
@@ -358,20 +351,17 @@ Stellar nucleosynthesis is the collective term for the nuclear reactions taking
 Git uses pretty much standard conflict resolution markers. The top part of the block, which is everything between @<<<<<< HEAD@ and @======@ is what was in your current branch.
 The bottom half is the version that is present from the @alpher@ branch. To resolve the conflict, you either choose one side or merge them as you see fit.
 
-For example, I might decide to choose the version from the @alpher@ branch. 
+For example, I might decide to choose the version from the @alpher@ branch.
 
-
+Now, try to *fix the merge conflict*. Pick the text that you think is better (Ask for help if stumped)
 
-Fix the merge conflict. Pick the text that you think is better (Ask for help if stumped)
-
-
+Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@. -Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@. +[?] Stuck? ask for help from the workshop staff

 $ git add gamow.txt
 $ git commit -m "Fixed conflict"
-[master f03b09c] Fixed conflict
 
Congratulations. You have fixed the conflict. All is good in the world. @@ -437,7 +427,7 @@ h3. References and Further reading I throughly recommend these resources to continue your Git practice: *
http://try.github.com Another beginners tutorial for git -* http://progit.org (buy the book at http://tinyurl.com/amazonprogit) +* http://git-scm.com Official website, with very useful help, book and videos * http://gitref.org * http://www.kernel.org/pub/software/scm/git/docs/everyday.html From ca52669bdd09ae315d4cd6a715f12dea5cea9619 Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Tue, 24 Jul 2012 01:54:57 +1200 Subject: [PATCH 41/61] Tighten up newlines and empty lines --- README.textile | 110 ++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/README.textile b/README.textile index ff41cae..c0229f7 100644 --- a/README.textile +++ b/README.textile @@ -11,18 +11,18 @@ Some house-cleaning here. We assume of course you have Git installed, (hopefully First thing to do is to setup your identity. This identifies you to other people who download the project. -

+
 $ git config --global user.name "Your Name"
 $ git config --global user.email your.email@example.com
-
+
As a helpful step, you may want to set Git to use your favourite editor -

+
 $ git config --global core.editor emacs
-
+
h2. Starting your journey @@ -30,25 +30,25 @@ h2. Starting your journey First, clone this repository: -

+
 $ git clone https://github.com/kuahyeow/git-workshop.git
-
+
Once you have cloned your repository, you should now see a directory called @git-workshop@. This is your @working directory@ -

+
 $ cd git-workshop
 $ ls
-
+
[?] Stuck? ask for help from the workshop staff For the curious, you should also see the @.git@ subdirectory. This is where all your repository's data and history is kept. -

+
 $ ls -a .git
-
+
You will see : @@ -59,12 +59,13 @@ branches config description HEAD hooks info objects refs h2. The staging area -Now, let's try adding some files into the project. Create a couple of files. For example, I create two files named @bob.txt@ and @alice.txt@. +Now, let's try adding some files into the project. Create a couple of files. -
+Let's create two files named @bob.txt@ and @alice.txt@.
 
-In your working directory, create two files named alice.txt and bob.txt
 
+
+$ touch alice.txt bob.txt
 
Let's use a mail analogy. @@ -73,17 +74,17 @@ In Git, you first add content to the @staging area@ by using @git add@. This is Let's add the files to the staging area -

+
 $ git add alice.txt bob.txt
-
+
h2. Committing You are now ready to commit. The @-m@ flag allows you to enter a message to go with the commit at the same time. -

+
 $ git commit -m "I am adding two new files"
-
+
[?] Stuck? ask for help from the workshop staff @@ -92,17 +93,17 @@ h2. Let's see what just happened We should now have a new commit. To see all the commits so far, use @git log@ -

+
 $ git log
-
+
The log should show all commits listed from most recent first to least recent. You would see various information like the name of the author, the date it was commited, a commit SHA number, and the message for the commit. You should also see your most recent commit, where you added the two new files in the previous section. However git log does not show the files involved in each commit. To view more information about a commit, use @git show@. -

+
 $ git show
-
+
You should see something similar to: @@ -140,19 +141,19 @@ So now, we have updated @alice.txt@ and we wish to commit it to our @repository@ What did we change? A very useful command is @git diff@. This is very useful to see exactly what changes you have done. -

+
 $ git diff
-
+
You should see something like the following: -
+

 diff --git a/alice.txt b/alice.txt
 index e69de29..2aedcab 100644
 --- a/alice.txt
 +++ b/alice.txt
 @@ -0,0 +1 @@
 +Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
-
+
[?] Stuck? ask for help from the workshop staff @@ -170,9 +171,9 @@ Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of Here's how to back out of the staging area : -

+
 $ git reset HEAD alice.txt
-
+
 Unstaged changes after reset:
@@ -191,9 +192,9 @@ Sometimes we did not like what we have done and we wish to go back to the last _
 
 To accomplish this, we use @git checkout@, like so:
 
-

+
 $ git checkout alice.txt
-
+
You have now un-done your changes. Your file is now empty. @@ -206,48 +207,48 @@ Most large code bases have at least two branches - a 'live' branch and a 'develo Creating a branch in Git is easy. The @git branch@ command, when used by itself, will list the branches you currently have -

+
 $ git branch
-
+
The @*@ should indicate the current branch you are on, which is @master@. If you wish to start another branch, use @git checkout -b (new-branch-name)@ : -

+
 $ git checkout -b exp1
-
+
Try git branch again to check which branch you are currently on: -

+
 $ git branch
   exp1
 * master
-
+
The new branch is now created. Now let's work in that branch. To switch to the new branch: -

+
 $ git checkout exp1
-
+
@git checkout (branch-name)@ is used to switch branches. Let's perform some commits now, -

+
 $ echo 'some content' > test.txt
 $ git add test.txt
 $ git commit -m "Added experimental txt"
-
+
Now, let's compare them to the master branch. Use @git diff@ -

+
 $ git diff master
-
+
Basically what the above output says is that @test.txt@ is present on the @exp1@ branch, but is absent on the @master@ branch. @@ -263,10 +264,10 @@ Try switching back to the master branch (Hint: It's the same command we used to Now, where's our @test.txt@ file ? -

+
 $ ls
 README.textile	alice.txt	bob.txt		gamow.txt
-
+
As you can see the new file you created in the other branch has disappeared. Not to worry, it is safely tucked away, and will re-appear when you switch back to that branch. @@ -284,15 +285,15 @@ Git merging works by first switching the branch you want to _into_, and then run We now want to merge our @exp1@ branch into @master@. First, switch to the @master@ branch. -

+
 git checkout master
-
+
Next, we merge the @exp1@ branch into @master@ : -

+
 $ git merge exp1
-
+
Do you see the following output ? @@ -315,9 +316,10 @@ This will trigger a conflict which you will have to fix. We now practise fixing merge conflicts. Recall that conflicts are caused by merges which affect the same block of code. Here's a branch I prepared earlier. The branch is called @alpher@. Run the code below to set it up (don't worry if you can't understand it) -

+
+
 $ git checkout alpher
-
+
You should now have a new branch called @alpher@. Try merging that branch into @master@ now and fix the ensuing conflict. @@ -327,17 +329,15 @@ h2. Fixing a conflict You should see a @conflict@ with the @gamow.txt@ file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation : -

+
 Auto-merging gamow.txt
 CONFLICT (content): Merge conflict in gamow.txt
 Automatic merge failed; fix conflicts and then commit the result.
-
-
+
If you open the @gamow.txt@ file, you will see something similar as below:
-
 $ cat gamow.txt
 <<<<<<< HEAD
 It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis (http://en.wikipedia.org/wiki/Stellar_nucleosynthesis) in stars, a theory largely developed by Bethe.
@@ -359,10 +359,10 @@ Once I have done that, I can then mark the conflict as fixed by using @git add@
 
 [?] Stuck? ask for help from the workshop staff
 
-

+
 $ git add gamow.txt
 $ git commit -m "Fixed conflict"
-
+
Congratulations. You have fixed the conflict. All is good in the world. From 1e012dce2a51f198503ca8cf9abb994b0db00267 Mon Sep 17 00:00:00 2001 From: kuahyeow Date: Tue, 24 Jul 2012 02:08:07 +1200 Subject: [PATCH 42/61] Use public domain question icon --- README.textile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.textile b/README.textile index c0229f7..eec4e0b 100644 --- a/README.textile +++ b/README.textile @@ -41,7 +41,7 @@ $ cd git-workshop $ ls
-[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff For the curious, you should also see the @.git@ subdirectory. This is where all your repository's data and history is kept. @@ -86,7 +86,7 @@ You are now ready to commit. The @-m@ flag allows you to enter a message to go w $ git commit -m "I am adding two new files"
-[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Let's see what just happened @@ -122,7 +122,7 @@ new file mode 100644 index 0000000..e69de29
-[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. A necessary digression @@ -155,7 +155,7 @@ index e69de29..2aedcab 100644 +Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
-[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Staging area again @@ -163,7 +163,7 @@ Now let's add our modified file, @alice.txt@ to the staging area. Do you remembe Next, check the @status@ of @alice.txt@. Is it in the staging area now? -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Undoing @@ -182,7 +182,7 @@ M alice.txt Compare the @git status@ now to the git status from the previous section. How does it differ? -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff Your staging area should now be empty. What's happened to the Lorem Ipsum changes? It's still there. We are now back to the state just before we added this file to staging area. Going back to the mail analogy, we just took our letter out of the box. @@ -198,7 +198,7 @@ $ git checkout alice.txt You have now un-done your changes. Your file is now empty. -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Branching @@ -252,7 +252,7 @@ $ git diff master Basically what the above output says is that @test.txt@ is present on the @exp1@ branch, but is absent on the @master@ branch. -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Now you see me, now you don't @@ -273,7 +273,7 @@ As you can see the new file you created in the other branch has disappeared. Not Now, switch back to the exp1 branch, and check that the @test.txt@ is now present. -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Merging @@ -323,7 +323,7 @@ $ git checkout alpher You should now have a new branch called @alpher@. Try merging that branch into @master@ now and fix the ensuing conflict. -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff h2. Fixing a conflict @@ -357,7 +357,7 @@ Now, try to *fix the merge conflict*. Pick the text that you think is better (As Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@. -[?] Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff
 $ git add gamow.txt

From 8f705bd6f3f0898768ee777a51ee0e748537d9ed Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Tue, 24 Jul 2012 02:09:21 +1200
Subject: [PATCH 43/61] Grammar

---
 README.textile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/README.textile b/README.textile
index eec4e0b..75878f8 100644
--- a/README.textile
+++ b/README.textile
@@ -41,7 +41,7 @@ $ cd git-workshop
 $ ls
 
-!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff For the curious, you should also see the @.git@ subdirectory. This is where all your repository's data and history is kept. @@ -86,7 +86,7 @@ You are now ready to commit. The @-m@ flag allows you to enter a message to go w $ git commit -m "I am adding two new files" -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Let's see what just happened @@ -122,7 +122,7 @@ new file mode 100644 index 0000000..e69de29 -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. A necessary digression @@ -155,7 +155,7 @@ index e69de29..2aedcab 100644 +Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
-!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Staging area again @@ -163,7 +163,7 @@ Now let's add our modified file, @alice.txt@ to the staging area. Do you remembe Next, check the @status@ of @alice.txt@. Is it in the staging area now? -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Undoing @@ -182,7 +182,7 @@ M alice.txt Compare the @git status@ now to the git status from the previous section. How does it differ? -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff Your staging area should now be empty. What's happened to the Lorem Ipsum changes? It's still there. We are now back to the state just before we added this file to staging area. Going back to the mail analogy, we just took our letter out of the box. @@ -198,7 +198,7 @@ $ git checkout alice.txt You have now un-done your changes. Your file is now empty. -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Branching @@ -252,7 +252,7 @@ $ git diff master Basically what the above output says is that @test.txt@ is present on the @exp1@ branch, but is absent on the @master@ branch. -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Now you see me, now you don't @@ -273,7 +273,7 @@ As you can see the new file you created in the other branch has disappeared. Not Now, switch back to the exp1 branch, and check that the @test.txt@ is now present. -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Merging @@ -323,7 +323,7 @@ $ git checkout alpher You should now have a new branch called @alpher@. Try merging that branch into @master@ now and fix the ensuing conflict. -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff h2. Fixing a conflict @@ -357,7 +357,7 @@ Now, try to *fix the merge conflict*. Pick the text that you think is better (As Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@. -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? ask for help from the workshop staff +!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff
 $ git add gamow.txt

From 9b9b9b51f03518e3742b5e21e3da91992e8f8593 Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Tue, 24 Jul 2012 18:03:27 +1200
Subject: [PATCH 44/61] Fix

---
 README.textile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/README.textile b/README.textile
index 75878f8..4e39269 100644
--- a/README.textile
+++ b/README.textile
@@ -137,8 +137,6 @@ e.g. Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem
 
 Then *save* the file
 
-So now, we have updated @alice.txt@ and we wish to commit it to our @repository@.
-
 What did we change? A very useful command is @git diff@. This is very useful to see exactly what changes you have done. 
 
 

From cf022750affd9247151b939d43b66df9e5c96420 Mon Sep 17 00:00:00 2001
From: kuahyeow 
Date: Thu, 26 Jul 2012 09:36:24 +1200
Subject: [PATCH 45/61] Add description of Github collab group exercise

---
 README.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.textile b/README.textile
index 4e39269..3ceb21b 100644
--- a/README.textile
+++ b/README.textile
@@ -410,7 +410,7 @@ Then come back here, we'll wait.
 
 h2. Let's collaborate !
 
-...
+In which you will be collaborating with your team-mates using GitHub...
 
 h2. Fin
 

From 8d91e4abec16aa4dc36afae92a842b759f5461da Mon Sep 17 00:00:00 2001
From: Andy Newport 
Date: Thu, 23 Apr 2015 14:58:03 +1200
Subject: [PATCH 46/61] convert README with pandoc

---
 README.markdown | 474 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 474 insertions(+)
 create mode 100644 README.markdown

diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..afd793d
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,474 @@
+What is Git ?
+=============
+
+Git is a *distributed* **version control** system [1]
+
+[1] http://git-scm.com/about
+
+Setup
+-----
+
+Some house-cleaning here. We assume of course you have Git installed,
+(hopefully \>= 1.7.0).
+
+First thing to do is to setup your identity. This identifies you to
+other people who download the project.
+
+    $ git config --global user.name "Your Name"
+    $ git config --global user.email your.email@example.com
+
+As a helpful step, you may want to set Git to use your favourite editor
+
+    $ git config --global core.editor emacs
+
+Starting your journey
+---------------------
+
+First, clone this repository:
+
+    $ git clone https://github.com/kuahyeow/git-workshop.git
+
+Once you have cloned your repository, you should now see a directory
+called `git-workshop`. This is your `working directory`
+
+    $ cd git-workshop
+    $ ls
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+For the curious, you should also see the `.git` subdirectory. This is
+where all your repository’s data and history is kept.
+
+    $ ls -a .git
+
+You will see :
+
+    branches  config  description  HEAD  hooks  info  objects  refs
+
+The staging area
+----------------
+
+Now, let’s try adding some files into the project. Create a couple of
+files.
+
+Let’s create two files named `bob.txt` and `alice.txt`.
+
+    $ touch alice.txt bob.txt
+
+Let’s use a mail analogy.
+
+In Git, you first add content to the `staging area` by using `git add`.
+This is like putting the stuff you want to send into a cardboard box.
+You finalize the process and record it into the git index by using
+`git commit`. This is like sealing the box - it’s now ready to send.
+
+Let’s add the files to the staging area
+
+    $ git add alice.txt bob.txt
+
+Committing
+----------
+
+You are now ready to commit. The `-m` flag allows you to enter a message
+to go with the commit at the same time.
+
+    $ git commit -m "I am adding two new files"
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Let’s see what just happened
+----------------------------
+
+We should now have a new commit. To see all the commits so far, use
+`git log`
+
+    $ git log
+
+The log should show all commits listed from most recent first to least
+recent. You would see various information like the name of the author,
+the date it was commited, a commit SHA number, and the message for the
+commit.
+
+You should also see your most recent commit, where you added the two new
+files in the previous section. However git log does not show the files
+involved in each commit. To view more information about a commit, use
+`git show`.
+
+    $ git show
+
+You should see something similar to:
+
+    commit 5a1fad96c8584b2c194c229de7e112e4c84e5089
+    Author: kuahyeow 
+    Date:   Sun Jul 17 19:13:42 2011 +1200
+
+        I am adding two new files
+
+    diff --git a/alice.txt b/alice.txt
+    new file mode 100644
+    index 0000000..e69de29
+    diff --git a/bob.txt b/bob.txt
+    new file mode 100644
+    index 0000000..e69de29
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+A necessary digression
+----------------------
+
+In this section, we are going to add more changes, and try to recover
+from mistakes.
+
+Be forewarned, this next step is going to be hard. We will need to add
+some content to alice.txt.
+
+Open `alice.txt` and type in your favourite line from a song, or:
+
+e.g. Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit
+voluptatem accusantium doloremque laudantium
+
+Then **save** the file
+
+What did we change? A very useful command is `git diff`. This is very
+useful to see exactly what changes you have done.
+
+    $ git diff
+
+You should see something like the following:
+
+    diff --git a/alice.txt b/alice.txt
+    index e69de29..2aedcab 100644
+    --- a/alice.txt
+    +++ b/alice.txt
+    @@ -0,0 +1 @@
+    +Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Staging area again
+------------------
+
+Now let’s add our modified file, `alice.txt` to the staging area. Do you
+remember how ?
+
+Next, check the `status` of `alice.txt`. Is it in the staging area now?
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Undoing
+-------
+
+Let’s say we did not like putting Lorem ipsum into `alice.txt`. One
+advantage of a staging area is to enable us to back out before we
+commit - which is a bit harder to back out of. Remembering the mail
+analogy - it’s easier to take mail out of the cardboard box before you
+seal it than after.
+
+Here’s how to back out of the staging area :
+
+    $ git reset HEAD alice.txt
+
+    Unstaged changes after reset:
+    M   alice.txt
+
+Compare the `git status` now to the git status from the previous
+section. How does it differ?
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Your staging area should now be empty. What’s happened to the Lorem
+Ipsum changes? It’s still there. We are now back to the state just
+before we added this file to staging area. Going back to the mail
+analogy, we just took our letter out of the box.
+
+Undoing II
+----------
+
+Sometimes we did not like what we have done and we wish to go back to
+the last *recorded* state. In this case, we wish to go back to the state
+just before we added the Lorrem ipsum text to `alice.txt`.
+
+To accomplish this, we use `git checkout`, like so:
+
+    $ git checkout alice.txt
+
+You have now un-done your changes. Your file is now empty.
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Branching
+---------
+
+Most large code bases have at least two branches - a ‘live’ branch and a
+‘development’ branch. The live branch is code which is OK to be deployed
+on to a website, or downloaded by customers. The development branch
+allows developers to work on features which might not be bug free. Only
+once everyone is happy with the development branch would it be merged
+with the live branch.
+
+Creating a branch in Git is easy. The `git branch` command, when used by
+itself, will list the branches you currently have
+
+    $ git branch
+
+The `*` should indicate the current branch you are on, which is
+`master`.
+
+If you wish to start another branch, use
+`git checkout -b (new-branch-name)` :
+
+    $ git checkout -b exp1
+
+Try git branch again to check which branch you are currently on:
+
+    $ git branch
+      exp1
+    * master
+
+The new branch is now created. Now let’s work in that branch. To switch
+to the new branch:
+
+    $ git checkout exp1
+
+`git checkout (branch-name)` is used to switch branches.
+
+Let’s perform some commits now,
+
+    $ echo 'some content' > test.txt
+    $ git add test.txt
+    $ git commit -m "Added experimental txt"
+
+Now, let’s compare them to the master branch. Use `git diff`
+
+    $ git diff master
+
+Basically what the above output says is that `test.txt` is present on
+the `exp1` branch, but is absent on the `master` branch.
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Now you see me, now you don’t
+-----------------------------
+
+Git is good enough to handle your files when you switch between
+branches. Switch back to the `master` branch
+
+Try switching back to the master branch (Hint: It’s the same command we
+used to switch to the exp1 branch above)
+
+Now, where’s our `test.txt` file ?
+
+    $ ls
+    README.textile  alice.txt   bob.txt     gamow.txt
+
+As you can see the new file you created in the other branch has
+disappeared. Not to worry, it is safely tucked away, and will re-appear
+when you switch back to that branch.
+
+Now, switch back to the exp1 branch, and check that the `test.txt` is
+now present.
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Merging
+-------
+
+We now try out merging. Eventually you will want to merge two branches
+together after the conclusion of work.\
+`git merge` allows you to do that.
+
+Git merging works by first switching the branch you want to *into*, and
+then running the command to merge the other branch in.
+
+We now want to merge our `exp1` branch into `master`. First, switch to
+the `master` branch.
+
+    git checkout master
+
+Next, we merge the `exp1` branch into `master` :
+
+    $ git merge exp1
+
+Do you see the following output ?
+
+    Merge made by recursive.
+     test.txt |    1 +
+     1 files changed, 1 insertions(+), 0 deletions(-)
+     create mode 100644 test.txt
+
+You have to be in the branch you want merge *into* and then you always
+specify the branch you want to merge.
+
+At this point, you can also try out `gitk` to visualize the changes and
+how the two branches have merged
+
+Merge Conflicts
+---------------
+
+Git is pretty good at merging automagically, even when the same file is
+edited. There are however, some situations where the same line of code
+is edited there is no way a computer can figure out how to merge.\
+This will trigger a conflict which you will have to fix.
+
+We now practise fixing merge conflicts. Recall that conflicts are caused
+by merges which affect the same block of code.
+
+Here’s a branch I prepared earlier. The branch is called `alpher`. Run
+the code below to set it up (don’t worry if you can’t understand it)
+
+    $ git checkout alpher
+
+You should now have a new branch called `alpher`. Try merging that
+branch into `master` now and fix the ensuing conflict.
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+Fixing a conflict
+-----------------
+
+You should see a `conflict` with the `gamow.txt` file. This means that
+the same line of text was edited and committed on both the master branch
+and the alpher branch. The output below basically tells you the current
+situation :
+
+    Auto-merging gamow.txt
+    CONFLICT (content): Merge conflict in gamow.txt
+    Automatic merge failed; fix conflicts and then commit the result.
+
+If you open the `gamow.txt` file, you will see something similar as
+below:
+
+    $ cat gamow.txt
+    <<<<<<< HEAD
+    It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis (http://en.wikipedia.org/wiki/Stellar_nucleosynthesis) in stars, a theory largely developed by Bethe.
+    =======
+
+    http://en.wikipedia.org/wiki/Stellar_nucleosynthesis
+    Stellar nucleosynthesis is the collective term for the nuclear reactions taking place in stars to build the nuclei of the elements heavier than hydrogen. Some small quantity of these reactions also occur on the stellar surface under various circumstances. For the creation of elements during the explosion of a star, the term supernova nucleosynthesis is used.
+    >>>>>>> alpher
+
+Git uses pretty much standard conflict resolution markers. The top part
+of the block, which is everything between `<<<<<< HEAD` and `======` is
+what was in your current branch.\
+The bottom half is the version that is present from the `alpher` branch.
+To resolve the conflict, you either choose one side or merge them as you
+see fit.
+
+For example, I might decide to choose the version from the `alpher`
+branch.
+
+Now, try to **fix the merge conflict**. Pick the text that you think is
+better (Ask for help if stumped)
+
+Once I have done that, I can then mark the conflict as fixed by using
+`git add` and `git commit`.
+
+![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png)
+Stuck? Ask for help from the workshop staff
+
+    $ git add gamow.txt
+    $ git commit -m "Fixed conflict"
+
+Congratulations. You have fixed the conflict. All is good in the world.
+
+Fin
+---
+
+You have learnt :
+
+1.  Clone a repository
+2.  Commit files
+3.  Check status
+4.  Check diff
+5.  Undoing changes
+6.  Branching and merging
+7.  Fixing conflicts
+
+Part II
+=======
+
+GitHub
+------
+
+But, wait. There’s more. What about this distributed sharing thing with
+Git ?
+
+To be able to share, we’ll need a server to host our git repositiories.
+GitHub (github.com) is probably the
+easiest place to begin with.
+
+Login or sign up with GitHub
+----------------------------
+
+Go sign up for an account at
+GitHub; Or login into your GitHub account if you had previously signed
+up.
+
+Hint: You may need to setup git cache your GitHub password - see
+https://help.github.com/articles/set-up-git
+
+Then come back here, we’ll wait.
+
+Create your first GitHub repository
+-----------------------------------
+
+A repository (repo) is a place where you would store your code. You were
+practising on your very own repo just now in Part 1!
+
+The following 
+tutorial will show you how to create a GitHub repo - which you can
+then share with others
+
+Then come back here, we’ll wait.
+
+Fork a repo
+-----------
+
+Go to this
+tutorial
+
+Then come back here, we’ll wait.
+
+Let’s collaborate !
+-------------------
+
+In which you will be collaborating with your team-mates using GitHub…
+
+Fin
+---
+
+You have learnt:
+
+1.  Forking a repo at GitHub
+2.  Git push
+3.  Git pull
+
+### References and Further reading
+
+I throughly recommend these resources to continue your Git practice:
+
+-   http://try.github.com Another
+    beginners tutorial for git
+-   http://git-scm.com Official
+    website, with very useful help, book and videos
+-   http://gitref.org
+-   http://www.kernel.org/pub/software/scm/git/docs/everyday.html
+
+Author
+------
+
+This work is licensed under the Creative Commons
+Attribution-NonCommercial-ShareAlike 3.0 License\
+http://creativecommons.org/licenses/by-nc-sa/3.0/\
+Author: Thong Kuah\
+Contributors: Nick Malcolm

From d0ff72883d9421cdaf2c356f7dd76987aa17c860 Mon Sep 17 00:00:00 2001
From: Andy Newport 
Date: Thu, 23 Apr 2015 15:01:12 +1200
Subject: [PATCH 47/61] Remove old README

---
 README.textile | 439 -------------------------------------------------
 1 file changed, 439 deletions(-)
 delete mode 100644 README.textile

diff --git a/README.textile b/README.textile
deleted file mode 100644
index 3ceb21b..0000000
--- a/README.textile
+++ /dev/null
@@ -1,439 +0,0 @@
-h1. What is Git ?
-
-Git is a _distributed_ *version control* system [1]
-
-[1] http://git-scm.com/about
-
-h2. Setup
-
-Some house-cleaning here. We assume of course you have Git installed, (hopefully >= 1.7.0).
-
-First thing to do is to setup your identity. This identifies you to other people who download the project.
-
-
-
-$ git config --global user.name "Your Name"
-$ git config --global user.email your.email@example.com
-
- - -As a helpful step, you may want to set Git to use your favourite editor - - -
-$ git config --global core.editor emacs
-
- - -h2. Starting your journey - - -First, clone this repository: - -
-$ git clone https://github.com/kuahyeow/git-workshop.git
-
- -Once you have cloned your repository, you should now see a directory called @git-workshop@. This is your @working directory@ - -
-$ cd git-workshop
-$ ls
-
- -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - - -For the curious, you should also see the @.git@ subdirectory. This is where all your repository's data and history is kept. - -
-$ ls -a .git
-
- -You will see : - -
-branches  config  description  HEAD  hooks  info  objects  refs
-
- - -h2. The staging area - -Now, let's try adding some files into the project. Create a couple of files. - -Let's create two files named @bob.txt@ and @alice.txt@. - - -
-$ touch alice.txt bob.txt
-
- -Let's use a mail analogy. - -In Git, you first add content to the @staging area@ by using @git add@. This is like putting the stuff you want to send into a cardboard box. You finalize the process and record it into the git index by using @git commit@. This is like sealing the box - it's now ready to send. - -Let's add the files to the staging area - -
-$ git add alice.txt bob.txt
-
- -h2. Committing - -You are now ready to commit. The @-m@ flag allows you to enter a message to go with the commit at the same time. - -
-$ git commit -m "I am adding two new files"
-
- -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - - -h2. Let's see what just happened - -We should now have a new commit. To see all the commits so far, use @git log@ - -
-$ git log
-
- -The log should show all commits listed from most recent first to least recent. You would see various information like the name of the author, the date it was commited, a commit SHA number, and the message for the commit. - -You should also see your most recent commit, where you added the two new files in the previous section. However git log does not show the files involved in each commit. To view more information about a commit, use @git show@. - -
-$ git show
-
- -You should see something similar to: - -
-commit 5a1fad96c8584b2c194c229de7e112e4c84e5089
-Author: kuahyeow 
-Date:   Sun Jul 17 19:13:42 2011 +1200
-
-    I am adding two new files
-
-diff --git a/alice.txt b/alice.txt
-new file mode 100644
-index 0000000..e69de29
-diff --git a/bob.txt b/bob.txt
-new file mode 100644
-index 0000000..e69de29
-
- -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - - -h2. A necessary digression - -In this section, we are going to add more changes, and try to recover from mistakes. - -Be forewarned, this next step is going to be hard. We will need to add some content to alice.txt. - -Open @alice.txt@ and type in your favourite line from a song, or: - -e.g. Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium - -Then *save* the file - -What did we change? A very useful command is @git diff@. This is very useful to see exactly what changes you have done. - -
-$ git diff
-
- -You should see something like the following: -

-diff --git a/alice.txt b/alice.txt
-index e69de29..2aedcab 100644
---- a/alice.txt
-+++ b/alice.txt
-@@ -0,0 +1 @@
-+Lorem ipsum Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
-
- -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - -h2. Staging area again - -Now let's add our modified file, @alice.txt@ to the staging area. Do you remember how ? - -Next, check the @status@ of @alice.txt@. Is it in the staging area now? - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - -h2. Undoing - -Let's say we did not like putting Lorem ipsum into @alice.txt@. One advantage of a staging area is to enable us to back out before we commit - which is a bit harder to back out of. Remembering the mail analogy - it's easier to take mail out of the cardboard box before you seal it than after. - -Here's how to back out of the staging area : - -
-$ git reset HEAD alice.txt
-
- -
-Unstaged changes after reset:
-M	alice.txt
-
- -Compare the @git status@ now to the git status from the previous section. How does it differ? - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - -Your staging area should now be empty. What's happened to the Lorem Ipsum changes? It's still there. We are now back to the state just before we added this file to staging area. Going back to the mail analogy, we just took our letter out of the box. - -h2. Undoing II - -Sometimes we did not like what we have done and we wish to go back to the last _recorded_ state. In this case, we wish to go back to the state just before we added the Lorrem ipsum text to @alice.txt@. - -To accomplish this, we use @git checkout@, like so: - -
-$ git checkout alice.txt
-
- -You have now un-done your changes. Your file is now empty. - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - - -h2. Branching - -Most large code bases have at least two branches - a 'live' branch and a 'development' branch. The live branch is code which is OK to be deployed on to a website, or downloaded by customers. The development branch allows developers to work on features which might not be bug free. Only once everyone is happy with the development branch would it be merged with the live branch. - -Creating a branch in Git is easy. The @git branch@ command, when used by itself, will list the branches you currently have - -
-$ git branch
-
- -The @*@ should indicate the current branch you are on, which is @master@. - -If you wish to start another branch, use @git checkout -b (new-branch-name)@ : - -
-$ git checkout -b exp1
-
- -Try git branch again to check which branch you are currently on: - -
-$ git branch
-  exp1
-* master
-
- -The new branch is now created. Now let's work in that branch. To switch to the new branch: - -
-$ git checkout exp1
-
- -@git checkout (branch-name)@ is used to switch branches. - - -Let's perform some commits now, - -
-$ echo 'some content' > test.txt
-$ git add test.txt
-$ git commit -m "Added experimental txt"
-
- -Now, let's compare them to the master branch. Use @git diff@ - -
-$ git diff master
-
- -Basically what the above output says is that @test.txt@ is present on the @exp1@ branch, but is absent on the @master@ branch. - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - - -h2. Now you see me, now you don't - -Git is good enough to handle your files when you switch between branches. Switch back to the @master@ branch - -Try switching back to the master branch (Hint: It's the same command we used to switch to the exp1 branch above) - - -Now, where's our @test.txt@ file ? - -
-$ ls
-README.textile	alice.txt	bob.txt		gamow.txt
-
- -As you can see the new file you created in the other branch has disappeared. Not to worry, it is safely tucked away, and will re-appear when you switch back to that branch. - -Now, switch back to the exp1 branch, and check that the @test.txt@ is now present. - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - - -h2. Merging - -We now try out merging. Eventually you will want to merge two branches together after the conclusion of work. -@git merge@ allows you to do that. - -Git merging works by first switching the branch you want to _into_, and then running the command to merge the other branch in. - -We now want to merge our @exp1@ branch into @master@. First, switch to the @master@ branch. - -
-git checkout master
-
- -Next, we merge the @exp1@ branch into @master@ : - -
-$ git merge exp1
-
- -Do you see the following output ? - -
-Merge made by recursive.
- test.txt |    1 +
- 1 files changed, 1 insertions(+), 0 deletions(-)
- create mode 100644 test.txt
-
- -You have to be in the branch you want merge _into_ and then you always specify the branch you want to merge. - -At this point, you can also try out @gitk@ to visualize the changes and how the two branches have merged - -h2. Merge Conflicts - -Git is pretty good at merging automagically, even when the same file is edited. There are however, some situations where the same line of code is edited there is no way a computer can figure out how to merge. -This will trigger a conflict which you will have to fix. - -We now practise fixing merge conflicts. Recall that conflicts are caused by merges which affect the same block of code. - -Here's a branch I prepared earlier. The branch is called @alpher@. Run the code below to set it up (don't worry if you can't understand it) - -
-$ git checkout alpher
-
- -You should now have a new branch called @alpher@. Try merging that branch into @master@ now and fix the ensuing conflict. - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - -h2. Fixing a conflict - -You should see a @conflict@ with the @gamow.txt@ file. This means that the same line of text was edited and committed on both the master branch and the alpher branch. The output below basically tells you the current situation : - -
-Auto-merging gamow.txt
-CONFLICT (content): Merge conflict in gamow.txt
-Automatic merge failed; fix conflicts and then commit the result.
-
- -If you open the @gamow.txt@ file, you will see something similar as below: - -
-$ cat gamow.txt
-<<<<<<< HEAD
-It was eventually recognized that most of the heavy elements observed in the present universe are the result of stellar nucleosynthesis (http://en.wikipedia.org/wiki/Stellar_nucleosynthesis) in stars, a theory largely developed by Bethe.
-=======
-
-http://en.wikipedia.org/wiki/Stellar_nucleosynthesis
-Stellar nucleosynthesis is the collective term for the nuclear reactions taking place in stars to build the nuclei of the elements heavier than hydrogen. Some small quantity of these reactions also occur on the stellar surface under various circumstances. For the creation of elements during the explosion of a star, the term supernova nucleosynthesis is used.
->>>>>>> alpher
-
- -Git uses pretty much standard conflict resolution markers. The top part of the block, which is everything between @<<<<<< HEAD@ and @======@ is what was in your current branch. -The bottom half is the version that is present from the @alpher@ branch. To resolve the conflict, you either choose one side or merge them as you see fit. - -For example, I might decide to choose the version from the @alpher@ branch. - -Now, try to *fix the merge conflict*. Pick the text that you think is better (Ask for help if stumped) - -Once I have done that, I can then mark the conflict as fixed by using @git add@ and @git commit@. - -!https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Help-browser.svg/20px-Help-browser.svg.png! Stuck? Ask for help from the workshop staff - -
-$ git add gamow.txt
-$ git commit -m "Fixed conflict"
-
- -Congratulations. You have fixed the conflict. All is good in the world. - - -h2. Fin - -You have learnt : - -# Clone a repository -# Commit files -# Check status -# Check diff -# Undoing changes -# Branching and merging -# Fixing conflicts - - -h1. Part II - -h2. GitHub - -But, wait. There's more. What about this distributed sharing thing with Git ? - -To be able to share, we'll need a server to host our git repositiories. GitHub (github.com) is probably the easiest place to begin with. - -h2. Login or sign up with GitHub - -Go sign up for an account at GitHub; Or login into your GitHub account if you had previously signed up. - -Hint: You may need to setup git cache your GitHub password - see https://help.github.com/articles/set-up-git - -Then come back here, we'll wait. - -h2. Create your first GitHub repository - -A repository (repo) is a place where you would store your code. You were practising on your very own repo just now in Part 1! - -The following tutorial will show you how to create a GitHub repo - which you can then share with others - -Then come back here, we'll wait. - -h2. Fork a repo - -Go to this tutorial - -Then come back here, we'll wait. - -h2. Let's collaborate ! - -In which you will be collaborating with your team-mates using GitHub... - -h2. Fin - -You have learnt: - -# Forking a repo at GitHub -# Git push -# Git pull - -h3. References and Further reading - -I throughly recommend these resources to continue your Git practice: - -* http://try.github.com Another beginners tutorial for git -* http://git-scm.com Official website, with very useful help, book and videos -* http://gitref.org -* http://www.kernel.org/pub/software/scm/git/docs/everyday.html - - - -h2. Author - -This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License -http://creativecommons.org/licenses/by-nc-sa/3.0/ -Author: Thong Kuah -Contributors: Nick Malcolm From 103c8fe3cf1a173e82325ce4fd7f0c3bdca16739 Mon Sep 17 00:00:00 2001 From: Andy Newport Date: Thu, 23 Apr 2015 15:05:23 +1200 Subject: [PATCH 48/61] Add fork suggestion --- README.markdown | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index afd793d..9f29927 100644 --- a/README.markdown +++ b/README.markdown @@ -26,7 +26,11 @@ Starting your journey First, clone this repository: - $ git clone https://github.com/kuahyeow/git-workshop.git + $ git clone https://github.com/newporta/git-workshop.git + +You may want to fork (create your own copy of) the project on github and +clone from your own repo. You can find the fork button at the top right of +the screen on a github repository. Once you have cloned your repository, you should now see a directory called `git-workshop`. This is your `working directory` From ab4870c4cd9ee2093d2f578985d65f6107450945 Mon Sep 17 00:00:00 2001 From: Andy Newport Date: Thu, 23 Apr 2015 15:11:44 +1200 Subject: [PATCH 49/61] Github help links --- README.markdown | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 9f29927..5710ac1 100644 --- a/README.markdown +++ b/README.markdown @@ -5,12 +5,18 @@ Git is a *distributed* **version control** system [1] [1] http://git-scm.com/about -Setup ------ +Getting Git +----------- Some house-cleaning here. We assume of course you have Git installed, (hopefully \>= 1.7.0). +If you don't you can install it from downloads on the git homepage or you can +install ![Github's git GUI](https://help.github.com/articles/set-up-git/). + +Setup +----- + First thing to do is to setup your identity. This identifies you to other people who download the project. @@ -30,7 +36,7 @@ First, clone this repository: You may want to fork (create your own copy of) the project on github and clone from your own repo. You can find the fork button at the top right of -the screen on a github repository. +the screen on a github repository, or more help about doing that ![here](https://help.github.com/articles/fork-a-repo/). Once you have cloned your repository, you should now see a directory called `git-workshop`. This is your `working directory` From 09f4283af80d83f5ffbd3b95f345b3e3d5367b06 Mon Sep 17 00:00:00 2001 From: Andy Newport Date: Thu, 23 Apr 2015 15:13:55 +1200 Subject: [PATCH 50/61] Fix up link tags --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 5710ac1..022aa28 100644 --- a/README.markdown +++ b/README.markdown @@ -12,7 +12,7 @@ Some house-cleaning here. We assume of course you have Git installed, (hopefully \>= 1.7.0). If you don't you can install it from downloads on the git homepage or you can -install ![Github's git GUI](https://help.github.com/articles/set-up-git/). +install [Github's git GUI](https://help.github.com/articles/set-up-git/). Setup ----- @@ -36,7 +36,7 @@ First, clone this repository: You may want to fork (create your own copy of) the project on github and clone from your own repo. You can find the fork button at the top right of -the screen on a github repository, or more help about doing that ![here](https://help.github.com/articles/fork-a-repo/). +the screen on a github repository, or more help about doing that [here](https://help.github.com/articles/fork-a-repo/). Once you have cloned your repository, you should now see a directory called `git-workshop`. This is your `working directory` From 58fcef2da9b150bdaa5f28c89893c55bf2202f67 Mon Sep 17 00:00:00 2001 From: Andy Newport Date: Thu, 23 Apr 2015 15:48:44 +1200 Subject: [PATCH 51/61] Add pull_request branch to README on master --- README.markdown | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 022aa28..e6913fb 100644 --- a/README.markdown +++ b/README.markdown @@ -444,15 +444,13 @@ Then come back here, we’ll wait. Fork a repo ----------- -Go to this -tutorial - +Go to [this tutorial](https://help.github.com/articles/fork-a-repo) Then come back here, we’ll wait. Let’s collaborate ! ------------------- -In which you will be collaborating with your team-mates using GitHub… +Check out the pull_request branch on this repository for further instructions! Fin --- From a28a073f017736297a7abf695842f7c941ffd104 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Thu, 7 May 2015 23:45:15 +1200 Subject: [PATCH 52/61] :) Put it back to this repo --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index e6913fb..d3ca4d6 100644 --- a/README.markdown +++ b/README.markdown @@ -32,7 +32,7 @@ Starting your journey First, clone this repository: - $ git clone https://github.com/newporta/git-workshop.git + $ git clone https://github.com/kuahyeow/git-workshop.git You may want to fork (create your own copy of) the project on github and clone from your own repo. You can find the fork button at the top right of From 1d4e4dc3a95dab89f6deadaa4c703e01b1723c79 Mon Sep 17 00:00:00 2001 From: Andy Newport Date: Wed, 10 Aug 2016 12:29:11 +1200 Subject: [PATCH 53/61] Add links to revert tutorial --- README.markdown | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index e6913fb..63c9d30 100644 --- a/README.markdown +++ b/README.markdown @@ -404,12 +404,23 @@ You have learnt : 6. Branching and merging 7. Fixing conflicts + +Now You can choose two tracks, either Part II (below) which covers time travel and +mangling your git history, or Part III (even below-er) which covers Github pull +requests and cat gifs. + Part II ======= +Check out the `revert` branch on this repository for further instructions! +You can always get back to this version of the readme by checking out the master +branch. + +Part III +======== + GitHub ------ - But, wait. There’s more. What about this distributed sharing thing with Git ? @@ -420,6 +431,11 @@ easiest place to begin with. Login or sign up with GitHub ---------------------------- +If you've already got an account you can skip on to creating the repo on +github, or forking this repository and cloning it down to your local machine. + +Otherwise... + Go sign up for an account at GitHub; Or login into your GitHub account if you had previously signed up. @@ -450,7 +466,8 @@ Then come back here, we’ll wait. Let’s collaborate ! ------------------- -Check out the pull_request branch on this repository for further instructions! +Check out the `pull_request` branch on this repository for further instructions! +You can always get back to this version of the readme by checking out the master branch. Fin --- From fa2dc058f6dc4d5a6547e69107890a543aa4cfee Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Tue, 17 Apr 2018 22:05:28 +1200 Subject: [PATCH 54/61] Credit Andy Newport --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 93fa40e..ecf8977 100644 --- a/README.markdown +++ b/README.markdown @@ -496,4 +496,4 @@ This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License\ http://creativecommons.org/licenses/by-nc-sa/3.0/\ Author: Thong Kuah\ -Contributors: Nick Malcolm +Contributors: Andy Newport, Nick Malcolm From 703a97a93dad3f81ac83d1ee6eff9693a17cb6c1 Mon Sep 17 00:00:00 2001 From: kevinsun0904 Date: Mon, 11 Nov 2024 16:13:02 -0800 Subject: [PATCH 55/61] Added java and python debugging exercise --- SomeJavaCode.java | 8 ++++++++ some_python_code.py | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 SomeJavaCode.java create mode 100644 some_python_code.py diff --git a/SomeJavaCode.java b/SomeJavaCode.java new file mode 100644 index 0000000..3c4508b --- /dev/null +++ b/SomeJavaCode.java @@ -0,0 +1,8 @@ +public class SomeJavaCode { + public static void main(String[] args) { + int[] arr = new int[] { 1, 3, 6, 3, 10, 20 }; + for (int i = 0; i <= arr.length; i++) { + System.out.println(arr[i]); + } + } +} diff --git a/some_python_code.py b/some_python_code.py new file mode 100644 index 0000000..7cad6de --- /dev/null +++ b/some_python_code.py @@ -0,0 +1,3 @@ +arr = [1, 3, 6, 3, 10, 20] +for i in range(len(arr) + 1): + print(arr[i]) \ No newline at end of file From 87476c7ac8530e0d5528f6b2e25ff67b10c23c7c Mon Sep 17 00:00:00 2001 From: Aryen Singhal <42897258+AryenSinghal@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:52:25 -0800 Subject: [PATCH 56/61] Update README.markdown --- README.markdown | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index ecf8977..1eead33 100644 --- a/README.markdown +++ b/README.markdown @@ -1,5 +1,6 @@ -What is Git ? -============= +CSES OpenSource Logo + +# Intro to Git Git is a *distributed* **version control** system [1] @@ -496,4 +497,4 @@ This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License\ http://creativecommons.org/licenses/by-nc-sa/3.0/\ Author: Thong Kuah\ -Contributors: Andy Newport, Nick Malcolm +Contributors: Andy Newport, Nick Malcolm, Aryen Singhal, Kevin Sun From 4ad64a34b005fa157c875c95712b91550067fa87 Mon Sep 17 00:00:00 2001 From: Kevin Sun <122562552+kevinsun0904@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:11:03 -0800 Subject: [PATCH 57/61] Update README.markdown --- README.markdown | 97 +++++++++++++------------------------------------ 1 file changed, 26 insertions(+), 71 deletions(-) diff --git a/README.markdown b/README.markdown index 1eead33..0f72f78 100644 --- a/README.markdown +++ b/README.markdown @@ -392,92 +392,45 @@ Stuck? Ask for help from the workshop staff Congratulations. You have fixed the conflict. All is good in the world. -Fin ---- -You have learnt : +Part II +======= -1. Clone a repository -2. Commit files -3. Check status -4. Check diff -5. Undoing changes -6. Branching and merging -7. Fixing conflicts +GitHub can also be very powerful for collaborative coding especially for Open Source projects! +Let's give it a try! -Now You can choose two tracks, either Part II (below) which covers time travel and -mangling your git history, or Part III (even below-er) which covers Github pull -requests and cat gifs. +1. Open up either `some_python_code.py` or `SomeJavaCode.java` depending on which language you prefer. +2. Find the bug in the code and fix it! +3. Add and commit the changes. +4. Push the changes to your forked repo. +5. Open GitHub.com and click `contribute` to open a pull request. A pull request is basically a proposal to merge two branches. Earlier we covered merging two local branches, but in this case we are merging a branch from a forked repo to the upstream main repo. +6. Add a title and some description to the Pull Request and make the request! -Part II +![image](https://github.com/user-attachments/assets/a9d4ef47-9acd-4418-8bd1-e23b1a5728e7) + +Part III ======= Check out the `revert` branch on this repository for further instructions! You can always get back to this version of the readme by checking out the master branch. -Part III -======== - -GitHub ------- -But, wait. There’s more. What about this distributed sharing thing with -Git ? - -To be able to share, we’ll need a server to host our git repositiories. -GitHub (github.com) is probably the -easiest place to begin with. - -Login or sign up with GitHub ----------------------------- - -If you've already got an account you can skip on to creating the repo on -github, or forking this repository and cloning it down to your local machine. - -Otherwise... - -Go sign up for an account at -GitHub; Or login into your GitHub account if you had previously signed -up. - -Hint: You may need to setup git cache your GitHub password - see -https://help.github.com/articles/set-up-git - -Then come back here, we’ll wait. - -Create your first GitHub repository ------------------------------------ - -A repository (repo) is a place where you would store your code. You were -practising on your very own repo just now in Part 1! - -The following -tutorial will show you how to create a GitHub repo - which you can -then share with others - -Then come back here, we’ll wait. - -Fork a repo ------------ - -Go to [this tutorial](https://help.github.com/articles/fork-a-repo) -Then come back here, we’ll wait. - -Let’s collaborate ! -------------------- - -Check out the `pull_request` branch on this repository for further instructions! -You can always get back to this version of the readme by checking out the master branch. - Fin --- -You have learnt: +You have learnt : -1. Forking a repo at GitHub -2. Git push -3. Git pull +1. Clone a repository +2. Commit files +3. Check status +4. Check diff +5. Undoing changes +6. Branching and merging +7. Fixing conflicts +8. Forking a repo at GitHub +9. Git push +10. Git pull ### References and Further reading @@ -490,6 +443,8 @@ I throughly recommend these resources to continue your Git practice: - http://gitref.org - http://www.kernel.org/pub/software/scm/git/docs/everyday.html + + Author ------ From 90d7852bc407b55ea83ba561bbd25877f60ea00b Mon Sep 17 00:00:00 2001 From: Aryen Singhal <42897258+AryenSinghal@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:13:52 -0800 Subject: [PATCH 58/61] Update README.markdown --- README.markdown | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 0f72f78..e30132f 100644 --- a/README.markdown +++ b/README.markdown @@ -31,13 +31,12 @@ As a helpful step, you may want to set Git to use your favourite editor Starting your journey --------------------- -First, clone this repository: +First, fork (create your own copy of) the project on github. You can find the fork button at the top right of +the screen on a github repository, or more help about doing that [here](https://help.github.com/articles/fork-a-repo/). - $ git clone https://github.com/kuahyeow/git-workshop.git +Then, clone your forked repository: -You may want to fork (create your own copy of) the project on github and -clone from your own repo. You can find the fork button at the top right of -the screen on a github repository, or more help about doing that [here](https://help.github.com/articles/fork-a-repo/). + $ git clone https://github.com//git-workshop.git Once you have cloned your repository, you should now see a directory called `git-workshop`. This is your `working directory` From 223f3dd63b62037b12e881c688c9e6c60888aea7 Mon Sep 17 00:00:00 2001 From: mlsoldano-boop Date: Mon, 3 Nov 2025 18:25:57 -0800 Subject: [PATCH 59/61] I am adding two new files --- alice.txt | 0 bob.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 alice.txt create mode 100644 bob.txt diff --git a/alice.txt b/alice.txt new file mode 100644 index 0000000..e69de29 diff --git a/bob.txt b/bob.txt new file mode 100644 index 0000000..e69de29 From 8bfb607f5eacc7f61b7b337292e75fab795b7566 Mon Sep 17 00:00:00 2001 From: mlsoldano-boop Date: Mon, 3 Nov 2025 18:41:06 -0800 Subject: [PATCH 60/61] updated test.txt --- test.txt | Bin 0 -> 30 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fba7caa4053b174ec98fcef054c00e7b22cace2 GIT binary patch literal 30 gcmezWub3g9A(tVQL4hF|$jW0V0kT0PF9R0?0E@x~ Date: Mon, 3 Nov 2025 18:45:53 -0800 Subject: [PATCH 61/61] Fixed buggy python code --- some_python_code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/some_python_code.py b/some_python_code.py index 7cad6de..972e9b3 100644 --- a/some_python_code.py +++ b/some_python_code.py @@ -1,3 +1,3 @@ arr = [1, 3, 6, 3, 10, 20] -for i in range(len(arr) + 1): - print(arr[i]) \ No newline at end of file +for i in range(len(arr)): + print(arr[i]+1) \ No newline at end of file