Skip to content

Commit

Permalink
publish updates
Browse files Browse the repository at this point in the history
  • Loading branch information
harveysanders committed Jun 27, 2019
1 parent 1d179fb commit a4254cb
Show file tree
Hide file tree
Showing 24 changed files with 220 additions and 221 deletions.
5 changes: 2 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ <h1>Git Immersion</h1>

<ul>
<li><a href="http://git-scm.com/download" target="_blank" rel="noopener">Install Git</a></li>
<li><a href="https://git-scm.com/downloads/guis" target="_blank" rel="noopener">Graphical Clients</a></li>
<li><a href="https://github.com/edgecase/git_immersion/issues" target="_blank" rel="noopener">Github Issues</a></li>
<li><a href="https://github.com/operationspark/git_immersion/issues" target="_blank" rel="noopener">Github Issues</a></li>
</ul>

<a class="start" href="lab_01.html">Start Git Immersion</a>
Expand All @@ -45,7 +44,7 @@ <h1>Git Immersion</h1>
<a href="http://creativecommons.org/licenses/by-nc-sa/3.0" target="_blank" rel="noopener">Creative Commons BY-NC-SA 3.0 License.</a>
</p>

<p>️️❤️ Maintained with love for our dear friend <a href="https://en.wikipedia.org/wiki/Jim_Weirich" target="_blank" rel="noopener">Jim Weirich</a>.</p>
<p>❤️ Forked from <a href="http://gitimmersion.com">GitImmersion</a> project by <a href="https://en.wikipedia.org/wiki/Jim_Weirich" target="_blank" rel="noopener">Jim Weirich</a>.</p>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/lab_03.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h3><b>Execute:</b></h3>
<h3><b>Output:</b></h3>
<pre class="sample">$ git add hello.js
$ git commit -m "First Commit"
[master (root-commit) 3c56dd7] First Commit
[master (root-commit) 284070d] First Commit
1 file changed, 1 insertion(+)
create mode 100644 hello.js
</pre>
Expand Down
2 changes: 1 addition & 1 deletion docs/lab_09.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h3><b>Execute:</b></h3>
<p>You should see &#8230;</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git commit -m "Added a default value"
[master efb122a] Added a default value
[master 20a6c79] Added a default value
1 file changed, 3 insertions(+), 1 deletion(-)
$ git status
On branch master
Expand Down
32 changes: 16 additions & 16 deletions docs/lab_10.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,27 @@ <h3><b>Execute:</b></h3>
<p>You should see &#8230;</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git log
commit 5b16eb42366a4beec35ca6f88fc5a91db86257bf
commit 59992ce6a7cd58a6c80189b137964eea3d1df17d
Author: Halle Bot &lt;halle (at) operationspark.org&gt;
Date: Thu Jun 27 13:22:21 2019 -0500
Date: Thu Jun 27 14:45:18 2019 -0500

Added a comment

commit efb122ae67817090b5f52fb67d40d11e5c13b129
commit 20a6c79e9355f7f5fc8aae379a7fdee0f625c955
Author: Halle Bot &lt;halle (at) operationspark.org&gt;
Date: Thu Jun 27 13:22:21 2019 -0500
Date: Thu Jun 27 14:45:18 2019 -0500

Added a default value

commit e5f7c2413518b518d99050927695e81a6b70a516
commit 6915d417a8ab6ac71184cde8f5b068026af43d08
Author: Halle Bot &lt;halle (at) operationspark.org&gt;
Date: Thu Jun 27 13:22:20 2019 -0500
Date: Thu Jun 27 14:45:17 2019 -0500

Using process.argv

commit 3c56dd7dd07462e77a58fe550d5b1f5d4494ce68
commit 284070da97229f2f8ff812608318ba03412205b5
Author: Halle Bot &lt;halle (at) operationspark.org&gt;
Date: Thu Jun 27 13:22:20 2019 -0500
Date: Thu Jun 27 14:45:17 2019 -0500

First Commit
</pre>
Expand All @@ -136,10 +136,10 @@ <h3><b>Execute:</b></h3>
<p>You should see &#8230;</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git log --pretty=oneline
5b16eb42366a4beec35ca6f88fc5a91db86257bf Added a comment
efb122ae67817090b5f52fb67d40d11e5c13b129 Added a default value
e5f7c2413518b518d99050927695e81a6b70a516 Using process.argv
3c56dd7dd07462e77a58fe550d5b1f5d4494ce68 First Commit
59992ce6a7cd58a6c80189b137964eea3d1df17d Added a comment
20a6c79e9355f7f5fc8aae379a7fdee0f625c955 Added a default value
6915d417a8ab6ac71184cde8f5b068026af43d08 Using process.argv
284070da97229f2f8ff812608318ba03412205b5 First Commit
</pre>
<h2>Controlling Which Entries are Displayed</h2>
<p>There are a lot of options for selecting which entries are displayed in the log. Play around with the following options:</p>
Expand All @@ -159,10 +159,10 @@ <h3><b>Execute:</b></h3>
<p>It looks like this:</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
* 5b16eb4 2019-06-27 | Added a comment (HEAD -&gt; master) [Halle Bot]
* efb122a 2019-06-27 | Added a default value [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 59992ce 2019-06-27 | Added a comment (HEAD -&gt; master) [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]</pre>
<p>Let&#8217;s look at it in detail:</p>
<ul>
<li><code>--pretty="..."</code> defines the format of the output.</li>
Expand Down
16 changes: 8 additions & 8 deletions docs/lab_12.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ <h3><b>Execute:</b></h3>
<p class="note"><strong>Note:</strong> You did remember to define <code>hist</code> in your <code>.gitconfig</code> file, right? If not, review the lab on aliases.</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist
* 5b16eb4 2019-06-27 | Added a comment (HEAD -&gt; master) [Halle Bot]
* efb122a 2019-06-27 | Added a default value [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 59992ce 2019-06-27 | Added a comment (HEAD -&gt; master) [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]</pre>
<p>Examine the log output and find the hash for the first commit. It should be the last line of the <code>git hist</code> output. Use that hash code (the first 7 characters are enough) in the command below. Then check the contents of the hello.js file.</p>
<h3><b>Execute:</b></h3>
<pre class="instructions">git checkout &lt;hash&gt;
Expand All @@ -117,8 +117,8 @@ <h3><b>Execute:</b></h3>
<p class="note"><strong>Note:</strong> Many commands depend on the hash values in the repository. Since your hash values will vary from mine, whenever you see something like &lt;hash&gt; or &lt;treehash&gt; in the command, substitute in the proper hash value for your repository.</p>
<p>You should see &#8230;</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git checkout 3c56dd7
Note: checking out '3c56dd7'.
<pre class="sample">$ git checkout 284070d
Note: checking out '284070d'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
Expand All @@ -129,7 +129,7 @@ <h3><b>Output:</b></h3>

git checkout -b &lt;new-branch-name&gt;

HEAD is now at 3c56dd7 First Commit
HEAD is now at 284070d First Commit
$ cat hello.js
console.log("Hello, World");
</pre>
Expand All @@ -142,7 +142,7 @@ <h3><b>Execute:</b></h3>
<p>You should see &#8230;</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git checkout master
Previous HEAD position was 3c56dd7 First Commit
Previous HEAD position was 284070d First Commit
Switched to branch 'master'
$ cat hello.js
// Default is "World"
Expand Down
18 changes: 9 additions & 9 deletions docs/lab_13.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h3><b>Output:</b></h3>

git checkout -b &lt;new-branch-name&gt;

HEAD is now at efb122a Added a default value
HEAD is now at 20a6c79 Added a default value
$ cat hello.js
const name = process.argv[2] || "World";

Expand All @@ -138,11 +138,11 @@ <h3><b>Execute:</b></h3>
git checkout v1-beta</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git checkout v1
Previous HEAD position was efb122a Added a default value
HEAD is now at 5b16eb4 Added a comment
Previous HEAD position was 20a6c79 Added a default value
HEAD is now at 59992ce Added a comment
$ git checkout v1-beta
Previous HEAD position was 5b16eb4 Added a comment
HEAD is now at efb122a Added a default value
Previous HEAD position was 59992ce Added a comment
HEAD is now at 20a6c79 Added a default value
</pre>
<h2>Viewing Tags using the <code>tag</code> command</h2>
<p>You can see what tags are available using the <code>git tag</code> command.</p>
Expand All @@ -159,10 +159,10 @@ <h3><b>Execute:</b></h3>
<pre class="instructions">git hist master --all</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist master --all
* 5b16eb4 2019-06-27 | Added a comment (tag: v1, master) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (HEAD, tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 59992ce 2019-06-27 | Added a comment (tag: v1, master) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (HEAD, tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>You can see both tags (<code>v1</code> and <code>v1-beta</code>) listed in the log output, along with the branch name (<code>master</code>). Also <code>HEAD</code> shows you the currently checked out commit (which is <code>v1-beta</code> at the moment).</p>
<nav class="foot-navigation">
<a href="lab_12.html">
Expand Down
16 changes: 8 additions & 8 deletions docs/lab_16.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ <h3><b>Execute:</b></h3>
<p>This will pop you into the editor. You can edit the default commit message or leave it as is. Save and close the file. You should see &#8230;</p>
<h3><b>Output:</b></h3>
<pre class="sample">$ git revert HEAD --no-edit
[master fca1cd3] Revert "Oops, we didn't want this commit"
Date: Thu Jun 27 13:22:21 2019 -0500
[master 654f128] Revert "Oops, we didn't want this commit"
Date: Thu Jun 27 14:45:18 2019 -0500
1 file changed, 2 insertions(+), 2 deletions(-)
</pre>
<p>Since we were undoing the very last commit we made, we were able to use <code>HEAD</code> as the argument to revert. We can revert any arbitrary commit earlier in history by simply specifying its hash value.</p>
Expand All @@ -131,12 +131,12 @@ <h3><b>Execute:</b></h3>
<pre class="instructions">git hist</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist
* fca1cd3 2019-06-27 | Revert "Oops, we didn't want this commit" (HEAD -&gt; master) [Halle Bot]
* 9f83c0f 2019-06-27 | Oops, we didn't want this commit [Halle Bot]
* 5b16eb4 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 654f128 2019-06-27 | Revert "Oops, we didn't want this commit" (HEAD -&gt; master) [Halle Bot]
* 982fd79 2019-06-27 | Oops, we didn't want this commit [Halle Bot]
* 59992ce 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>This technique will work with any commit (although you may have to resolve conflicts). It is safe to use even on branches that are publicly shared on remote repositories.</p>
<h2>Up Next</h2>
<p>Next, let&#8217;s look at a technique that can be used to remove the most recent commits from the repository history.</p>
Expand Down
34 changes: 17 additions & 17 deletions docs/lab_17.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ <h3><b>Execute:</b></h3>
<pre class="instructions">git hist</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist
* fca1cd3 2019-06-27 | Revert "Oops, we didn't want this commit" (HEAD -&gt; master) [Halle Bot]
* 9f83c0f 2019-06-27 | Oops, we didn't want this commit [Halle Bot]
* 5b16eb4 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 654f128 2019-06-27 | Revert "Oops, we didn't want this commit" (HEAD -&gt; master) [Halle Bot]
* 982fd79 2019-06-27 | Oops, we didn't want this commit [Halle Bot]
* 59992ce 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>We see that we have an &#8220;Oops&#8221; commit and a &#8220;Revert Oops&#8221; commit as the last two commits made in this branch. Let&#8217;s remove them using reset.</p>
<h2>First, Mark this Branch</h2>
<p>But before we remove the commits, let&#8217;s mark the latest commit with a tag so we can find it again.</p>
Expand All @@ -132,25 +132,25 @@ <h3><b>Execute:</b></h3>
git hist</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git reset --hard v1
HEAD is now at 5b16eb4 Added a comment
HEAD is now at 59992ce Added a comment
$ git hist
* 5b16eb4 2019-06-27 | Added a comment (HEAD -&gt; master, tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 59992ce 2019-06-27 | Added a comment (HEAD -&gt; master, tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>Our master branch now points to the v1 commit and the Oops commit and the Revert Oops commit are no longer in the branch. The <code>--hard</code> parameter indicates that the working directory should be updated to be consistent with the new branch head.</p>
<h2>Nothing is Ever Lost</h2>
<p>But what happened to the bad commits? It turns out that the commits are still in the repository. In fact, we can still reference them. Remember that at the beginning of this lab we tagged the reverting commit with the tag &#8220;oops&#8221;. Let&#8217;s look at <em>all</em> the commits.</p>
<h3><b>Execute:</b></h3>
<pre class="instructions">git hist --all</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist --all
* fca1cd3 2019-06-27 | Revert "Oops, we didn't want this commit" (tag: oops) [Halle Bot]
* 9f83c0f 2019-06-27 | Oops, we didn't want this commit [Halle Bot]
* 5b16eb4 2019-06-27 | Added a comment (HEAD -&gt; master, tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 654f128 2019-06-27 | Revert "Oops, we didn't want this commit" (tag: oops) [Halle Bot]
* 982fd79 2019-06-27 | Oops, we didn't want this commit [Halle Bot]
* 59992ce 2019-06-27 | Added a comment (HEAD -&gt; master, tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>Here we see that the bad commits haven&#8217;t disappeared. They are still in the repository. It&#8217;s just that they are no longer listed in the master branch. If we hadn&#8217;t tagged them, they would still be in the repository, but there would be no way to reference them other than using their hash names. Commits that are unreferenced remain in the repository until the system runs the garbage collection software.</p>
<h2>Dangers of Reset</h2>
<p>Resets on local branches are generally safe. Any &#8220;accidents&#8221; can usually be recovered from by just resetting again with the desired commit.</p>
Expand Down
10 changes: 5 additions & 5 deletions docs/lab_18.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ <h3><b>Execute:</b></h3>
git hist --all</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git tag -d oops
Deleted tag 'oops' (was fca1cd3)
Deleted tag 'oops' (was 654f128)
$ git hist --all
* 5b16eb4 2019-06-27 | Added a comment (HEAD -&gt; master, tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 59992ce 2019-06-27 | Added a comment (HEAD -&gt; master, tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>The oops tag is no longer listed in the repository.</p>
<nav class="foot-navigation">
<a href="lab_17.html">
Expand Down
14 changes: 7 additions & 7 deletions docs/lab_19.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,20 @@ <h3><b>Execute:</b></h3>
<h3><b>Output:</b></h3>
<pre class="sample">$ git add hello.js
$ git commit --amend -m "Add an author/email comment"
[master 091e8b3] Add an author/email comment
Date: Thu Jun 27 13:22:22 2019 -0500
[master 4535421] Add an author/email comment
Date: Thu Jun 27 14:45:19 2019 -0500
1 file changed, 3 insertions(+), 2 deletions(-)
</pre>
<h2>Review the History</h2>
<h3><b>Execute:</b></h3>
<pre class="instructions">git hist</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist
* 091e8b3 2019-06-27 | Add an author/email comment (HEAD -&gt; master) [Halle Bot]
* 5b16eb4 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* 4535421 2019-06-27 | Add an author/email comment (HEAD -&gt; master) [Halle Bot]
* 59992ce 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<p>We can see the original &#8220;author&#8221; commit is now gone, and it is replaced by the &#8220;author/email&#8221; commit. You can achieve the same effect by resetting the branch back one commit and then recommitting the new changes.</p>
<nav class="foot-navigation">
<a href="lab_18.html">
Expand Down
20 changes: 10 additions & 10 deletions docs/lab_23.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ <h3><b>Execute:</b></h3>
<pre class="instructions">git hist --all</pre>
<h3><b>Output:</b></h3>
<pre class="sample">$ git hist --all
* 38d6811 2019-06-27 | Updated package (HEAD -&gt; greet) [Halle Bot]
* a656d15 2019-06-27 | Hello uses Greeter [Halle Bot]
* d14888f 2019-06-27 | Added greeter class [Halle Bot]
* acb842b 2019-06-27 | Added a package.json. (master) [Halle Bot]
* 3a6c463 2019-06-27 | Moved hello.js to lib [Halle Bot]
* 091e8b3 2019-06-27 | Add an author/email comment [Halle Bot]
* 5b16eb4 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* efb122a 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* e5f7c24 2019-06-27 | Using process.argv [Halle Bot]
* 3c56dd7 2019-06-27 | First Commit [Halle Bot]</pre>
* f52644d 2019-06-27 | Updated package (HEAD -&gt; greet) [Halle Bot]
* 455c54f 2019-06-27 | Hello uses Greeter [Halle Bot]
* 4fb8bde 2019-06-27 | Added greeter class [Halle Bot]
* 2b04803 2019-06-27 | Added a package.json. (master) [Halle Bot]
* b65b430 2019-06-27 | Moved hello.js to lib [Halle Bot]
* 4535421 2019-06-27 | Add an author/email comment [Halle Bot]
* 59992ce 2019-06-27 | Added a comment (tag: v1) [Halle Bot]
* 20a6c79 2019-06-27 | Added a default value (tag: v1-beta) [Halle Bot]
* 6915d41 2019-06-27 | Using process.argv [Halle Bot]
* 284070d 2019-06-27 | First Commit [Halle Bot]</pre>
<h2>Switch to the Master Branch</h2>
<p>Just use the <code>git checkout</code> command to switch between branches.</p>
<h3><b>Execute:</b></h3>
Expand Down
Loading

0 comments on commit a4254cb

Please sign in to comment.