Skip to content

Commit

Permalink
🥑 -ise the images and extra material too
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Sep 28, 2021
1 parent 5c3f297 commit ca6d833
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 84 deletions.
2 changes: 1 addition & 1 deletion _episodes/02-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ For this lesson, we will be interacting with [GitHub](https://github.com/) and s
>
{: .callout}
Dracula also has to set his favorite text editor, following this table:
Alfredo also has to set his favorite text editor, following this table:
| Editor | Configuration command |
|:-------------------|:-------------------------------------------------|
Expand Down
6 changes: 3 additions & 3 deletions _episodes/14-supplemental-rstudio.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ project with Git. To get started using Git in RStudio, we create a new project:
![RStudio screenshot showing the file menu dropdown with "New Project..." selected](../fig/RStudio_screenshot_newproject.png)

This will open a dialog asking us how we want to create the project. We have
some options here. Let's say that we want to use RStudio with the planets
some options here. Let's say that we want to use RStudio with the recipes
repository that we already made. Since that repository lives in a directory on
our computer, we choose the option "Existing Directory":

Expand Down Expand Up @@ -71,7 +71,7 @@ Next, RStudio will ask which existing directory we want to use. Click

![](../fig/RStudio_screenshot_navigateexisting.png)

Ta-da! We have created a new project in RStudio within the existing planets
Ta-da! We have created a new project in RStudio within the existing recipes
repository. Notice the vertical "Git" menu in the menu bar. RStudio has
recognized that the current directory is a Git repository, and gives us a
number of tools to use Git:
Expand All @@ -80,7 +80,7 @@ number of tools to use Git:

To edit the existing files in the repository, we can click on them in the
"Files" panel on the lower right. Now let's add some additional information
about Pluto:
about Hummus:

![](../fig/RStudio_screenshot_editfiles.png)

Expand Down
130 changes: 68 additions & 62 deletions _extras/discuss.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ $ cat ~/.gitconfig

~~~
[user]
name = Vlad Dracula
email = vlad@tran.sylvan.ia
name = Alfredo Linguini
email = a.linguini@ratatouille.fr
[color]
ui = true
[core]
Expand Down Expand Up @@ -59,14 +59,14 @@ $ git config --global alias.co checkout
Now if we return to the example from [Exploring History]({{ page.root }}/05-history/) where we ran:

~~~
$ git checkout f22b25e mars.txt
$ git checkout f22b25e guacamole.md
~~~
{: .language-bash}

we could now instead type:

~~~
$ git co f22b25e mars.txt
$ git co f22b25e guacamole.md
~~~
{: .language-bash}

Expand Down Expand Up @@ -136,40 +136,44 @@ This has various impacts on Git's performance and will make it difficult to
compare different versions of your project.

For a basic example to show the difference it makes,
we're going to go see what would have happened if Dracula had tried
we're going to go see what would have happened if Alfredo had tried
using outputs from a word processor instead of plain text.

Create a new directory and go into it:

~~~
$ mkdir planets-nontext
$ cd planets-nontext
$ mkdir recipes-nontext
$ cd recipes-nontext
~~~
{: .language-bash}

Use a program such as Microsoft Word or LibreOffice Writer to create a new document.
Enter the same text that we began with before:

~~~
Cold and dry, but everything is my favorite color
# Ingredients
# Instructions
~~~
{: .output}

Save the document into the `planets-nontext` directory with the name of `mars.doc`.
Save the document into the `recipes-nontext` directory with the name of `guacamole.doc`.
Back in the terminal, run the usual commands for setting up a new Git repository:

~~~
$ git init
$ git add mars.doc
$ git commit -m "Starting to think about Mars"
$ git add guacamole.doc
$ git commit -m "Create a template for recipe"
~~~
{: .language-bash}

Then make the same changes to `mars.doc` that we (or Vlad) previously made to `mars.txt`.
Then make the same changes to `guacamole.doc` that we (or Alfredo) previously made to `guacamole.md`.

~~~
Cold and dry, but everything is my favorite color
The two moons may be a problem for Wolfman
# Ingredients
- avocado
- lemon
- salt
# Instructions
~~~
{: .output}

Expand All @@ -182,22 +186,25 @@ $ git diff
{: .language-bash}

~~~
diff --git a/mars.doc b/mars.doc
diff --git a/guacamole.doc b/guacamole.doc
index 53a66fd..6e988e9 100644
Binary files a/mars.doc and b/mars.doc differ
Binary files a/guacamole.doc and b/guacamole.doc differ
~~~
{: .output}

Compare this to the earlier `git diff` obtained when using text files:

~~~
diff --git a/mars.txt b/mars.txt
diff --git a/guacamole.md b/guacamole.md
index df0654a..315bf3a 100644
--- a/mars.txt
+++ b/mars.txt
@@ -1 +1,2 @@
Cold and dry, but everything is my favorite color
+The two moons may be a problem for Wolfman
--- a/guacamole.md
+++ b/guacamole.md
@@ -1,2 +1,5 @@
# Ingredients
+- avocado
+- lemon
+- salt
# Instructions
~~~
{: .output}

Expand All @@ -224,18 +231,18 @@ Adding and modifying files are not the only actions one might take
when working on a project. It might be required to remove a file
from the repository.

Create a new file for the planet Nibiru:
Create a new file for the invisible ink:

~~~
$ echo "This is another name for fake planet X" > nibiru.txt
$ echo "This is where we keep the secret sauce" > invisible.md
~~~
{: .language-bash}

Now add to the repository like you have learned earlier:

~~~
$ git add nibiru.txt
$ git commit -m 'adding info on nibiru'
$ git add invisible.md
$ git commit -m 'adding secret sauce'
$ git status
~~~
{: .language-bash}
Expand All @@ -246,11 +253,11 @@ nothing to commit, working directory clean
~~~
{: .output}

Nibiru is not a real planet. That was a silly idea. Let us remove
Invisible ink is not a real food. That was a silly idea. Let us remove
it from the disk and let Git know about it:

~~~
$ git rm nibiru.txt
$ git rm invisible.md
$ git status
~~~
{: .language-bash}
Expand All @@ -260,7 +267,7 @@ On branch main
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: nibiru.txt
deleted: invisible.md
~~~
{: .output}
Expand All @@ -271,7 +278,7 @@ in the new commit. The previous commit will still
have the file, if you were to retrieve that specific commit.

~~~
$ git commit -m 'Removing info on Nibiru. It is not a real planet!'
$ git commit -m 'Removing info on Invisible ink. It is not an edible sauce!'
~~~
{: .language-bash}

Expand All @@ -283,16 +290,16 @@ Git is smart enough to notice the missing file. Let us recreate the file and
commit it again.

~~~
$ echo "This is another name for fake planet X" > nibiru.txt
$ git add nibiru.txt
$ git commit -m 'adding nibiru again'
$ echo "This is anoher way to make invisible ink" > secret.md
$ git add secret.md
$ git commit -m 'adding invisible ink again'
~~~
{: .language-bash}

Now we remove the file with Unix `rm`:

~~~
$ rm nibiru.txt
$ rm secret.md
$ git status
~~~
{: .language-bash}
Expand All @@ -303,19 +310,19 @@ Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: nibiru.txt
deleted: secret.md
no changes added to commit (use "git add" and/or "git commit -a")
~~~
{: .output}

See how Git has noticed that the file `nibiru.txt` has been removed
See how Git has noticed that the file `secret.md` has been removed
from the disk. The next step is to "stage" the removal of the file
from the repository. This is done with the command `git rm` just as
before.

~~~
$ git rm nibiru.txt
$ git rm secret.md
$ git status
~~~
{: .language-bash}
Expand All @@ -325,7 +332,7 @@ On branch main
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: nibiru.txt
deleted: secret.md
~~~
{: .output}
Expand All @@ -334,36 +341,35 @@ The change that was made in Unix has now been staged and needs to be
committed.

~~~
$ git commit -m 'Removing info on Nibiru, again!'
$ git commit -m 'Removing info on invisible ink, again!'
~~~
{: .language-bash}

## Renaming a File

Another common change when working on a project is to rename a file.

Create a file for the planet Krypton:
Create a file for the whitesauce recipe:

~~~
$ echo "Superman's home planet" > krypton.txt
$ echo "Very fun recipe to do" > whitesauce.md
~~~
{: .language-bash}

Add it to the repository:

~~~
$ git add krypton.txt
$ git commit -m 'Adding planet Krypton'
$ git add whitesauce.md
$ git commit -m 'Adding white sauce recipe'
~~~
{: .language-bash}

We all know that Superman moved to Earth. Not that he had much
choice. Now his home planet is Earth.
We all know that white sauce has a more sophisticated name.

Rename the file `krypton.txt` to `earth.txt` with Git:
Rename the file `whitesauce.md` to `bechamel.md` with Git:

~~~
$ git mv krypton.txt earth.txt
$ git mv whitesauce.md bechamel.md
$ git status
~~~
{: .language-bash}
Expand All @@ -373,13 +379,13 @@ On branch main
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
renamed: krypton.txt -> earth.txt
renamed: whitesauce.md -> bechamel.md
~~~
{: .output}
The final step is commit our change to the repository:

~~~
$ git commit -m 'Superman's home is now Earth'
$ git commit -m 'Using the French name for the whitesauce'
~~~
{: .language-bash}

Expand All @@ -392,16 +398,16 @@ this time with Unix `mv`. First, we need to recreate the
`krypton.txt` file:

~~~
$ echo "Superman's home planet" > krypton.txt
$ git add krypton.txt
$ git commit -m 'Adding planet Krypton again.'
$ echo "Very fun recipe to do" > whitesauce.md
$ git add whitesauce.md
$ git commit -m 'Adding white sauce recipe'
~~~
{: .language-bash}

Let us rename the file and see what Git can figured out by itself:

~~~
$ mv krypton.txt earth.txt
$ mv whitesauce.md bechamel.md
$ git status
~~~
{: .language-bash}
Expand All @@ -412,24 +418,24 @@ Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: krypton.txt
deleted: whitesauce.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
earth.txt
bechamel.md
no changes added to commit (use "git add" and/or "git commit -a")
~~~
{: .output}

Git has noticed that the file `krypton.txt` has disappeared from the
file system and a new file `earth.txt` has showed up.
Git has noticed that the file `whitesauce.md` has disappeared from the
file system and a new file `bechamel.md` has showed up.

Add those changes to the staging area:

~~~
$ git add krypton.txt earth.txt
$ git add whitesauce.md bechamel.md
$ git status
~~~
{: .language-bash}
Expand All @@ -439,21 +445,21 @@ On branch main
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
renamed: krypton.txt -> earth.txt
renamed: whitesauce.md -> bechamel.md
~~~
{: .output}

Notice how Git has now figured out that the `krypton.txt` has not
Notice how Git has now figured out that the `whitesauce.md` has not
disappeared - it has simply been renamed.

The final step, as before, is to commit our change to the repository:

~~~
$ git commit -m 'Superman's home is Earth, told you before.'
$ git commit -m 'Using the French name for the whitesauce'
~~~
{: .language-bash}

## Further .gitignore concepts

For additional documentation on .gitignore, please reference
Expand Down
Loading

0 comments on commit ca6d833

Please sign in to comment.