Skip to content

Commit

Permalink
🥑 Changes planets for recipe example
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Sep 28, 2021
1 parent 7837e28 commit 5c3f297
Show file tree
Hide file tree
Showing 9 changed files with 482 additions and 441 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
[![Create a Slack Account with us](https://img.shields.io/badge/Create_Slack_Account-The_Carpentries-071159.svg)](https://swc-slack-invite.herokuapp.com/)
[![Slack Status](https://img.shields.io/badge/Slack_Channel-swc--git-E01563.svg)](https://swcarpentry.slack.com/messages/C91JS49HD)

git-novice
==========
UCL's git-novice
================

An introduction to version control for novices using Git.
Please see <https://swcarpentry.github.io/git-novice/> for a rendered version of this material,
[the lesson template documentation][lesson-example]
An introduction to version control for novices using Git (with the UCL's twist).
Please see [the rendered version of this material](http://github-pages.ucl.ac.uk/git-novice/),
and [the lesson template documentation][lesson-example]
for instructions on formatting, building, and submitting material,
or run `make` in this directory for a list of helpful commands.

Maintainers:
# Maintainers:

## Upstream

* [Nima Hejazi][hejazi_nima]: [@nhejazi](https://github.com/nhejazi)
* [Kat Koziar][koziar_kat]: [@kekoziar](https://github.com/kekoziar)
Expand All @@ -20,6 +22,12 @@ Alumni maintainers:
* [Ivan Gonzalez][gonzalez_ivan]: [@iglpdc](https://github.com/iglpdc)
* [Daisie Huang][huang_daisie]: [@daisieh](https://github.com/daisieh)


## UCL's

* David Pérez-Suárez [@dpshelio](https://github.com/dpshelio)


[gonzalez_ivan]: https://carpentries.org/instructors/#iglpdc
[hejazi_nima]: https://carpentries.org/instructors/#nhejazi
[huang_daisie]: https://software-carpentry.org/team/#huang_daisie
Expand Down
10 changes: 5 additions & 5 deletions _episodes/02-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ of configurations we will set as we get started with Git:

On a command line, Git commands are written as `git verb options`,
where `verb` is what we actually want to do and `options` is additional optional information which may be needed for the `verb`. So here is how
Dracula sets up his new laptop:
Alfredo sets up his new laptop:

~~~
$ git config --global user.name "Vlad Dracula"
$ git config --global user.email "[email protected]"
$ git config --global user.name "Alfredo Linguini"
$ git config --global user.email "[email protected]"
~~~
{: .language-bash}

Please use your own name and email address instead of Dracula's. This user name and email will be associated with your subsequent Git activity,
Please use your own name and email address instead of Alfredo's. This user name and email will be associated with your subsequent Git activity,
which means that any changes pushed to
[GitHub](https://github.com/),
[BitBucket](https://bitbucket.org/),
Expand Down Expand Up @@ -106,7 +106,7 @@ your changes, press <kbd>Esc</kbd> then type `:q!` and hit <kbd>Return</kbd>.
{: .callout}
Git (2.28+) allows configuration of the name of the branch created when you
initialize any new repository. Dracula decides to use that feature to set it to `main` so
initialize any new repository. Alfredo decides to use that feature to set it to `main` so
it matches the cloud service he will eventually use.
~~~
Expand Down
81 changes: 32 additions & 49 deletions _episodes/03-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,18 @@ keypoints:
Once Git is configured,
we can start using it.

We will continue with the story of Wolfman and Dracula who are investigating if it
is possible to send a planetary lander to Mars.

![motivatingexample](../fig/motivatingexample.png)
[Werewolf vs dracula](https://www.deviantart.com/b-maze/art/Werewolf-vs-Dracula-124893530)
by [b-maze](https://www.deviantart.com/b-maze) / [Deviant Art](https://www.deviantart.com/).
[Mars](https://en.wikipedia.org/wiki/File:OSIRIS_Mars_true_color.jpg) by European Space Agency /
[CC-BY-SA 3.0 IGO](https://creativecommons.org/licenses/by/3.0/deed.en).
[Pluto](https://commons.wikimedia.org/wiki/File:PIA19873-Pluto-NewHorizons-FlyingPastImage-20150714-transparent.png) /
Courtesy NASA/JPL-Caltech.
[Mummy](https://commons.wikimedia.org/wiki/File:Mummy_icon_-_Noun_Project_4070.svg)
&copy; Gilad Fried / [The Noun Project](https://thenounproject.com/) /
[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/deed.en).
[Moon](https://commons.wikimedia.org/wiki/File:Lune_ico.png)
&copy; Luc Viatour / [https://lucnix.be](https://lucnix.be/) /
[CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/deed.en).


We will help Alfredo with his new project, create a repository with all his recipes.

First, let's create a directory in `Desktop` folder for our work and then move into that directory:

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

Then we tell Git to make `planets` a [repository]({{ page.root }}{% link reference.md %}#repository)
Then we tell Git to make `recipes` a [repository]({{ page.root }}{% link reference.md %}#repository)
-- a place where Git can store versions of our files:


Expand All @@ -54,9 +37,9 @@ $ git init

It is important to note that `git init` will create a repository that
includes subdirectories and their files---there is no need to create
separate repositories nested within the `planets` repository, whether
separate repositories nested within the `recipes` repository, whether
subdirectories are present from the beginning or added later. Also, note
that the creation of the `planets` directory and its initialization as a
that the creation of the `recipes` directory and its initialization as a
repository are completely separate processes.

If we use `ls` to show the directory's contents,
Expand All @@ -68,7 +51,7 @@ $ ls
{: .language-bash}

But if we add the `-a` flag to show everything,
we can see that Git has created a hidden directory within `planets` called `.git`:
we can see that Git has created a hidden directory within `recipes` called `.git`:

~~~
$ ls -a
Expand Down Expand Up @@ -121,33 +104,33 @@ wording of the output might be slightly different.

> ## Places to Create Git Repositories
>
> Along with tracking information about planets (the project we have already created),
> Dracula would also like to track information about moons.
> Despite Wolfman's concerns, Dracula creates a `moons` project inside his `planets`
> Along with tracking information about recipes (the project we have already created),
> Alfredo would also like to track information about cocktails.
> Despite Jimmy's concerns, Alfredo creates a `cocktails` project inside his `recipes`
> project with the following sequence of commands:
>
> ~~~
> $ cd ~/Desktop # return to Desktop directory
> $ cd planets # go into planets directory, which is already a Git repository
> $ ls -a # ensure the .git subdirectory is still present in the planets directory
> $ mkdir moons # make a subdirectory planets/moons
> $ cd moons # go into moons subdirectory
> $ git init # make the moons subdirectory a Git repository
> $ ls -a # ensure the .git subdirectory is present indicating we have created a new Git repository
> $ cd ~/Desktop # return to Desktop directory
> $ cd recipes # go into recipes directory, which is already a Git repository
> $ ls -a # ensure the .git subdirectory is still present in the recipes directory
> $ mkdir cocktails # make a sub-directory recipes/cocktails
> $ cd cocktails # go into cocktails subdirectory
> $ git init # make the cocktails subdirectory a Git repository
> $ ls -a # ensure the .git subdirectory is present indicating we have created a new Git repository
> ~~~
> {: .language-bash}
>
> Is the `git init` command, run inside the `moons` subdirectory, required for
> tracking files stored in the `moons` subdirectory?
>
> Is the `git init` command, run inside the `cocktails` subdirectory, required for
> tracking files stored in the `cocktails` subdirectory?
>
> > ## Solution
> >
> > No. Dracula does not need to make the `moons` subdirectory a Git repository
> > because the `planets` repository will track all files, sub-directories, and
> > subdirectory files under the `planets` directory. Thus, in order to track
> > all information about moons, Dracula only needed to add the `moons` subdirectory
> > to the `planets` directory.
> >
> > No. Alfredo does not need to make the `cocktails` subdirectory a Git repository
> > because the `recipes` repository will track all files, sub-directories, and
> > subdirectory files under the `recipes` directory. Thus, in order to track
> > all information about cocktails, Alfredo only needed to add the `cocktails` subdirectory
> > to the `recipes` directory.
> >
> > Additionally, Git repositories can interfere with each other if they are "nested":
> > the outer repository will try to version-control
> > the inner repository. Therefore, it's best to create each new Git
Expand All @@ -167,9 +150,9 @@ wording of the output might be slightly different.
> {: .solution}
{: .challenge}
> ## Correcting `git init` Mistakes
> Wolfman explains to Dracula how a nested repository is redundant and may cause confusion
> down the road. Dracula would like to remove the nested repository. How can Dracula undo
> his last `git init` in the `moons` subdirectory?
> Jimmy explains to Alfredo how a nested repository is redundant and may cause confusion
> down the road. Alfredo would like to remove the nested repository. How can Alfredo undo
> his last `git init` in the `cocktails` subdirectory?
>
> > ## Solution -- USE WITH CAUTION!
> >
Expand All @@ -188,11 +171,11 @@ wording of the output might be slightly different.
> >
> > ### Solution
> > Git keeps all of its files in the `.git` directory.
> > To recover from this little mistake, Dracula can just remove the `.git`
> > folder in the moons subdirectory by running the following command from inside the `planets` directory:
> > To recover from this little mistake, Alfredo can just remove the `.git`
> > folder in the cocktails subdirectory by running the following command from inside the `recipes` directory:
> >
> > ~~~
> > $ rm -rf moons/.git
> > $ rm -rf cocktails/.git
> > ~~~
> > {: .language-bash}
> >
Expand Down
Loading

0 comments on commit 5c3f297

Please sign in to comment.