diff --git a/README.md b/README.md index 53da501..38aa2cb 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ from github. Manually modifying the files in the `gh-pages` branch is probably the wrong thing to do. Modify the appropriate template or css file on the -master branch, then run `rake publish`. +main branch, then run `rake publish`. ## Lab Format Directives @@ -146,7 +146,7 @@ Example: Output: git commit Waiting for Emacs... - [master 569aa96] Using ARGV + [main 569aa96] Using ARGV 1 files changed, 1 insertions(+), 1 deletions(-) EOF @@ -185,7 +185,7 @@ Execute sction of a lab. Example: Execute: - git checkout master + git checkout main =checkout git status =status diff --git a/Rakefile b/Rakefile index 2409286..6c26e49 100644 --- a/Rakefile +++ b/Rakefile @@ -26,14 +26,14 @@ end desc "Publish the Git Immersion web site." task :publish => [:not_dirty, :build, :labs] do - sh 'git checkout master' + sh 'git checkout main' head = `git log --pretty="%h" -n1`.strip sh 'git checkout gh-pages' cp FileList['git_tutorial/html/*'], '.' sh 'git add .' sh "git commit -m 'Updated docs to #{head}'" sh 'git push' - sh 'git checkout master' + sh 'git checkout main' end directory "dist" diff --git a/docs/lab_01.html b/docs/lab_01.html index 5f78654..dd07a09 100644 --- a/docs/lab_01.html +++ b/docs/lab_01.html @@ -59,16 +59,16 @@ - + - + - + diff --git a/docs/lab_02.html b/docs/lab_02.html index 13b8dfc..260210c 100644 --- a/docs/lab_02.html +++ b/docs/lab_02.html @@ -59,16 +59,16 @@ - + - + - + diff --git a/docs/lab_03.html b/docs/lab_03.html index fb6524e..704be0a 100644 --- a/docs/lab_03.html +++ b/docs/lab_03.html @@ -59,16 +59,16 @@ - + - + - + @@ -123,7 +123,7 @@

Execute:

Output:

$ git add hello.js
 $ git commit -m "First Commit"
-[master (root-commit) 284070d] First Commit
+[main (root-commit) 284070d] First Commit
  1 file changed, 1 insertion(+)
  create mode 100644 hello.js
 
diff --git a/docs/lab_04.html b/docs/lab_04.html index a651bc1..6e5e052 100644 --- a/docs/lab_04.html +++ b/docs/lab_04.html @@ -59,16 +59,16 @@ - + - + - + @@ -105,7 +105,7 @@

Execute:

You should see

Output:

$ git status
-On branch master
+On branch main
 nothing to commit, working tree clean
 

The status command reports that there is nothing to commit. This means that the repository has all the current state of the working directory. There are no outstanding changes to record.

diff --git a/docs/lab_05.html b/docs/lab_05.html index 4c72e97..615dcf8 100644 --- a/docs/lab_05.html +++ b/docs/lab_05.html @@ -59,16 +59,16 @@ - + - + - + @@ -110,7 +110,7 @@

Execute:

You should see …

Output:

$ git status
-On branch master
+On branch main
 Changes not staged for commit:
   (use "git add <file>..." to update what will be committed)
   (use "git checkout -- <file>..." to discard changes in working directory)
diff --git a/docs/lab_06.html b/docs/lab_06.html
index 665c1e9..8ffda25 100644
--- a/docs/lab_06.html
+++ b/docs/lab_06.html
@@ -59,16 +59,16 @@
   
   
   
-  
+  
   
   
   
   
   
   
-  
+  
   
-  
+  
   
   
   
@@ -107,7 +107,7 @@ 

Execute:

Output:

$ git add hello.js
 $ git status
-On branch master
+On branch main
 Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
 
diff --git a/docs/lab_07.html b/docs/lab_07.html
index fad0f5c..c520937 100644
--- a/docs/lab_07.html
+++ b/docs/lab_07.html
@@ -59,16 +59,16 @@
   
   
   
-  
+  
   
   
   
   
   
   
-  
+  
   
-  
+  
   
   
   
diff --git a/docs/lab_08.html b/docs/lab_08.html
index 096f451..7cf1e8f 100644
--- a/docs/lab_08.html
+++ b/docs/lab_08.html
@@ -59,16 +59,16 @@
   
   
   
-  
+  
   
   
   
   
   
   
-  
+  
   
-  
+  
   
   
   
@@ -100,46 +100,16 @@ 

Goals

Commit the change

Ok, enough about staging. Let’s commit what we have staged to the repository.

-

When you used git commit previously to commit the initial version of the hello.js file to the repository, you included the -m flag that gave a comment on the command line. The commit command will allow you to interactively edit a comment for the commit. Let’s try that now.

-

If you omit the -m flag from the command line, git will pop you into the editor of your choice. The editor is chosen from the following list (in priority order):

- -

I have the EDITOR variable set to vim.

+

Committing is the action of saving the changes to the repository. It is like taking a snapshot of the changes. You can always go back to this snapshot later.

So commit now and check the status.

Execute:

-
git commit
-

You should see the following in your editor:

-

Output:

-
|
-# Please enter the commit message for your changes. Lines starting
-# with '#' will be ignored, and an empty message aborts the commit.
-# On branch master
-# Changes to be committed:
-#   (use "git reset HEAD <file>..." to unstage)
-#
-#	modified:   hello.js
-#
-
-

On the first line, enter the comment: “Using process.argv”. Save the file and exit the editor. You should see …

-

Output:

-
git commit
-Waiting for Vim...
-[master 569aa96] Using process.argv
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-

The “Waiting for Vim…” line comes from the vim program which sends the file to a running vim program and waits for the file to be closed. The rest of the output is the standard commit messages.

-

Check the status

-

Finally let’s check the status again.

-

Execute:

+
git commit -m "Using process.argv
git status
+

You should see …

Output:

$ git status
-On branch master
+On branch main
 nothing to commit, working tree clean
 

The working directory is clean and ready for you to continue.

diff --git a/docs/lab_09.html b/docs/lab_09.html index c02424f..a4b9499 100644 --- a/docs/lab_09.html +++ b/docs/lab_09.html @@ -59,16 +59,16 @@ - + - + - + @@ -126,7 +126,7 @@

Execute:

You should see …

Output:

$ git status
-On branch master
+On branch main
 Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
 
@@ -149,10 +149,10 @@ 

Execute:

You should see …

Output:

$ git commit -m "Added a default value"
-[master 20a6c79] Added a default value
+[main 20a6c79] Added a default value
  1 file changed, 3 insertions(+), 1 deletion(-)
 $ git status
-On branch master
+On branch main
 Changes not staged for commit:
   (use "git add <file>..." to update what will be committed)
   (use "git checkout -- <file>..." to discard changes in working directory)
@@ -172,7 +172,7 @@ 

Execute:

You should see …

Output:

$ git status
-On branch master
+On branch main
 Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
 
diff --git a/docs/lab_10.html b/docs/lab_10.html
index 97858a7..83955ce 100644
--- a/docs/lab_10.html
+++ b/docs/lab_10.html
@@ -59,16 +59,16 @@
   
   
   
-  
+  
   
   
   
   
   
   
-  
+  
   
-  
+  
   
   
   
@@ -159,7 +159,7 @@ 

Execute:

It looks like this:

Output:

$ git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
-* 59992ce 2019-06-27 | Added a comment (HEAD -> master) [Halle Bot]
+* 59992ce 2019-06-27 | Added a comment (HEAD -> main) [Halle Bot]
 * 20a6c79 2019-06-27 | Added a default value [Halle Bot]
 * 6915d41 2019-06-27 | Using process.argv [Halle Bot]
 * 284070d 2019-06-27 | First Commit [Halle Bot]
diff --git a/docs/lab_11.html b/docs/lab_11.html index 6475900..21b3692 100644 --- a/docs/lab_11.html +++ b/docs/lab_11.html @@ -59,16 +59,16 @@ - + - + - + @@ -100,7 +100,8 @@

Goals

Common Aliases

git status, git add, git commit, and git checkout are such common commands that it is useful to have abbreviations for them.

-

Add the following to the .gitconfig file in your $HOME directory.

+

Add the following to the .gitconfig file in your $HOME directory.

+

Try using the command: git config --global alias.[alias-name] [command] to add the alias to your .gitconfig file. Replace the values that are in the [] brackets with the actual alias name and comand

.gitconfig

[alias]
   co = checkout
diff --git a/docs/lab_12.html b/docs/lab_12.html
index 3b3d0bb..71c3d9e 100644
--- a/docs/lab_12.html
+++ b/docs/lab_12.html
@@ -59,16 +59,16 @@
   
   
   
-  
+  
   
   
   
   
   
   
-  
+  
   
-  
+  
   
   
   
@@ -105,7 +105,7 @@ 

Execute:

Note: You did remember to define hist in your .gitconfig file, right? If not, review the lab on aliases.

Output:

$ git hist
-* 59992ce 2019-06-27 | Added a comment (HEAD -> master) [Halle Bot]
+* 59992ce 2019-06-27 | Added a comment (HEAD -> main) [Halle Bot]
 * 20a6c79 2019-06-27 | Added a default value [Halle Bot]
 * 6915d41 2019-06-27 | Using process.argv [Halle Bot]
 * 284070d 2019-06-27 | First Commit [Halle Bot]
@@ -135,22 +135,22 @@

Output:

The output of the checkout command explains the situation pretty well. Older versions of git will complain about not being on a local branch. In any case, don’t worry about that for now.

Notice the contents of the hello.js file are the original contents.

-

Return the latest version in the master branch

+

Return the latest version in the main branch

Execute:

-
git checkout master
+
git checkout main
 cat hello.js

You should see …

Output:

-
$ git checkout master
+
$ git checkout main
 Previous HEAD position was 284070d First Commit
-Switched to branch 'master'
+Switched to branch 'main'
 $ cat hello.js
 // Default is "World"
 const name = process.argv[2] || "World";
 
 console.log(`Hello, ${name}!`);
 
-

‘master’ is the name of the default branch. By checking out a branch by name, you go to the latest version of that branch.

+

‘main’ is the name of the default branch. By checking out a branch by name, you go to the latest version of that branch.