diff --git a/.gitkit-cspell.txt b/.gitkit-cspell.txt index 840d6ba..3e826b8 100644 --- a/.gitkit-cspell.txt +++ b/.gitkit-cspell.txt @@ -1,5 +1,4 @@ automations -devenv farmdata foss gitkit @@ -9,7 +8,6 @@ halign HFOSSedu inclusivity kitclient -nbsp opensource POGIL Runestone diff --git a/README.md b/README.md index 3c71d5c..7729e19 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ This repository contains the pretext source for the GitKit Runestone texts. -If you are interested in using the GitKit Text please see the Instructor Guide in the text on Runestone by using one of the following link: [GitKit](https://runestone.academy/ns/books/published/gitkitlinux/the-gitkit-book.html?mode=browsing) +If you are interested in using the GitKit Text please see the Instructor Guide in the text on Runestone by using one of the following links: +- [GitKit (Linux Desktop Edition)](https://runestone.academy/ns/books/published/gitkitlinux/the-gitkit-book.html?mode=browsing) - students work in a full Linux desktop environment in this edition. +- [GitKit (VSCode Edition)](https://runestone.academy/ns/books/published/gitkitvscode/the-gitkit-book.html?mode=browsing) - students work within the VSCode IDE in this edition. ## Licensing @@ -299,19 +301,76 @@ An `` containing ``s can be used to create a question with multi Note: - Fill-in questions are not currently suported within a ``. A [free response question](https://runestone.academy/ns/books/published/PTXSB/rune-20.html) (with [source](https://runestone.academy/ns/books/published/PTXSB/rune-20.html)) should be used instead. Note that the free response box only renders when running in Runestone. This is because free response must be hand graded and cannot be auto checked in a static web deploy. See [Using a fill in the blank exercise in a task](https://groups.google.com/g/pretext-support/c/VWLb_W0AT18) for updates on this issue. -#### Text Versions +#### Adding Version Specific Content -There are 3 versions of the text that can be built: +There are 10 versions of the text that can be built: -- `web` - An HTML version of the text. This will some but not all of the interactive Runestone question types. -- `print` - A PDF version of the text. -- `runestone` - The version built to be served by Runestone Academy. +- `student-web-linux` and `student-print-linux` - The Linux KitClient book as students will see it. +- `student-web-vscode` and `student-print-vscde` - The VSCode KitClient book as students will see it. + +- `instructor-web-linux` and `instructor-print-linux` - The Linux KitClient book including notes to the instructor (see below). +- `instructor-web-vscode` and `instructor-print-vscode` - The VSCode KitClient book including notes to the instructor (see below). + +- `web` and `print` - same as the instructor Linux version. This is included for the CodeChat preview. ##### Building a Specific Version Any of these versions can be built using "Build another target..." option on the `PreTeXt` menu or by using terminal commands similar to: ```text -pretext build web -pretext view web -``` \ No newline at end of file +pretext build instructor-web-linux +pretext view instructor-web-linux +``` + +##### Adding KitClient Specific Content + +Content specific to a given kit client is indicated by adding a `component` attribute to to divisions/elements as follows: + +``` +

+ This text appears only in the Linux Kit Client versions. +

+ +

+ This text appears only in the VSCode Kit Client versions. +

+``` + +- If a division/element will appear only in the `linux` or `vscode` version of the text its `xml:id` should have a suffix indicating its version. +- If two divisions/elements provide alternate content for the `linux` and `vscode` versions their `xml:ids` will be the same except for the suffix. + +##### Instructor Version Content + +A `commentary` element with the `component="instructor"` attrribute is used to add instructor guide information directly to the source text as follows: + +```xml + + + + + +

+ Instructor Note:: Information for the instructor appears here. +

+
+
+
+
+``` + +Note: +- The `` is included to place all comments for the instructor into a box. + +##### Defining a Version + +The available versions are defined by the ``s in the `project.ptx` file. Each `` references a `.ptx` file in the `publication` folder that indicates the content that will appear in the version. + +##### Publishing a Version + +Runestone does not currently support the publication of different versions of a text from a single repository. Instead, the solution is to create a fork of this repository. Then in that repository change the `publication` file that is the `target` of the `runestone` target to point to the `publication` file for the version that you would like to publish. Then create a new Runestone text using that repository. + +See the [GitKit-VSCode Repository](https://github.com/HFOSSedu/GitKit-VSCode) for an example. That repository also includes information about how to update it from this repository when edits are made. diff --git a/materials/images/GitKit-Text-Soure-Images.pptx b/materials/images/GitKit-Text-Soure-Images.pptx index cfd38e2..54728fd 100644 Binary files a/materials/images/GitKit-Text-Soure-Images.pptx and b/materials/images/GitKit-Text-Soure-Images.pptx differ diff --git a/materials/slides/Ch5-MergeConflicts.pptx b/materials/slides/Ch5-MergeConflicts.pptx index e3099ca..f6e8aab 100644 Binary files a/materials/slides/Ch5-MergeConflicts.pptx and b/materials/slides/Ch5-MergeConflicts.pptx differ diff --git a/project.ptx b/project.ptx index 3f2fabc..a930d8c 100644 --- a/project.ptx +++ b/project.ptx @@ -2,10 +2,27 @@ - - + + - + + + + + + + + + + + + + + + diff --git a/publication/publication-instructor-linux.ptx b/publication/publication-instructor-linux.ptx new file mode 100644 index 0000000..f07770e --- /dev/null +++ b/publication/publication-instructor-linux.ptx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/publication/publication-instructor-vscode.ptx b/publication/publication-instructor-vscode.ptx new file mode 100644 index 0000000..4b85f3e --- /dev/null +++ b/publication/publication-instructor-vscode.ptx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/publication/publication-linux.ptx b/publication/publication-linux.ptx new file mode 100644 index 0000000..6e00d3c --- /dev/null +++ b/publication/publication-linux.ptx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/publication/publication-runestone.ptx b/publication/publication-runestone-linux.ptx similarity index 96% rename from publication/publication-runestone.ptx rename to publication/publication-runestone-linux.ptx index ee1f54c..f8600a2 100644 --- a/publication/publication-runestone.ptx +++ b/publication/publication-runestone-linux.ptx @@ -34,6 +34,7 @@ + @@ -88,8 +89,12 @@ diff --git a/publication/publication-runestone-vscode.ptx b/publication/publication-runestone-vscode.ptx new file mode 100644 index 0000000..7ff25c8 --- /dev/null +++ b/publication/publication-runestone-vscode.ptx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/publication/publication-example.ptx b/publication/publication-student-linux.ptx similarity index 97% rename from publication/publication-example.ptx rename to publication/publication-student-linux.ptx index 913a4e4..fe0593b 100644 --- a/publication/publication-example.ptx +++ b/publication/publication-student-linux.ptx @@ -21,7 +21,7 @@ - + @@ -34,6 +34,7 @@ + @@ -60,7 +61,7 @@ - + @@ -69,7 +70,7 @@ - + diff --git a/publication/publication-student-vscode.ptx b/publication/publication-student-vscode.ptx new file mode 100644 index 0000000..e2c843d --- /dev/null +++ b/publication/publication-student-vscode.ptx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/publication/publication-vscode.ptx b/publication/publication-vscode.ptx new file mode 100644 index 0000000..d6aaf27 --- /dev/null +++ b/publication/publication-vscode.ptx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/publication/publication.ptx b/publication/publication.ptx index 2168e70..913a4e4 100644 --- a/publication/publication.ptx +++ b/publication/publication.ptx @@ -21,7 +21,7 @@ - DRAFT FOR REVIEW ONLY + @@ -60,7 +60,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -104,8 +104,12 @@ diff --git a/source/ch-communities-and-collaboration/ch-communities-and-collaboration.ptx b/source/ch-communities-and-collaboration/ch-communities-and-collaboration.ptx index 616af94..9622b73 100644 --- a/source/ch-communities-and-collaboration/ch-communities-and-collaboration.ptx +++ b/source/ch-communities-and-collaboration/ch-communities-and-collaboration.ptx @@ -19,7 +19,7 @@ - + diff --git a/source/ch-communities-and-collaboration/images/DevEnv-Blank-Ready.png b/source/ch-communities-and-collaboration/images/DevEnv-Blank-Ready.png deleted file mode 100644 index f63c3f7..0000000 Binary files a/source/ch-communities-and-collaboration/images/DevEnv-Blank-Ready.png and /dev/null differ diff --git a/source/ch-communities-and-collaboration/images/DevEnv-Request-PAT.png b/source/ch-communities-and-collaboration/images/DevEnv-Request-PAT.png deleted file mode 100644 index 8ab2171..0000000 Binary files a/source/ch-communities-and-collaboration/images/DevEnv-Request-PAT.png and /dev/null differ diff --git a/source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx b/source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx index b0cff98..173309f 100644 --- a/source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx +++ b/source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx @@ -1,724 +1,520 @@ -
+
Cloning Your Origin -

- The next step in the basic FOSS workflow is to ensure that you have a clone of your origin repository in your development environment as shown in . - Having a clone of your origin in your development environment will allow you to edit the files to fix the issue that you have been assigned and add those changes to the repository. +

+ The next step in the basic FOSS workflow is to ensure that you have a clone your origin repository in your development environment as shown in . Having a clone of your origin in your development environment will allow you to edit the files to fix the issue that you have been assigned and add those changes to the repository.

-

- Cloning your origin repository from your GitHub space to your development environment. +
+ + Cloning your origin repository from your GitHub space to your development environment. + - - Creating a clone of your origin repository creates a copy of it in your development environment. - This copy is your local copy. + Creating a clone of your origin repository creates a copy of it in your development environment. This copy is your local copy.

- - - - Clone URL - -

- In order to clone a repository into your development environment you will need the clone URL for that repository. - The steps in this section will help you find the clone URL for your origin repository. +

+ In some development environments cloning the origin requires that you use a command like git clone <originURL>.git to create the clone.

- - - - <exercise xml:id="ex-find-clone-url-linux-a" label="ex-find-clone-url-linux-a"> - <statement> - <p> - Visit the GitHub page for your origin repository. - </p> - </statement> - - <hint> - <p> - You can find the URl of your origin (i.e. - your fork of the GitKit FarmData2 upstream) in your answer to <xref ref="ex-fork-url" />. - </p> - </hint> - </exercise> - - <exercise xml:id="ex-find-clone-url-linux-b" label="ex-find-clone-url-linux-b"> - <statement> - <p> - Find and click the green "Code" button. - <image source="images/ch-communities-and-collaboration/codeButton.png" width="10%"> - <description> - The green "Code" button in GitHub. - </description> - </image> - </p> - </statement> - </exercise> - - <exercise xml:id="ex-find-clone-url-linux-c" label="ex-find-clone-url-linux-c"> - <statement> - <p> - Open the "Local" and "HTTPS" tabs as shown here: <image source="images/ch-communities-and-collaboration/gitHubCloneURL.png" width="50%"> - <description> - The GitHub dialog showing the clone URL. - </description> - </image> - The URL in the "Clone using the web URL" box is the clone URL that you will need to clone your origin repository. - </p> - </statement> - </exercise> - - <exercise xml:id="ex-clone-url-linux" label="ex-clone-url-linux"> - <statement> - <p> - Copy and paste the clone URL that you will use to clone your origin as your answer to this exercise. - </p> - - <p> - <var width="55" /> - </p> - </statement> - <setup> <var> <condition string="^https://github.com/(?!(FarmData2|DickinsonCollege)).+/.+.git$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string="^https://github.com/DickinsonCollege/.+.git"> - - <feedback> - <p> - It looks like you might be trying to use the upstream repository instead of your origin. - </p> - </feedback> - </condition> <condition string="^https://github.com/FarmData2/.+.git"> - - <feedback> - <p> - It looks like you might be trying to use the upstream repository instead of your origin. - </p> - </feedback> - </condition> <condition string=".*"> - - <feedback> - <p> - The clone URL should have the format <c>https://github.com/yourGitHubUsername/theRepoName.git</c>. - </p> - </feedback> - </condition> </var> </setup> - - <hint> - <p> - Be sure you are using your GitHub origin repository (see <xref ref="ex-fork-url" />). - This clone URL should contain your GitHub username and end in <c>.git</c>. - </p> - </hint> - </exercise> - </exercises> - </subsection> - - - <subsection xml:id="topic-git-clone" xmlns:xi="http://www.w3.org/2001/XInclude" > - - <title><c>git clone</c> - -

- The git clone command will make a copy of your fork on GitHub and make the Local Copy on your computer (in your development environment). - Refer to Figure. -

- -

- Now that you have the clone URL for your origin repository, use the steps in this section to clone your origin into your development environment. -

- - - - -<exercise xml:id="ex-clone-origin-linux" label="ex-clone-origin-linux"> - <statement> - <p> - The <c>git clone <URL></c> command is used to clone your origin repository into your development environment. - </p> - <p> - Give a command that will clone your origin into your development environment. + <p component="vscode-kit-client"> + However, the development environment you have opened in GitPod simplifies this process for you. Recall, that you provided the URL of your origin repository when opening the development environment in <xref ref="ex-create-kit-client-vscode-b" />. When you did that, a clone of your origin was automatically created for you in your development environment. </p> - <p> - <var width="65" /> - </p> - </statement> - <setup> <var> <condition string="^https://github.com/(?!(FarmData2|DickinsonCollege)).+/.+.git$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string="^https://github.com/DickinsonCollege/.+.git"> - - <feedback> - <p> - It looks like you might be trying to use the upstream repository instead of your origin. - </p> - </feedback> - </condition> <condition string="^https://github.com/FarmData2/.+.git"> - - <feedback> - <p> - It looks like you might be trying to use the upstream repository instead of your origin. - </p> - </feedback> - </condition> <condition string=".*"> - - <feedback> - <p> - Be sure to replace <c><URL></c> with the clone URL you found in <xref ref="ex-clone-url-linux" />. The clone URL should have the format <c>https://github.com/yourGitHubUsername/theRepoName.git</c>. - </p> - </feedback> - </condition> </var> </setup> -</exercise> -<exercise xml:id="ex-clone-origin-linux-a" label="ex-clone-origin-linux-a"> - <p> - Execute your command from <xref ref="ex-clone-origin-linux" /> in your terminal. - </p> -</exercise> - -<exercise xml:id="ex-clone-origin-linux-b" label="ex-clone-origin-linux-b"> - <statement> - <p> - Which of the following appear in the output from entering the command from <xref ref="ex-clone-origin-linux-a" />? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - Cloning into - </statement> - </choice> - - <choice correct="no"> - <statement> - Sending objects - </statement> - </choice> - - <choice correct="no"> - <statement> - Deleting objects - </statement> - </choice> - - <choice correct="yes"> - <statement> - Resolving deltas - </statement> - </choice> - - <choice correct="yes"> - <statement> - Counting objects - </statement> - </choice> - - <choice correct="no"> - <statement> - local: - </statement> - </choice> - </choices> - - <hint> - <p> - Look at the output in your terminal. - </p> - </hint> -</exercise> - -<exercise xml:id="ex-clone-origin-linux-c" label="ex-clone-origin-linux-c"> - <statement> - <p> - Which line of output from entering the command from <xref ref="ex-clone-origin-linux-a" /> indicates the directory into which the repository was cloned? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - Cloning into - </statement> - </choice> - - <choice correct="no"> - <statement> - remote: Enumerating objects - </statement> - </choice> - - <choice correct="no"> - <statement> - remote: Counting objects - </statement> - </choice> - - <choice correct="no"> - <statement> - remote: Total - </statement> - </choice> - - <choice correct="no"> - <statement> - Receiving objects - </statement> - </choice> - - <choice correct="no"> - <statement> - Resolving deltas - </statement> - </choice> - </choices> - - <hint> - <p> - Look for a line in the output that begins with "Cloning into". - </p> - </hint> -</exercise> - -<exercise xml:id="ex-clone-origin-linux-d" label="ex-clone-origin-linux-d"> - <statement> - <p> - Use the <c>ls</c> command to confirm that the directory you identified in <xref ref="ex-clone-origin-linux-c" /> now exists. - </p> - - <p> - If it it does not, check the output in <xref ref="ex-clone-origin-linux-b" /> for error messages and try <xref ref="ex-clone-origin-linux-a" /> again. - </p> - </statement> -</exercise> -</exercises> -</subsection> - -<subsection xml:id="topic-explore-clone-linux"> - <title>Exploring Your Cloned Repository In Your Development Environment - -

- In this section you will briefly explore the GitKit FarmData2 repository that you have cloned into your development environment. -

- - - -<exercise xml:id="ex-explore-clone-linux-a" label="ex-explore-clone-linux-a"> - <statement> - <p> - Use the <c>cd</c> command in the Terminal to change into the directory containing your clone of the GitKit FarmData2 repository. - </p> - - <p> - See <xref ref="ex-clone-origin-linux-c" /> for the name of the directory. - </p> - </statement> -</exercise> + </introduction> - <exercise xml:id="ex-explore-clone-linux-b" label="ex-explore-clone-linux-b"> - <statement> - <p> - Use the <c>ls -a</c> command to display the names of all of the files and directories in your clone of the GitKit FarmData2 repository. - </p> + <!-- Linux KitClient --> + <exercises> + <title /> - <p> - Compare these files and directories to those in your origin repository on GitHub. - </p> - <p> - Check all files and directories that do not appear both locally and on GitHub. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> + <exercise + xml:id="ex-find-clone-url-linux" + label="ex-find-clone-url-linux" + component="linux-kit-client"> + <introduction> + In order to clone a repository into your development environment you will need the <term>clone URL</term> for that repository. The steps in this exercise will help you find the clone URL for your origin repository. + </introduction> + <task + xml:id="ex-find-clone-url-linux-a" + label="ex-find-clone-url-linux-a"> <statement> <p> - <c>.</c> + Visit the GitHub page for your origin repository. </p> </statement> - </choice> - - <choice correct="yes"> - <statement> + <hint> <p> - <c>..</c> + You can find the URl of your origin (i.e. your fork of the GitKit FarmData2 upstream) in your answer to <xref ref="ex-fork-url" />. </p> - </statement> - </choice> - - <choice correct="yes"> + </hint> + </task> + <task + xml:id="ex-find-clone-url-linux-b" + label="ex-find-clone-url-linux-b"> <statement> <p> - <c>.git</c> + Find and click the green "Code" button. + + <image source="images/ch-communities-and-collaboration/codeButton.png" + width="10%"> + <description> + The green "Code" button in GitHub. + </description> + </image> </p> </statement> - </choice> - - <choice> + </task> + <task + xml:id="ex-find-clone-url-linux-c" + label="ex-find-clone-url-linux-c"> <statement> <p> - <c>README.md</c> - </p> - </statement> - </choice> + Open the "Local" and "HTTPS" tabs as shown here: - <choice> - <statement> - <p> - <c>.kit</c> - </p> - </statement> - </choice> - <choice> - <statement> - <p> - <c>.vscode</c> + <image source="images/ch-communities-and-collaboration/gitHubCloneURL.png" + width="50%"> + <description> + The GitHub dialog showing the clone URL. + </description> + </image> + + The URL in the "Clone using the web URL" box is the clone URL that you will need to clone your origin repository. </p> </statement> - </choice> - </choices> -</exercise> - -</exercises> - -</subsection> - - - - - -<subsection xml:id="topic-git-remote"> - <title><c>git remote</c> - -

- In this section you will see that your clone keeps track of the location of your origin repository. - It does this using a piece of information called a remote, which Git uses to store the URLs of remote repositories in the cloud (e.g. - on GitHub). -

- -

- The command git remote on its own will show you the names of the remotes that git knows about, but not their URLS. -

- -

- If you want to have git display the URLs of the remotes as well, you will need to add the -v or --verbose flag: git remote -v -

+ + - - -<exercise xml:id="ex-check-remotes-a" label="ex-check-remotes-a"> - <statement> - <p> - Which command will show you the URL(s) of the remote(s) that git knows about? - </p> + <exercise + xml:id="ex-clone-url-linux" + label="ex-clone-url-linux" + component="linux-kit-client"> + <statement> + <p> + Copy and paste the clone URL that you will use to clone your origin as your answer to this exercise. + </p> + <p> + <var width="55" /> + </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>git remote -v</c> - </p> - </statement> - </choice> + + <setup> + <var> + <condition string="^https://github.com/(?!(FarmData2|DickinsonCollege)).+/.+.git$"> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> + <condition string="^https://github.com/DickinsonCollege/.+.git"> + <feedback> + <p> + It looks like you might be trying to use the upstream repository instead of your origin. + </p> + </feedback> + </condition> + <condition string="^https://github.com/FarmData2/.+.git"> + <feedback> + <p> + It looks like you might be trying to use the upstream repository instead of your origin. + </p> + </feedback> + </condition> + <condition string=".*"> + <feedback> + <p> + The clone URL should have the format <c>https://github.com/yourGitHubUsername/theRepoName.git</c>. + </p> + </feedback> + </condition> + </var> + </setup> + <hint> + Be sure you are using your GitHub origin repository (see <xref ref="ex-fork-url" />). This clone URL should contain your GitHub username and end in <c>.git</c>. + </hint> + </exercise> - <choice> + <exercise + xml:id="ex-clone-origin-linux" + label="ex-clone-origin-linux" + component="linux-kit-client"> + <introduction> + <p> + Now that you have the clone URL for your origin repository, use the tasks in this exercise to clone your origin into your development environment. + </p> + </introduction> + <task + xml:id="ex-clone-origin-linux-a" + label="ex-clone-origin-linux-a"> <statement> <p> - <c>git remote</c> + Use the following command in the Terminal to clone your origin repository into your development environment: </p> - </statement> - </choice> - - <choice> - <statement> <p> - <c>git remote -url</c> + <c>git clone <clone URL></c> </p> - </statement> - </choice> - - <choice> - <statement> <p> - <c>git url</c> + Be sure to replace <c><clone URL></c> with the clone URL you found in <xref ref="ex-clone-url-linux" />. </p> </statement> - </choice> - </choices> - - <hint> - <p> - You are asking <c>git remote</c> to give you more information. - </p> - </hint> - </exercise> - - <exercise xml:id="ex-check-remotes-b" label="ex-check-remotes-b"> - <statement> - <p> - Execute the command <c>git remote -v</c> in your terminal. How can you tell from that output that your clone knows about your origin? - </p> - </statement> - - <choices randomize="yes"> - <choice correct="yes"> + </task> + <task + xml:id="ex-clone-origin-linux-b" + label="ex-clone-origin-linux-b"> <statement> - <p> - The "origin" lines have a URL with your GitHub username in them. - </p> + Copy and paste the output from your command in <xref ref="ex-clone-origin-linux-a" /> as your answer here. </statement> - </choice> - - <choice> + <response /> + </task> + <task + xml:id="ex-clone-origin-linux-c" + label="ex-clone-origin-linux-c"> <statement> + Examine the output in <xref ref="ex-clone-origin-linux-b" />. Into which directory in your development environment was your GitKit FarmData2 origin cloned? + </statement> + <response /> + <hint> <p> - There are lines that say "origin". + Look for a line in the output that begins with "Cloning into". </p> - </statement> - </choice> - - <choice> + </hint> + </task> + <task + xml:id="ex-clone-origin-linux-d" + label="ex-clone-origin-linux-d"> <statement> <p> - The "origin" lines have a URL that points to GitHub. + Use the <c>ls</c> command to confirm that the directory you identified in <xref ref="ex-clone-origin-linux-c" /> now exists. </p> - </statement> - </choice> - - <choice> - <statement> <p> - It is not possible to tell from the output. + If it it does not, check the output in <xref ref="ex-clone-origin-linux-b" /> for error messages and try <xref ref="ex-clone-origin-linux-a" /> again. </p> </statement> - </choice> - </choices> - - <hint> - <p> - Look closely at the "origin" URLs. - </p> - </hint> - </exercise> + </task> + </exercise> - <exercise xml:id="ex-check-remotes-c" label="ex-check-remotes-c"> - <statement> - <p> - How is the origin remote that you see in the output of the <xref ref="ex-check-remotes-b" /> command represented in <xref ref="fig-basic-workflow-clone" />? - </p> - </statement> + <exercise + xml:id="ex-kit-tty-linux" + label="ex-kit-tty-linux" + component="linux-kit-client"> + <statement> + <p> + The the output in <xref ref="ex-clone-origin-linux-b" /> should contain a message from the <term>Kit-tty</term>. What is the <term>Kit-tty</term>? + </p> + </statement> + <response /> + <hint> + <p> + The "Kit-tty" introduces itself using the line + "😺💻 Meow, Kit-tty here!" Read the description of the "Kit-tty" that follows this line. + </p> + </hint> + </exercise> + <p component="linux-kit-client"> + Be sure to keep your eyes open for messages from the Kit-tty as you work on the GitKit exercises. The Kit-tty will help you to stay on track and may save you a lot of time by preventing you from going down an incorrect path. + </p> - <choices randomize="yes"> - <choice correct="yes"> + <exercise + xml:id="ex-close-terminal-linux" + label="ex-close-terminal-linux" + component="linux-kit-client"> + <introduction> + <p> + Use the final line of output in <xref ref="ex-clone-origin-linux-b" /> that begins with "IMPORTANT" to complete this exercise. + </p> + </introduction> + <task + xml:id="ex-close-terminal-linux-a" + label="ex-close-terminal-linux-a"> <statement> <p> - The orange dotted arrow from the clone to the origin repository. + What does the "IMPORTANT" line ask you to do? </p> </statement> - </choice> - - <choice> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + Close the terminal and open a new one. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Take the Kit-tty for a walk. + </p> + </statement> + <feedback> + <p> + I'm sure the Kit-tty would like that, but its not the correct answer. + </p> + </feedback> + </choice> + <choice> + <statement> + <p> + Use the <c>git clone</c> command. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Delete some unnecessary files. + </p> + </statement> + </choice> + </choices> + </task> + <task + xml:id="ex-close-terminal-linux-b" + label="ex-close-terminal-linux-b"> <statement> <p> - The orange dotted arrow from the origin to the upstream repository. + If you haven't already, close the Terminal you are currently using and open a new one. </p> - </statement> - </choice> - - <choice> - <statement> <p> - The orange dotted arrow from the clone to the upstream repository. + There is a technical reason for having to close your current Terminal and open a new. But the details for why this is necessary are unimportant. </p> </statement> - </choice> + </task> + </exercise> - <choice> + <exercise + xml:id="ex-explore-clone-linux" + label="ex-explore-clone-linux" + component="linux-kit-client"> + <introduction> + <p> + In this exercise you will briefly explore the GitKit FarmData2 repository that you have cloned into your development environment. + </p> + </introduction> + <task + xml:id="ex-explore-clone-linux-a" + label="ex-explore-clone-linux-a"> <statement> <p> - The blue "Clone" arrow from the origin to the cloned repository. + Use the <c>cd</c> command in the Terminal to change into the directory containing your clone of the GitKit FarmData2 repository. </p> </statement> - </choice> - - <choice> - <statement> + <hint> <p> - The origin remote is not represented in the figure. + See <xref ref="ex-clone-origin-linux-c" /> for the name of the directory. </p> - </statement> - </choice> - </choices> - - <hint> - <p> - Which arrow would represent the clone knowing the location of the origin? - </p> - </hint> - </exercise> - - <exercise xml:id="ex-check-remotes-d" label="ex-check-remotes-d"> - <statement> - <p> - Which step of the basic FOSS workflow requires that your clone know the location of your origin repository? - </p> - </statement> - - - <choices randomize="yes"> - <choice> + </hint> + </task> + <task + xml:id="ex-explore-clone-linux-b" + label="ex-explore-clone-linux-b"> <statement> <p> - Pull request + Use the <c>ls -a</c> command to display the names of all of the files and directories in your clone of the GitKit FarmData2 repository. </p> - </statement> - </choice> - - <choice> - <statement> <p> - Fork + Compare these files and directories to those in your origin repository on GitHub. Are there any differences? If so describe them here. </p> </statement> - </choice> + <response /> + </task> + </exercise> - <choice> - <statement> - <p> - Clone - </p> - </statement> - </choice> + <!-- VSCode KitClient --> + <exercise + xml:id="ex-explore-clone-vscode" + label="ex-explore-clone-vscode" + component="vscode-kit-client"> + <statement> + <p> + The development environment displays the files and directories contained in your clone in the "Explorer" panel at the left of the window. You can also see a list of these files and directories by using the <c>ls -a</c> command in the Terminal. + </p> + <p> + Compare these files and directories to those in your origin repository on GitHub. Are there any differences? If so describe them here. + </p> + </statement> + <response /> + </exercise> - <choice> + <!-- Both KitClients --> + <exercise + xml:id="ex-check-remotes" + label="ex-check-remotes"> + <introduction> + <p> + In this exercise you will see that your clone keeps track of the location of your origin repository. It does this using a piece of information called a <term>remote</term>, which Git uses to store the URLs of remote repositories in the cloud (e.g. on GitHub). + </p> + </introduction> + <task + xml:id="ex-check-remotes-a" + label="ex-check-remotes-a"> <statement> <p> - Edit + Use the following command to ask Git to display a list of the remote repositories (i.e. those on GitHub) that it knows about: </p> - </statement> - </choice> - - <choice correct="yes"> - <statement> <p> - Push + <c>git remote -v</c> </p> - </statement> - </choice> - </choices> - - <hint> - <p> - Think about which step of the basic FOSS workflow will need to send information from the clone back to the origin. - </p> - </hint> - </exercise> - </exercises> - </subsection> - -<subsection xml:id="topic-open-repo-folder"> - <title>Opening the GitKit-FarmData2 Repository Folder - -

- You cloned your GitKit-FarmData2 respitory into a folder in your development environment with the command in . -

- -

- But, you need to reopen your development environment in that folder to take advantage of all of the features that the KitClient provides for you. -

- - - - - <exercise xml:id="ex-open-repo-folder" label="ex-open-repo-folder"> - <statement> - <p> - Open the GitKit-FarmData2 folder. - </p> - <p> - You can do this by going to the "hamburger" (≡) menu in the upper left of your development environment window. - </p> - <p> - Choose <c>File > Open Folder...</c> - </p> - <p> - Select the <c>GitKit-FarmData2</c> folder and click <c>OK</c>. - </p> - <p> - You will see <c>Setting up your Codespace</c>, and then your terminal will show a message from the <term>Kit-tty</term>. - </p> - </statement> - </exercise> - - <exercise xml:id="ex-kit-tty-linux" label="ex-kit-tty-linux"> - <statement> - <p> - The the output in <xref ref="ex-open-repo-folder" /> should contain a message from the <term>Kit-tty</term>. - What is the <term>Kit-tty</term>? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> <p> - Your personal virtual assistant. + Copy and paste the output of the <c>git remote -v</c> command here. </p> </statement> - </choice> + <response /> + </task> - <choice> + <task + xml:id="ex-check-remotes-b" + label="ex-check-remotes-b"> <statement> <p> - A terminal. + Examine the output in <xref ref="ex-check-remotes-a" />. How can you tell from that output that your clone knows about your origin? </p> </statement> - </choice> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + The "origin" lines have a URL with your GitHub username in them. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + There are lines that say "origin". + </p> + </statement> + </choice> + <choice> + <statement> + <p> + The "origin" lines have a URL that points to GitHub. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + It is not possible to tell from the output. + </p> + </statement> + </choice> + </choices> + <hint> + Look closely at the "origin" URLs. + </hint> + </task> - <choice> + <task + xml:id="ex-check-remotes-c" + label="ex-check-remotes-c"> <statement> <p> - A teletypewriter. + How is the origin remote that you see in the output of the <xref ref="ex-check-remotes-a" /> command represented in <xref ref="fig-basic-workflow-clone" />? </p> </statement> - </choice> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + The orange dotted arrow from the clone to the origin repository. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + The orange dotted arrow from the origin to the upstream repository. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + The orange dotted arrow from the clone to the upstream repository. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + The blue "Clone" arrow from the origin to the cloned repository. + </p> + </statement> + </choice> + <choice> + <statement> + <p> + The origin remote is not represented in the figure. + </p> + </statement> + </choice> + </choices> + <hint> + Which arrow would represent the clone knowing the location of the origin? + </hint> + </task> - <choice> - <statement> + <task + xml:id="ex-check-remotes-d" + label="ex-check-remotes-d"> + <statement> <p> - A pet kitten. + Which step of the basic FOSS workflow requires that your clone know the location of your origin repository? </p> </statement> - </choice> - </choices> - <hint> - <p> - The "Kit-tty" introduces itself using the line "😺💻 Meow, Kit-tty here!" Read the description of the "Kit-tty" that follows this line. - </p> - </hint> -</exercise> -</exercises> - -<p> - Be sure to keep your eyes open for messages from the Kit-tty as you work on the GitKit exercises. - The Kit-tty will help you to stay on track and may save you a lot of time by preventing you from going down an incorrect path. -</p> - -</subsection> -<!--- - + <choices randomize="yes"> + <choice> + <statement> + <p> + Pull request + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Fork + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Clone + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Edit + </p> + </statement> + </choice> + <choice correct="yes"> + <statement> + <p> + Push + </p> + </statement> + </choice> + </choices> + <hint> + Think about which step of the basic FOSS workflow will need to send information from the clone back to the origin. + </hint> + </task> ---> + </exercise> + </exercises> </section> diff --git a/source/ch-communities-and-collaboration/sec-development-environment.ptx b/source/ch-communities-and-collaboration/sec-development-environment.ptx index 5992e6d..41f1270 100644 --- a/source/ch-communities-and-collaboration/sec-development-environment.ptx +++ b/source/ch-communities-and-collaboration/sec-development-environment.ptx @@ -9,564 +9,609 @@ <introduction xml:id="topic-dev-env-intro"> <p> - You have been assigned an <term>issue</term> to work on and you have created a <term>fork</term> of the <term>upstream</term> GitKit FarmData2 repository into your GitHub space. + You now have been assigned an <term>issue</term> to work on and yuu have created a <term>fork</term> of the <term>upstream</term> GitKit FarmData2 repository into your GitHub space. </p> <p> - To work on your issue you will need to setup a <term>development environment</term>. The development environment is where you will create your <term>clone</term> of the repository, where you will edit files, and where you will use Git commands to add your changes to your clone and <term>push</term> those changes to your <term>origin</term>. + To work on your issue you will need to setup your <term>development environment</term>. Your development environment is where you will create your <term>clone</term> of the repository, where you will edit files, and where you will use `git` commands to add your changes to to your clone and <term>push</term> those changes to your <term>origin</term>. </p> <p> - Many FOSS contributors will setup the development environment on their personal machines. However, because student machines vary greatly the GitKit provides a browser based development environment that you will access using your web browser. This development environment is guaranteed to be the same for everyone that uses it. It includes a code editor, development tools, and a few features designed specifically to help you stay on track when completing the GitKit's hands-on exercises. - </p> - <p> - In this section you will create a new development environment, learn how to stop and restart the development environment, and do some necessary configuration of Git. + Many FOSS contributors will setup the development environment on their personal machines. Because student machines vary greatly the GitKit provides a browser based development environment, called a <term>KitClient</term>. This development environment runs in the cloud and you will access it using your web browser. This development environment includes standard development tools but also has a few features designed specifically to help you stay on track when completing the GitKit's hands-on exercises. </p> </introduction> - <subsection - xml:id="topic-create-devenv" - label="topic-create-devenv"> - <title>Creating the Development Environment + + Starting the Development Environment

- The development environment will run in the cloud using a service called GitHub Codespaces, and you will access it using your web browser. + In this section you will learn how to start, configure, stop, and restart your development environment.

+ + + <exercise> + xml:id="ex-gitpod-login" + label="ex-gitpod-login"> + <statement> + <p> + Your development environment will run in the cloud using a service called GitPod. Visit <url href="https://gitpod.io/login" visual="gitpod.io/login"/> and login using the “Continue with GitHub” button and providing your GitHub username and password. + </p> + </statement> + </exercise> + + <!-- The Linux KitClient Instructions --> <exercise - xml:id="ex-create-devenv" - label="ex-create-devenv"> + xml:id="ex-create-kit-client" + label="ex-create-kit-client" + component="linux-kit-client"> <introduction> <p> - The following tasks will guide you through the process of creating the development environment. + The following tasks will guide you through the process of starting and configuring your development environment. </p> </introduction> <task - xml:id="ex-github-login" - label="ex-github-login"> + xml:id="ex-create-kit-client-linux-a" + label="ex-create-kit-client-linux-a"> <statement> <p> - Ensure that you are logged into the GitHub account that you listed in <xref ref="ex-github-account-url" />. + Click this link to + <url href="https://gitpod.io/#https://github.com/hfossedu/KitClient-Linux-GitPod" visual="gitpod.io/#https://github.com/hfossedu/KitClient-Linux-GitPod">Launch KitClient</url> in GitPod. </p> </statement> </task> - <task - xml:id="ex-create-codespace" - label="ex-create-codespace"> + xml:id="ex-create-kit-client-linux-b" + label="ex-create-kit-client-linux-b"> <statement> <p> - Click this link to <url href="https://codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1" visual="codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1">create the Development Environment</url>. + Choose "Terminal" as the "Editor - Browser" and "Standard" as the machine "Class" as shown here: + <image source="images/ch-communities-and-collaboration/gitpod-create-linux-workspace.png" + width="50%"> + <description> + Creating the local development environment in GitPod. + </description> + </image> </p> </statement> </task> - - <task - xml:id="ex-create-codespace-button" - label="ex-create-codespace-button"> + <task + xml:id="ex-create-kit-client-linux-c" + label="ex-create-kit-client-linux-c"> <statement> <p> - Click the "Create new codespace" button on the page that appears. + Click the "Continue" button and wait for a few minutes until output that is similar to that shown here to appear: + </p> + <p> +<c> ********************************************************************************* + ********************************************************************************* + Connect to the KitClient with your browser at: + https://6901-hfossedu-kitclientlinux-kkguybiovbj.ws-us115.gitpod.io + ********************************************************************************* + *********************************************************************************</c> </p> </statement> </task> - <task - xml:id="ex-paste-pat-prompt" - label="ex-paste-pat-prompt"> + xml:id="ex-create-kit-client-linux-d" + label="ex-create-kit-client-linux-d"> <statement> <p> - Wait for the development environment to be created. Your browser window will refresh and change a few times during the creation process. Please be patient as this can take a few minutes. - </p> - <p> - After a few minutes, your browser window will look similar to <xref ref="fig-devenv-pat-prompt" /> including the prompt asking you to paste your GitHub Personal Access Token (PAT). - </p> - - <figure - xml:id="fig-devenv-pat-prompt" label="fig-devenv-pat-prompt"> - <caption> - The GitKit development environment prompting for a GitHub PAT during creation. - </caption> - <image source="images/ch-communities-and-collaboration/DevEnv-Request-PAT.png" width="75%"> - <description> - The GitKit Development Environment prompting for a GitHub PAT during creation. - </description> - </image> - </figure> - - <p> - If you do not see the prompt asking you to paste your PAT after a few minutes try: - <ul> - <li> - <p> - Reloading your browser tab. - </p> - </li> - <li> - <p> - Clearing your browser cache and reloading your browser tab. - </p> - </li> - <li> - <p> - Checking that your browser is <url href="https://docs.github.com/en/get-started/using-github/supported-browsers">fully supported by Codespaces</url>. - </p> - </li> - </ul> + Click the link in your output that is similar to the one that is shown above. </p> </statement> </task> - <task - xml:id="ex-paste-pat" - label="ex-paste-pat"> + xml:id="ex-create-kit-client-linux-e" + label="ex-create-kit-client-linux-e"> <statement> <p> - Paste the PAT that you created in <xref ref="topic-github-pat" /> and press enter. Note, for security reasons your PAT is not displayed when it is pasted. + Click the "Connect" button that appears in your browser. </p> + <p> - If you have lost or did not save your PAT, revisit <xref ref="topic-github-pat" /> and create a new one. + After clicking the "Connect" button your development environment should open in the browser. It will appear similar to the window shown in <xref ref="fig-linux-kit-client" />. </p> - </statement> - </task> - <task - xml:id="ex-devenv-ready" - label="ex-devenv-ready"> - <statement> <p> - After pasting your PAT, the development environment will finish being created. When the development environment is fully created your browser window will look similar to <xref ref="fig-devenv-ready-blank" /> including the "Kit development environment is ready for use" message. + <figure + xml:id="fig-linux-kit-client" + label="fig-linux-kit-client" + > + <caption> + The development environment. + </caption> + <image source="images/ch-communities-and-collaboration/linux-kitclient.png" + width="75%"> + <description> + The development environment window displaying a Linux desktop. + </description> + </image> + </figure> </p> - - <figure - xml:id="fig-devenv-ready-blank" label="fig-devenv-ready-blank"> - <caption> - The GitKit development environment with the "Kit development environment is ready for use" message. - </caption> - <image source="images/ch-communities-and-collaboration/DevEnv-Blank-Ready.png" width="75%"> - <description> - The GitKit Development Environment with the "Kit development environment is ready for use" message. - </description> - </image> - </figure> </statement> </task> </exercise> - </exercises> - </subsection> - <subsection> - <title>Stopping the Development Environment - -

- At some point you will complete an assignment or want to take a break and do other things. When you do so, you should stop the development environment. This will ensure that you do not consume more of your free Codespaces time than necessary. -

-
- - <exercise - xml:id="ex-stopping-devenv" - label="ex-stopping-devenv"> + xml:id="ex-configure-kit-client-linux" + label="ex-configure-kit-client-linux" + component="linux-kit-client"> <introduction> <p> - Use the following steps to practice stopping the development environment. + There are a few additional things that you can to to make working in your development environment more convenient. </p> </introduction> - <task - xml:id="ex-stopping-devenv-a" - label="ex-stopping-devenv-a"> + <task + xml:id="ex-configure-kit-client-linux-a" + label="ex-configure-kit-client-linux-a"> <statement> <p> - Click on the word "Codespaces" in the bottom left of the browser window. - </p> + Use the following steps to make the development environment fill and resize with your browser window. + </p> + <ol marker="i"> + <li> + Open the "noVNC Menu" by clicking the little tab at the left edge of the development environment window. <xref ref="fig-linux-kit-client" /> shows the "noVNC Menu" opened. + </li> + <li> + Click "Gear Icon" to open the "noVNC Settings". <xref ref="fig-linux-kit-client" /> shows the "noVNC Settings" open. + </li> + <li> + Set the "Scaling Mode" to "Remote Resizing". + </li> + </ol> </statement> </task> - <task - xml:id="ex-stopping-devenv-b" - label="ex-stopping-devenv-b"> + <task + xml:id="ex-configure-kit-client-linux-b" + label="ex-configure-kit-client-linux-b"> <statement> <p> - Select "Stop Current Codespace" from the menu that appears in the top center of the browser window. + To simplify pasting answers into this text, it is recommended that you open the text using the Firefox browser within the local development environment. </p> - </statement> - </task> - <task - xml:id="ex-stopping-devenv-c" - label="ex-stopping-devenv-c"> - <statement> <p> - Close the browser tab containing the development environment. + Copy and paste within the development environment can be done via an application's "Edit" menu, the "right click" menu, or keyboard shortcuts. This tutorial on <url href="https://www.xda-developers.com/how-copy-paste-linux/">Copy and Paste on Linux</url> may be helpful if you are not a Linux user. + </p> + <p> + Copy and paste between your host machine and the development environment can be done, but it requires that you paste the content into the "Clipboard" on the "noVNC Menu". </p> </statement> </task> </exercise> - </exercises> - </subsection> - <subsection - xml:id="topic-restarting-dev-env"> - <title>Re-starting the Development Environment - -

- When you return to work after stopping the development environment, you will need to restart it. -

-
- - + <!-- The VSCode KitClient Instructions --> <exercise - xml:id="ex-restarting-devenv" - label="ex-restarting-devenv"> + xml:id="ex-create-kit-client-vscode" + label="ex-create-kit-client-vscode" + component="vscode-kit-client"> <introduction> <p> - Use the following steps to restart the development environment. + The following tasks will guide you through the process of starting and configuring your development environment. </p> </introduction> - <task - xml:id="ex-restart-devenv-link" - label="ex-restart-devenv-link"> + + <task + xml:id="ex-create-kit-client-vscode-a" + label="ex-create-kit-client-vscode-a"> <statement> <p> - Click here to <url href="https://codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1" visual="codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1">open your development environment</url>. + Click this link to + <url href="https://gitpod.io/workspaces" visual="https://gitpod.io/workspaces">Launch KitClient</url> in GitPod. </p> </statement> </task> + <task - xml:id="ex-resume-codespace" - label="ex-resume-codespace"> + xml:id="ex-create-kit-client-vscode-b" + label="ex-create-kit-client-vscode-b"> <statement> <p> - Click the "Resume this codespace" button. + Paste the URL of your GitKit FarmData2 repository from <xref ref="ex-fork-url" /> into the text box and press "Enter". </p> + </statement> + </task> + + <task + xml:id="ex-create-kit-client-vscode-c" + label="ex-create-kit-client-vscode-c"> + <statement> <p> - Do not click the "Create a new one" button because a new development environment will not contain any of your prior work. + Choose "VS Code..." as the "Editor - Browser" and "Standard" as the machine "Class" as shown here: + + <image source="images/ch-communities-and-collaboration/gitpod-create-linux-workspace.png" + width="50%"> + <description> + Creating the development environment in GitPod. + </description> + </image> </p> </statement> </task> + <task - xml:id="ex-wait-for-codespace" - label="ex-wait-for-codespace"> + xml:id="ex-create-kit-client-vscode-d" + label="ex-create-kit-client-vscode-d"> <statement> - <p> - Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use" and your browser window will look similar to <xref ref="fig-devenv-blank-ready" />. + <p> + Click the "Continue" button and wait for the development environment to open in the browser. It will appear similar to the window shown in <xref ref="fig-vscode-kit-client" />. </p> + <p> + <figure + xml:id="fig-vscode-kit-client" + label="fig-vscode-kit-client" + > + <caption> + The development environment. + </caption> + <image source="images/ch-communities-and-collaboration/vscode-kitclient.png" + width="75%"> + <description> + The development environment window showing the VS Code interface. + </description> + </image> + </figure> + </p> + </statement> + </task> - <figure - xml:id="fig-devenv-blank-ready" label="fig-devenv-blank-ready"> - <caption> - The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message. - </caption> - <image source="images/ch-communities-and-collaboration/DevEnv-Blank-Ready.png" width="75%"> - <description> - The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message. - </description> - </image> - </figure> + <task + xml:id="ex-create-kit-client-vscode-e" + label="ex-create-kit-client-vscode-e"> + <statement> + <p> + A message box may appear in the lower right corner of the development environment asking if you would like to reopen the project in "VS Code Desktop". If this happens you can click the "X" to close the box, or ignore it and it will go away on its own. + </p> </statement> </task> </exercise> + + <exercise + xml:id="ex-vscode-kitty" + label="ex-vscode-kitty" + component="vscode-kit-client"> + <statement> + <p> + In the "TERMINAL" tab at the bottom of the window you should see "😺💻 Meow, Kit-tty here!" in the output. Read the associated text. + + What is the Kit-tty? + </p> + </statement> + <response /> + <hint> + Everything you need to know about Kit-tty for now is in the text that appears in the "TERMINAL" tab. + </hint> + </exercise> + </exercises> </subsection> -<subsection - xml:id="topic-git-client" - label="topic-git-client"> - <title>The Git Client + + Configuring the Git Client

Your development environment includes a Git client. The Git client is the tool that you will use to interact with Git repositories, such as the GitKit FarmData2 repository.

- There are lots of different Git clients. Some are graphical and some use a text interface. These exercises, introduce you to Git using the text-based Git command line interface (CLI). This is the most general way to interact with Git and will provide a conceptual foundation for using any other Git client that you might encounter. + There are lots of different Git clients. Some are graphical and some use a text interface. These exercises, introduce you to Git using its text-based command line interface (CLI). This is the most general way to interact with Git and will provide a conceptual foundation for using any other Git client that you might encounter.

+ <!-- Linux KitClient --> <exercise - xml:id="ex-git-version" - label="ex-git-version"> + xml:id="ex-open-terminal-linux" + label="ex-open-terminal-linux" + component="linux-kit-client"> <introduction> <p> - The Git CLI is accessed by using the <c>git</c> command in the terminal. + You will interact with Git using its command line interface via a <code>Terminal</code>. Use the following steps to open a Terminal. </p> </introduction> <task - xml:id="ex-git-version-a" - label="ex-git-version-a"> + xml:id="ex-open-terminal-a-linux" + label="ex-open-terminal-a-linux"> <statement> <p> - Using the <c>git</c> command without any additional arguments displays information about how to use <c>git</c>. + Click the "Terminal" icon at the bottom of the development environment window to open a new Terminal. </p> + </statement> + </task> + <task + xml:id="ex-open-terminal-b-linux" + label="ex-open-terminal-b-linux"> + <statement> <p> - Enter the command <c>git</c> into the terminal in the development environment and press enter. + Enter your name at the prompt and press enter. This will customize the Terminal prompt for you. </p> </statement> </task> + </exercise> + + <!-- VSCode KitClient --> + <exercise + xml:id="ex-open-terminal-vscode" + label="ex-open-terminal-vscode" + component="vscode-kit-client"> + <statement> + <p> + You will interact with Git using its command line interface via a <code>Terminal</code>. Use the following steps access the Terminal. + </p> + <p> + Click on the "TERMINAL" tab near the bottom of the development environment window to make the Terminal active. + </p> + </statement> + </exercise> + <exercise + xml:id="ex-git-version" + label="ex-git-version"> + <introduction> + You can learn about the <c>git</c> command by running it without any additional arguments. + </introduction> <task - xml:id="ex-git-version-b" - label="ex-git-version-b"> + xml:id="ex-git-version-a" + label="ex-git-version-a"> <statement> <p> - Use the output from the <c>git</c> command in <xref ref="ex-git-version-a" /> to determine which of the following commands will cause, <c>git</c> to "Show the working tree status." + Enter the command <c>git</c> into the Terminal. </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> + </task> + <task + xml:id="ex-git-version-b" + label="ex-git-version-b"> <statement> <p> - <c>git status</c> + Give a <c>git</c> command that will cause ,<c>git</c> to display its version. </p> + <response /> </statement> - <feedback> + <hint> <p> - The <c>git status</c> command causes <c>git</c> to display the status of the working tree. + Use the output from <xref ref="ex-git-version-a" /> to determine what flag to pass to <c>git</c>. </p> - </feedback> - </choice> - <choice> + </hint> + </task> + <task + xml:id="ex-git-version-c" + label="ex-git-version-c"> <statement> <p> - <c>git tree</c> + What version of the <c>git</c> command line client is installed in your development environment? </p> + <response /> </statement> - <feedback> + <hint> <p> - Check the output of the <c>git</c> command. + Use the command that you identified in <xref ref="ex-git-version-b" /> to determine the <c>git</c> version. </p> - </feedback> - </choice> - <choice> + </hint> + </task> + </exercise> + + <exercise + xml:id="ex-configure-git" + label="ex-configure-git"> + <introduction> + <p> + Recall from class that Git repositories maintain a complete history of all changes, including who made each change. To do this, Git needs to know a little bit of information about you. + </p> + <p> + Git identifies the author of each change using two pieces of information: A name and an e-mail. For name, you might decide to your full name, or a nickname, or your GitHub username. Just keep in mind that whatever name you use will be associated with all of the changes you make. For e-mail, you can again use any valid e-mail associated with you. + </p> + <p> + The tasks in this exercise will guide you through the process of configuring the Git client in your development environment. + </p> + </introduction> + <task + xml:id="ex-configure-git-a" + label="ex-configure-git-a"> <statement> <p> - <c>git working-tree</c> + Use the following command to set the name that Git will associate with your changes: </p> - </statement> - <feedback> <p> - Check the output of the <c>git</c> command. + <c>git config --global user.name "<name>"</c> </p> - </feedback> - </choice> - <choice> + <p> + Replace <c>"<name>"</c> with the name you wish to use and be sure not to include the < and >. + </p> + </statement> + </task> + <task + xml:id="ex-configure-git-b" + label="ex-configure-git-b"> <statement> <p> - <c>git show</c> + Use the following command to set the e-mail that Git will associate with your changes: + </p> + <p> + <c>git config --global user.email "<e-mail>"</c> + </p> + <p> + Replace <c>"<e-mail>"</c> with the name you wish to use and be sure not to include the < and >. </p> </statement> - <feedback> + </task> + <task + xml:id="ex-configure-git-c" + label="ex-configure-git-c"> + <statement> <p> - Check the output of the <c>git</c> command. + Use the following command to display Git's global configuration including the two new settings you just added: </p> - </feedback> - </choice> - </choices> - <hint> <p> - Check the output of the <c>git</c> command for the command that will "Show the working tree status." + <c>git config --global --list</c> </p> - </hint> + <p> + Give the output of this command as your answer for this task. + </p> + </statement> + <response /> </task> </exercise> </exercises> </subsection> - <subsection - xml:id="topic-git-configuration" - label="topic-git-configuration"> - <title>Configuring the Git Client + + Adjusting some GitPod Settings

- Git repositories maintain a complete history of all changes, including who made each change. To do this, Git needs to know a little bit of information about you. -

-

- Git identifies the author of each change using two pieces of information: A name and an email. For name, you might decide to use your full name, or a nickname, or your GitHub username. Just keep in mind that whatever name you use will be associated with all of the changes you make. For email, you can use any valid e-mail associated with you. -

-

- The exercises in this section will guide you through the process of configuring your name and email in the Git client in the development environment. + There are a few GitPod settings that you can change that will make working with your development environment more convenient.

- - - - <exercise - xml:id="ex-git-config-name" - label="ex-git-config-name"> - <statement> - <p> - The <c>git config --global user.name "<name>"</c> command sets the name that Git will associate with your changes. - </p> - <p> - Give a command that will set the name you want to have associated with your changes by replacing <c><name></c> with the name you wish to use. - </p> - <p> - <var width="50" /> - </p> - </statement> - <setup> - <var> - <condition string='^git config --global user\.name "[^<].+[^>]"$'> - <feedback> - <p> - This command will set the name associated with your changes in git. - </p> - </feedback> - </condition> - <condition string='^git config --global user\.name ["]*<.+>["]*$'> - <feedback> - <p> - You should not include the < and > in your command. - </p> - </feedback> - </condition> - <condition string='^git config --global user\.name [^"].+[^"]$'> - <feedback> - <p> - Be sure to use quotation marks around your name. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Reread the question and check the format of your command. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - - <exercise - xml:id="ex-git-config-email" - label="ex-git-config-email"> - <statement> - <p> - The <c>git config --global user.email "<email>"</c> command sets the email address that Git will associate with your changes. - </p> - <p> - Give a command that will set the email you want to have associated with your changes by replacing <c><email></c> with the email address you wish to use. - </p> - <p> - <var width="50" /> - </p> - </statement> - <setup> - <var> - <condition string='^git config --global user\.email "[^<].+@.+[^>]"$'> - <feedback> - <p> - This command will set the email associated with your changes in git. - </p> - </feedback> - </condition> - <condition string='^git config --global user\.email "[^<][^@]+[^>]"$'> - <feedback> - <p> - Be sure you have entered a valid email address. - </p> - </feedback> - </condition> - <condition string='^git config --global user\.email ["]*<.+>["]*$'> - <feedback> - <p> - You should not include the < and > in your command. - </p> - </feedback> - </condition> - <condition string='^git config --global user\.email [^"].+[^"]$'> - <feedback> - <p> - Be sure to use quotation marks around your email. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Reread the question and check the format of your command. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - + <title /> <exercise - xml:id="ex-configure-git" - label="ex-configure-git"> - <statement> - <p> - Enter your commands from <xref ref="ex-git-config-name" /> and <xref ref="ex-git-config-email" /> into the Terminal. - </p> + xml:id="ex-gitpod-settings" + label="ex-gitpod-settings"> + <introduction> <p> - Then use the command <c>git config --global --list</c> to display the Git configuration. Examine the output and select all of the Git configuration keys that have values assigned to them. + Use the following steps to adjust your GitPod settings. </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> + </introduction> + <task + xml:id="ex-gitpod-settings-a" + label="ex-gitpod-settings-a"> <statement> <p> - <c>user.name</c> + Open your GitPod workspaces in a browser by visiting <url href="https://gitpod.io/workspaces" />. </p> </statement> - <feedback> + </task> + <task + xml:id="ex-gitpod-settings-b" + label="ex-gitpod-settings-b"> + <statement> <p> - <c>user.name</c> should be set to the name you used above. + Choose "Rename" from the "⋮" (three vertical dots) menu to the right of the KitClient workspace and rename the workspace to be "GitKit Dev Env" or something else that you will remember easily. </p> - </feedback> - </choice> - <choice correct="yes"> + </statement> + </task> + <task + xml:id="ex-gitpod-settings-c" + label="ex-gitpod-settings-c"> <statement> <p> - <c>user.email</c> + Click the "Pushpin" icon, or choose "Pin" from the "⋮" (three vertical dots) menu to the right of the "GitKit Dev Env" workspace. + </p> + <p> + This will <term>Pin</term> your GitKit workspace making it easier to find, and will also prevent it from becoming inactive or being deleted if you don't use it for a few days. </p> </statement> - <feedback> + </task> + <task + xml:id="ex-gitpod-settings-d" + label="ex-gitpod-settings-d"> + <statement> <p> - <c>user.email</c> should be set to the email you used above. + Open your GitPod preferences in a browser by visiting <url href="https://gitpod.io/user/preferences" />. </p> - </feedback> - </choice> - <choice correct="yes"> + </statement> + </task> + <task + xml:id="ex-gitpod-settings-e" + label="ex-gitpod-settings-e"> <statement> <p> - <c>core.editor</c> + Set your “Timeout” to 10 minutes. This will stop your development environment if you are away from it for more than 5 minutes. This will help to ensure that your free GitPod credits are not accidentally used up if you forget to stop your development environment. + </p> + <p> + If your development environment times out and stops you can restart it using the steps in <xref ref="topic-restarting-dev-env" />. </p> </statement> - <feedback> + </task> + </exercise> + </exercises> + </subsection> + + <subsection> + <title>Stopping your Development Environment + +

+ At some point you will complete this assignment or want to take a break and do other things. When you do so, you should stop your development environment. +

+
+ + + <exercise + xml:id="ex-stopping-dev-env" + label="ex-stopping-dev-env"> + <introduction> + <p> + You can stop your development environment using the following steps. + </p> + </introduction> + <task + xml:id="ex-stopping-dev-env-a" + label="ex-stopping-dev-env-a"> + <statement> <p> - <c>core.editor</c> should be set to the nano editor. + Open your GitPod workspaces in a browser by visiting <url href="https://gitpod.io/workspaces" /> </p> - </feedback> - </choice> - <choice> + </statement> + </task> + <task + xml:id="ex-stopping-dev-env-b" + label="ex-stopping-dev-env-b"> <statement> <p> - <c>git.user</c> + Choose "Stop" from the "⋮" (three vertical dots) menu to the right of the "GitKit Dev Env" workspace. </p> </statement> - <feedback> + </task> + </exercise> + </exercises> + </subsection> + + <subsection + xml:id="topic-restarting-dev-env"> + <title>Re-starting your Development Environment + +

+ When you already have a GitKit development environment and want to continue working on the GitKit exercises, you will need to restart it. +

+
+ + + <exercise + xml:id="ex-restarting-dev-env" + label="ex-restarting-dev-env"> + <introduction> + <p> + Restart your development environment using the following steps. + </p> + </introduction> + <task + xml:id="ex-restarting-dev-env-a" + label="ex-restarting-dev-env-a"> + <statement> <p> - <c>git.user</c> is not a setting. + Open your GitPod workspaces in a browser by visiting <url href="https://gitpod.io/workspaces" /> </p> - </feedback> - </choice> - <choice> + </statement> + </task> + <task + xml:id="ex-restarting-dev-env-b" + label="ex-restarting-dev-env-b"> <statement> <p> - <c>gitkit.class</c> + Click the name of your "GitKit Dev Env" workspace or choose "Open" from the "⋮" (three vertical dots) menu to the right of its name. </p> </statement> - <feedback> + </task> + <task + xml:id="ex-restarting-dev-env-c" + label="ex-restarting-dev-env-c" + component="linux-kit-client"> + <statement> <p> - <c>gitkit.class</c> is not a setting. + Wait for the text similar to that in <xref ref="ex-create-kit-client-linux-c" /> to appear and click the link. </p> - </feedback> - </choice> - </choices> + </statement> + </task> </exercise> </exercises> </subsection> diff --git a/source/ch-communities-and-collaboration/sec-extra-practice.ptx b/source/ch-communities-and-collaboration/sec-extra-practice.ptx index bb89002..eecf95c 100644 --- a/source/ch-communities-and-collaboration/sec-extra-practice.ptx +++ b/source/ch-communities-and-collaboration/sec-extra-practice.ptx @@ -87,7 +87,7 @@ </statement> <setup> <var> - <condition string="^https://github.com/((?!(openmrs/openmrs-distro-referenceapplication|apache/fineract|sahana/eden|oppia/oppia)).)*$"> + <condition string="^https://github.com/.+/.+"> <feedback> <p> Thank you. @@ -104,105 +104,63 @@ </var> </setup> <hint> - <p> - Make sure you are giving the URL for your fork, not the project's URL. Review <xref ref="topic-forking-the-upstream" /> for information on how to fork a repository on GitHub. - </p> + Review <xref ref="topic-forking-the-upstream" /> for information on how to fork a repository on GitHub. </hint> </exercise> + <!-- Linux KitClient --> <exercise xml:id="ex-extra-practice-clone-linux" - label="ex-extra-practice-clone-linux"> - <statement> + label="ex-extra-practice-clone-linux" + component="linux-kit-client"> + <statement> + <p> + Clone your origin (i.e. your fork) for the project you selected into your development environment. + </p> <p> - Pick and order the commands to change to your home directory, clone your fork of the project you chose and check its remotes. + Copy and paste the Git commands that you used and their output here. </p> </statement> - <blocks> - <block order="1"> - <c>cd ~</c> - </block> - <block order="2"> - <c>git clone <URL></c> - </block> - <block order="3"> - <c>cd <dir></c> - </block> - <block order="4"> - <c>git remote -v</c> - </block> - <block correct="no"> - <c>ls</c> - </block> - <block correct="no"> - <c>git config</c> - </block> - <block correct="no"> - <c>copy <URL></c> - </block> - </blocks> + <response /> <hint> + Review <xref ref="topic-cloning-your-origin" /> for information about how to clone your origin repository. + </hint> + </exercise> + + <!-- VSCode KitClient --> + <exercise + xml:id="ex-extra-practice-clone-vscode" + label="ex-extra-practice-clone-vscode" + component="vscode-kit-client"> + <statement> + <p> + Clone your origin (i.e. your fork) for the project you selected by creating a new development environment (i.e. workspace) for it in GitPod. Recall that creating a new GitPod workspace automatically clones the origin repository into the development environment. + </p> <p> - Review <xref ref="topic-cloning-your-origin" /> for information about how to clone your origin repository. + Briefly describe how you created the the development environment, and thus cloned your origin, for the project you have chosen. </p> + </statement> + <response /> + <hint> + Review <xref ref="topic-development-environment" /> for information about how to create a new GitPod workspace (i.e. development environment). </hint> </exercise> <exercise xml:id="ex-extra-practice-remotes" label="ex-extra-practice-remotes"> - <statement> - <p> - In your terminal enter the commands from <xref ref="ex-extra-practice-clone-linux" />. - </p> - <p> - Which of the following do you see in the output of the <c>git remote -v</c> command? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <c>origin</c> followed by the URL that you entered in <xref ref="ex-extra-practice-fork" /> - </statement> - </choice> - - <choice correct="no"> - <statement> - <c>origin</c> followed by the URL in <xref ref="table-foss-projects" /> - </statement> - </choice> - - <choice correct="no"> - <statement> - <c>upstream</c> followed by the URL in <xref ref="table-foss-projects" /> - </statement> - </choice> - - <choice correct="no"> - <statement> - <c>upstream</c> followed by the URL that you entered in <xref ref="ex-extra-practice-fork" /> - </statement> - </choice> - - <choice correct="no"> - <statement> - <c>fork</c> followed by the URL in <xref ref="table-foss-projects" /> - </statement> - </choice> - - <choice correct="no"> - <statement> - <c>fork</c> followed by the URL that you entered in <xref ref="ex-extra-practice-fork" /> - </statement> - </choice> - </choices> - <hint> - <p> - The origin URL should be the one from your git clone command. - </p> - </hint> -</exercise> + <statement> + <p> + Use the Git command that displays the remotes that your local repository knows about. + </p> + <p> + Copy and paste the Git commands that you used and their output here. + </p> + </statement> + <response /> + <hint> + Review <xref ref="ex-check-remotes" /> for information about how to display the remotes. + </hint> + </exercise> </exercises> </section> diff --git a/source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx b/source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx index 163f862..f62dfe1 100644 --- a/source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx +++ b/source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx @@ -51,7 +51,7 @@ <setup> <var> - <condition string="^https://github.com/((?!(yourClass|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2))).*$"> + <condition string="^https://github.com/((?!(FarmData2/FarmData2|DickinsonCollege/FarmData2)).)*$"> <feedback> <p> Thank you. @@ -72,13 +72,6 @@ </p> </feedback> </condition> - <condition string="^https://github.com/yourClass/theRepoName"> - <feedback> - <p> - Looks like you might be trying to use the example above. That was just for illustration. Be sure to use the URL that your instructor has given you. - </p> - </feedback> - </condition> <condition string=".*"> <feedback> <p> @@ -89,12 +82,7 @@ </var> </setup> <hint> - <p> - Check the course materials from your instructor. It should provide the URL of the GitKit FarmData2 repository that was created for your course. - </p> - <p> - The URL should include something that refers to your course name, not your GitHub username. - </p> + Check the course materials from your instructor. It should provide the URL of the GitKit FarmData2 repository that was created for your course. </hint> </exercise> @@ -135,7 +123,7 @@ > <statement> <p> - Click the “Fork” button to create your own fork of the upstream repository. Be sure to pick the GitHub username that is at the end of the URL you used in <xref ref="ex-github-account-url" /> in the "Choose an owner" box so that your fork will be created in your GitHub space. + Click the “Fork” button to create your own fork of the upstream repository. Be sure to pick the GitHub username you used in <xref ref="ex-github-account-url" /> in the "Choose an owner" box so that your fork will be created in your GitHub space. </p> </statement> </task> @@ -156,7 +144,7 @@ <setup> <var> - <condition string="^https://github.com/((?!(yourGitHub|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2))).*$"> + <condition string="^https://github.com/((?!(FarmData2/FarmData2|DickinsonCollege/FarmData2)).)*$"> <feedback> <p> Thank you. @@ -177,13 +165,6 @@ </p> </feedback> </condition> - <condition string="^https://github.com/yourGitHub/theRepoName$"> - <feedback> - <p> - Looks like you might be trying to use the example above. That was just for illustration. Be sure to use the URL that your instructor has given you. - </p> - </feedback> - </condition> <condition string=".*"> <feedback> <p> @@ -194,9 +175,7 @@ </var> </setup> <hint> - <p> - The URL you give here should contain your GitHub username. Be sure you are looking the copy of the GitKit FarmData2 repository that is in your GitHub space. - </p> + The URL you give here should contain your GitHub username. Be sure you are looking the copy of the GitKit FarmData2 repository that is in your GitHub space. </hint> </exercise> @@ -214,38 +193,14 @@ xml:id="ex-upstream-ref-from-origin-a" label="ex-upstream-ref-from-origin-a" > - <statement> + <statement> <p> - Visit your origin repository on GitHub. There is a link on that page that corresponds to the orange dashed arrow in <xref ref="fig-basic-workflow-fork" />. What appears before the link? + Visit your origin repository on GitHub. There is some text and a link on that page that corresponds to the orange dashed arrow in <xref ref="fig-basic-workflow-fork" />. Copy and paste that text and link here. </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - forked from - </p> - </statement> - </choice> - <choice> - <statement> - <p> - The Octokitty (GitHub) logo - </p> - </statement> - </choice> - <choice> - <statement> - <p> - Fork your own copy of (in the Fork drop-down) - </p> - </statement> - </choice> - </choices> + </statement> + <response /> <hint> - <p> - This text and link will be near the repository name in the upper left corner of the window. - </p> + This text and link will be near the repository name in the upper left corner of the window. </hint> </task> @@ -296,65 +251,24 @@ </choice> </choices> <hint> - <p> - Think about which step of the basic FOSS workflow needs to send information back to the main project. - </p> + Think about which step of the basic FOSS workflow needs to send information back to the main project. </hint> </task> -<!-- + <task xml:id="ex-upstream-ref-from-origin-c" label="ex-upstream-ref-from-origin-c" > <statement> <p> - Why does your origin repository keep track of the location of the upstream repository from which it was forked? + Explain in a few sentences why your origin repository keeps track of the location of the upstream repository from which it was forked. </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - So that you can make a pull request back to the original project. - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - So that you can get back to the original project to access the issue tracker. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - So that you can clone the project again. - </p> - </statement> - </choice> - <choice correct ="yes"> - <statement> - <p> - So that you can pull changes provided by other contributors. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - So that you can push changes back to the original project. - </p> - </statement> - </choice> - </choices> + <response /> <hint> - <p> - Think about which steps of the basic FOSS workflow need access back to the main project. - </p> + Be sure to state which operation in the basic FOSS workflow uses this information and the function performed by that operation. </hint> </task> ---> </exercise> <exercise @@ -365,47 +279,10 @@ When you forked the upstream repository, GitHub made a copy of that repository into your GitHub space. </p> <p> - But, it did not make a copy of the issue tracker and its issues into your GitHub space. - </p> - <p> - Why do you think the designers of GitHub decided that the issue tracker should not be copied into the fork? + Did it also make a copy of the issue tracker and its issues into your GitHub space? What reasons can you think of for why the designers of GitHub decided that the issue tracker should not be copied into the fork? </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Because it would be hard for the maintainers of the original project to find issues entered in forks. - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - Because contributors would not know which issue tracker to enter new issues into. - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - Because it would be hard to keep issue descriptions and discussions up-to-date across multiple issue trackers. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - Because only the maintainers of the original project should be allowed to add new issues. - </p> - </statement> - </choice> - </choices> - <hint> - <p> - Why would it be confusing to have multiple issue trackers for a project? - </p> - </hint> + <response /> </exercise> </exercises> </section> diff --git a/source/ch-communities-and-collaboration/sec-foss-communities.ptx b/source/ch-communities-and-collaboration/sec-foss-communities.ptx index b3495bb..01640a0 100644 --- a/source/ch-communities-and-collaboration/sec-foss-communities.ptx +++ b/source/ch-communities-and-collaboration/sec-foss-communities.ptx @@ -234,7 +234,7 @@ <title>FOSS Community Roles

- There are a number of roles that tend to exist in FOSS communities. Some of these include Users, Requestors, Contributors, Maintainers and Leaders. Not all communities will have all of these roles and often community members will take on multiple roles simultaneously or move between roles over time. + There are a number of roles that tend to exist in FOSS communities. Some of these included Users, Requestors, Contributors, Maintainers and Leaders. Not all communities will have all of these rolls and often community members will take on multiple roles simultaneously or move between roles over time.

diff --git a/source/ch-communities-and-collaboration/sec-git-command-summary.ptx b/source/ch-communities-and-collaboration/sec-git-command-summary.ptx index c2b9a65..56628d1 100644 --- a/source/ch-communities-and-collaboration/sec-git-command-summary.ptx +++ b/source/ch-communities-and-collaboration/sec-git-command-summary.ptx @@ -40,7 +40,7 @@ - git clone <URL> + git clone <clone URL> Create a copy of the origin repository in your development environment. diff --git a/source/ch-communities-and-collaboration/sec-github-account.ptx b/source/ch-communities-and-collaboration/sec-github-account.ptx new file mode 100644 index 0000000..335196e --- /dev/null +++ b/source/ch-communities-and-collaboration/sec-github-account.ptx @@ -0,0 +1,60 @@ + + +
+ GitHub Account + +

+ You will be using GitHub in many of the exercises in this text. In order to use GitHub it is necessary that you have an account. +

+
+ + + + <exercise + xml:id="ex-create-github-account" + label="ex-create-github-account"> + <statement> + <p> + If you do not have a GitHub account, or would like to have a separate account just for this course, you can create a GitHub account here: <url href="https://github.com/signup" visual="github.com/signup">https://github.com/signup</url>. + </p> + <p> + If you already have a GitHub account that you would like to use for this class, skip to the next exercise. + </p> + </statement> + </exercise> + + <exercise + xml:id="ex-github-account-url" + label="ex-github-account-url"> + <statement> + <p> + Give the full URL to your GitHub profile, for example <c>https://github.com/yourUsername</c> + </p> + <p> + <var width="45" /> + </p> + </statement> + <setup> + <var> + <condition string="^https://github.com/.+"> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> + <condition string=".*"> + <feedback> + <p> + Please give the full URL using the format indicated in the question. + </p> + </feedback> + </condition> + </var> + </setup> + </exercise> + </exercises> +</section> diff --git a/source/ch-communities-and-collaboration/sec-github-set-up.ptx b/source/ch-communities-and-collaboration/sec-github-set-up.ptx deleted file mode 100644 index e01f4ac..0000000 --- a/source/ch-communities-and-collaboration/sec-github-set-up.ptx +++ /dev/null @@ -1,184 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<section xml:id="topic-github-set-up" xmlns:xi="http://www.w3.org/2001/XInclude" > - <title>GitHub Set Up - - -

- You will be using GitHub in many of the exercises in this text. - In order to use GitHub it is necessary that you have an account and a Personal Access Token. - You will also configure your GitHub Codespaces to help conserve your free useage time. -

-
- - - - GitHub Account - - - <exercise xml:id="ex-create-github-account" label="ex-create-github-account"> - <statement> - <p> - If you do not have a GitHub account, or would like to have a separate account just for this course, you can create a GitHub account here: <url href="https://github.com/signup" visual="github.com/signup">https://github.com/signup</url>. - </p> - - <p> - When you have a GitHub account to use for this class, move on to the next exercise. - </p> - </statement> - </exercise> - - <exercise xml:id="ex-github-account-url" label="ex-github-account-url"> - <statement> - <p> - Give the full URL to your GitHub profile, for example <c>https://github.com/yourUsername</c> - </p> - - <p> - <var width="45" /> - </p> - </statement> - <setup> <var> <condition string="^https://github.com/.+"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string=".*"> - - <feedback> - <p> - Please give the full URL using the format indicated in the question. - </p> - </feedback> - </condition> </var> </setup> - </exercise> - </exercises> - </subsection> - - <subsection xml:id="topic-github-pat"> - <title>GitHub Personal Access Token -

- When starting your development environment for the first time (in ) you will be asked to enter a Personal Access Token (PAT) from GitHub. -

-

- A PAT is like a password but has some security benefits. - In particular, you can have multiple different PATs. - Each one can have different limits on what can be done with it and each one can be revoked individually without affecting the others. -

- - - <exercise xml:id="ex-getting-pat" label="ex-getting-pat"> - <introduction> - <p> - Follow GitHub's instructions for creating a (classic) personal access token: <url href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic" visual="docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic">Creating a Personal Access Token (classic)</url>. - </p> - - <p> - When doing so be sure to: - <ul> - <li> - <p> - Choose “repo” for the “scopes and permissions.” - </p> - </li> - - <li> - <p> - Be sure to copy and paste your PAT somewhere safe – maybe e-mail it to yourself. - You will not be able to retrieve it again after you leave the page. - </p> - </li> - </ul> - </p> - - </introduction> - </exercise> - - <exercise xml:id="ex-github-pat" label="ex-github-pat"> - <statement> - <p> - What are the first 4 characters of your GitHub PAT? - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - gpat - </p> - </statement> - <feedback> - <p> - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - ghp_ - </p> - </statement> - <feedback> - <p> - All GitHub PATs begin with ghp_ - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - PAT_ - </p> - </statement> - <feedback> - <p> - - </p> - </feedback> - </choice> - </choices> -</exercise> -</exercises> - - </subsection> -<subsection> - <title>Setting the GitHub Codespaces Timeout - -

- The GitKit development environment runs in GitHub Codespaces. GitHub provides you with approximately 60 hours per month of free Codespaces use. By default the GitKit development environment will timeout after 30 minutes of inactivity. It is recommended that you reduce this timeout to 15 minutes to avoid accidentally consuming your allotted free useage. -

-
- - - <exercise - xml:id="ex-codespace-timeout-setting" - label="ex-codespace-timeout-setting"> - <introduction> - <p> - Use the following steps to adjust the timeout for your Codespaces, including the GitKit developent environment. - </p> - </introduction> - <task - xml:id="ex-open-codespace-settings" - label="ex-open-codespace-settings"> - <statement> - <p> - Open your GitHub Codespaces settings by visiting <url href="https://github.com/settings/codespaces" />. - </p> - </statement> - </task> - <task - xml:id="ex-adjust-codespace-timeout" - label="ex-adjust-codespace-timeout"> - <statement> - <p> - Scroll down to the section labeled "Default idle timeout", adjust the timeout to 15 minutes, and click "Save". - </p> - </statement> - </task> - </exercise> - </exercises> - </subsection> - -</section> diff --git a/source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx b/source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx index a8eef20..ab62040 100644 --- a/source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx +++ b/source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx @@ -1,19 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> -<section xml:id="topic-the-issue-tracker" xmlns:xi="http://www.w3.org/2001/XInclude" > +<section + xml:id="topic-the-issue-tracker" + xmlns:xi="http://www.w3.org/2001/XInclude" + > <title>The Issue Tracker

- FOSS projects often use an issue tracker to maintain a list of bugs to be fixed, features to be added and other tasks to be completed. - Thus, the issue tracker is a good place to go in order to find something to work on in a FOSS project. - The exercises in this section will guide you through interaction with the GitKit FarmData2 issue tracker as shown in . - By the end of the section you will have found an issue to work on. + FOSS projects often use an issue tracker to maintain a list of bugs to be fixed, features to be added and other tasks to be completed. Thus, the issue tracker is a good place to go in order to find something to work on in a FOSS project. The exercises in this section will guide you through interaction with the GitKit FarmData2 issue tracker as shown in . By the end of the section you will have found an issue to work on.

-

- The GitKit FarmData2 issue tracker in GitHub. +
+ + The GitKit FarmData2 issue tracker in GitHub. + The GitHub issue tracker displaying issues from the GitKit FarmData2 repository. @@ -23,217 +28,188 @@

- Exploring the Issue Tracker - - - <exercise xml:id="ex-find-the-issue-tracker" label="ex-find-the-issue-tracker" > - <introduction> - <p> - The tasks in this exercise will help you to find the issue tracker for the GitKit FarmData2 repository that you will be using. - </p> - </introduction> - - - <task xml:id="ex-find-the-issue-tracker-a" label="ex-find-the-issue-tracker-a"> - <statement> - <p> - Visit the URL that your instructor provided for the GitKit FarmData2 repository that you will be using as the upstream repository for your course. - </p> - </statement> - </task> - - - <task xml:id="ex-find-the-issue-tracker-b" label="ex-find-the-issue-tracker-b"> - <statement> + <title /> + <exercise + xml:id="ex-find-the-issue-tracker" + label="ex-find-the-issue-tracker" + > + <introduction> <p> - Click the "Issues" tab near the top of the page to go to the issue tracker. - This will take you to a page similar to the one shown in <xref ref="fig-issue-tracker"/>. + The tasks in this exercise will help you to find the issue tracker for the GitKit FarmData2 repository that you will be using. </p> - </statement> - </task> - </exercise> + </introduction> - <exercise xml:id="ex-explore-the-issue-tracker" label="ex-explore-the-issue-tracker" > - <introduction> - <p> - Use the issue tracker in the GitKit FarmData2 repository to complete the following tasks. - </p> - </introduction> + <task + xml:id="ex-find-the-issue-tracker-a" + label="ex-find-the-issue-tracker-a"> + <statement> + <p> + Visit the URL that your instructor provided for the GitKit FarmData2 repository that you will be using as the upstream repository for your course. + </p> + </statement> + </task> + <task + xml:id="ex-find-the-issue-tracker-b" + label="ex-find-the-issue-tracker-b"> + <statement> + <p> + Click the "Issues" tab near the top of the page to go to the issue tracker. This will take you to a page similar to the one shown in <xref ref="fig-issue-tracker"/>. + </p> + </statement> + </task> + </exercise> - <task xml:id="ex-explore-the-issue-tracker-a" label="ex-explore-the-issue-tracker-a" > - <statement> + <exercise + xml:id="ex-explore-the-issue-tracker" + label="ex-explore-the-issue-tracker" + > + <introduction> <p> - Every issue has a number and a title. - What is the title of issue #10? + Use the issue tracker in the GitKit FarmData2 repository to complete the following tasks. </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Add Missing "that" - </p> - </statement> - </choice> - - <choice> - <statement> - <p> - Seeding Report: Allows Invalid Inputs - </p> - </statement> - </choice> - - <choice> - <statement> - <p> - Seeding Input: Duplicates appearing in Area Dropdown - </p> - </statement> - </choice> - - <choice> - <statement> - <p> - Dickinson College Farm Link - </p> - </statement> - </choice> - </choices> + </introduction> - <hint> - <p> + <task + xml:id="ex-explore-the-issue-tracker-a" + label="ex-explore-the-issue-tracker-a" + > + <statement> + <p> + Every issue has a number and a title. What is the title of issue #10? + </p> + </statement> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + Add Missing "that" + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Seeding Report: Allows Invalid Inputs + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Seeding Input: Duplicates appearing in Area Dropdown + </p> + </statement> + </choice> + <choice> + <statement> + <p> + Dickinson College Farm Link + </p> + </statement> + </choice> + </choices> + <hint> Be sure you are looking at issue #10. - </p> - </hint> - </task> - - - <task xml:id="ex-explore-the-issue-tracker-b" label="ex-explore-the-issue-tracker-b" > - <statement> - <p> - Each issue can have <term>tags</term> that can be used to sort and categorize issues. - Select all of the tags that are associated with issue #8? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <image source="images/ch-communities-and-collaboration/documentation-tag.png"> - <description> - Documentation - </description> - </image> - </statement> - </choice> - - <choice correct="yes"> - <statement> - <image source="images/ch-communities-and-collaboration/round1-tag.png"> - <description> - Round1 - </description> - </image> - </statement> - </choice> - - <choice correct="yes"> - <statement> - <image source="images/ch-communities-and-collaboration/enhancement-tag.png"> - <description> - Enhancement - </description> - </image> - </statement> - </choice> - - <choice correct="no"> - <statement> - <image source="images/ch-communities-and-collaboration/typos-tag.png"> - <description> - Typos - </description> - </image> - </statement> - </choice> - - <choice correct="no"> - <statement> - <image source="images/ch-communities-and-collaboration/bug-tag.png"> - <description> - Bug - </description> - </image> - </statement> - </choice> - - <choice correct="no"> - <statement> - <image source="images/ch-communities-and-collaboration/uiux-tag.png"> - <description> - UI/UX - </description> - </image> - </statement> - </choice> - </choices> - - <hint> - <p> + </hint> + </task> + + <task + xml:id="ex-explore-the-issue-tracker-b" + label="ex-explore-the-issue-tracker-b" + > + <statement> + <p> + Each issue can have <term>tags</term> that can be used to sort and categorize issues. Select all of the tags that are associated with issue #8? + </p> + </statement> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <image source="images/ch-communities-and-collaboration/documentation-tag.png"> + <description>Documentation</description> + </image> + </statement> + </choice> + <choice correct="yes"> + <statement> + <image source="images/ch-communities-and-collaboration/round1-tag.png"> + <description>Round1</description> + </image> + </statement> + </choice> + <choice correct="yes"> + <statement> + <image source="images/ch-communities-and-collaboration/enhancement-tag.png"> + <description>Enhancement</description> + </image> + </statement> + </choice> + <choice correct="no"> + <statement> + <image source="images/ch-communities-and-collaboration/typos-tag.png"> + <description>Typos</description> + </image> + </statement> + </choice> + <choice correct="no"> + <statement> + <image source="images/ch-communities-and-collaboration/bug-tag.png"> + <description>Bug</description> + </image> + </statement> + </choice> + <choice correct="no"> + <statement> + <image source="images/ch-communities-and-collaboration/uiux-tag.png"> + <description>UI/UX</description> + </image> + </statement> + </choice> + </choices> + <hint> Be sure you are looking at issue #8. - </p> - </hint> - </task> - - - <task xml:id="ex-explore-the-issue-tracker-c" label="ex-explore-the-issue-tracker-c" > - <statement> - <p> - Which file in the repo would you need to modify in order to fix the typo described in issue #11? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - ONBOARDING.md - </statement> - </choice> + </hint> + </task> - <choice correct="no"> - <statement> + <task + xml:id="ex-explore-the-issue-tracker-c" + label="ex-explore-the-issue-tracker-c" + > + <statement> + <p> + Which file in the repo would you need to modify in order to fix the typo described in issue #11? + </p> + </statement> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + ONBOARDING.md + </statement> + </choice> + <choice correct="no"> + <statement> INSTALL.md - </statement> - </choice> - - <choice correct="no"> - <statement> - CONTRIBUTING.md - </statement> - </choice> - - <choice correct="no"> - <statement> - LICENSE.md - </statement> - </choice> - </choices> - - <hint> - <p> - Be sure you are looking at issue #11. - </p> - </hint> - </task> + </statement> + </choice> + <choice correct="no"> + <statement> + CONTRIBUTING.md + </statement> + </choice> + <choice correct="no"> + <statement> + LICENSE.md + </statement> + </choice> + </choices> + <hint> + Be sure you are looking at issue #11. + </hint> + </task> <task xml:id="ex-explore-the-issue-tracker-d" @@ -281,47 +257,26 @@ </hint> </task> - - <task xml:id="ex-explore-the-issue-tracker-e" label="ex-explore-the-issue-tracker-e" > - <statement> - <p> - Match issue tracker sort orders on the left to a reason for sorting in that order on the right. - </p> - </statement> - <feedback> - <p> - You can do it! Try again! - </p> - </feedback> - - <matches> - <match> - <premise>Created on</premise> - <response>Find issues you have not seen before</response> - </match> - <match> - <premise>Last updated</premise> - <response>Check if any issues you have been assigned to have had their requirements changed</response> - </match> - <match> - <premise>Total comments</premise> - <response>Find which issues are being most actively worked on</response> - </match> - </matches> - <hint> - <p> - Choose the best match. - </p> - </hint> - </task> - </exercise> - </exercises> + <task + xml:id="ex-explore-the-issue-tracker-e" + label="ex-explore-the-issue-tracker-e" + > + <statement> + <p> + Pick one of the sort orders that can be used with issues and briefly explain why it might be useful to sort the issues in that order. + </p> + </statement> + <response /> + <hint> + Think about why it might bue useful for a requestor, contributor or maintainer to find the types of issues that would be at the top of the sorted list. + </hint> + </task> + </exercise> + </exercises> </subsection> - <subsection> <title>Claiming an Issue -

Because projects often have many people working asynchronously many will have a process by which contributors can claim an issue that they are interested in working on and have that issue assigned to them in the issue tracker. @@ -331,218 +286,162 @@ The following exercises will guide you through the process of claiming an issue to work on in the GitKit FarmData2 issue tracker.

- - - <exercise xml:id="ex-identifying-assigned-issues" label="ex-identifying-assigned-issues" > - <statement> - <p> - Examine the GitKit FarmData2 issue tracker. - How can you tell which issue have already been assigned? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - The avatar of the assigned user appears to the right of the issue title. - </statement> - </choice> + <title /> - <choice correct="no"> - <statement> - The issue no longer appears in the issue tracker. - </statement> - </choice> - - <choice correct="no"> - <statement> - The username of assigned user appears next to the issue title. - </statement> - </choice> - - <choice correct="no"> - <statement> - The issue is moved to a separate list of assigned issues. - </statement> - </choice> - - <choice correct="no"> - <statement> - The issue tracker does not show any indication that an issue has been assigned. - </statement> - </choice> - </choices> - - <hint> - <p> - Look for some lines for issues that look different than the others and hover your mouse over the different parts. - </p> - </hint> - </exercise> - - <p> - In the GitKit FarmData2 issue tracker, contributors interested in working on an issue can request that it be assigned to them by commenting on the issue with the exact message: - </p> - - <p xml:id="topic-issue-claim-message"> - <c>I would like to work on this please!</c> - </p> - - <p> - The first person who comments on an unclaimed issue with this message will receive a response from the project maintainers. - This messages will indicate that the issue has been assigned to them and the issue tracker will update to show this as you saw in <xref ref="ex-identifying-assigned-issues" />. - </p> - - <exercise xml:id="ex-claim-an-issue" label="ex-claim-an-issue"> - <statement> - <p> - Use the GitKit FarmData2 issue tracker to complete the following tasks. - </p> - </statement> - - - <task xml:id="ex-claim-an-issue-a" label="ex-claim-an-issue-a"> + <exercise + xml:id="ex-identifying-assigned-issues" + label="ex-identifying-assigned-issues" + > <statement> <p> - Choose an unassigned issue with a "Round 1" tag. + Examine the GitKit FarmData2 issue tracker. + How can you tell which issue have already been assigned? </p> </statement> - + <choices randomize="yes"> + <choice correct="yes"> + <statement> + The avatar of the assigned user appears to the right of the issue title. + </statement> + </choice> + <choice correct="no"> + <statement> + The issue no longer appears in the issue tracker. + </statement> + </choice> + <choice correct="no"> + <statement> + The username of assigned user appears next to the issue title. + </statement> + </choice> + <choice correct="no"> + <statement> + The issue is moved to a separate list of assigned issues. + </statement> + </choice> + <choice correct="no"> + <statement> + The issue tracker does not show any indication that an issue has been assigned. + </statement> + </choice> + </choices> <hint> - <p> - See <xref ref="ex-identifying-assigned-issues" /> for information about identifying assigned and unassigned issues. - </p> - </hint> - </task> - - - <task xml:id="ex-claim-an-issue-b" label="ex-claim-an-issue-b"> - <statement> - <p> - Comment on the issue that you chose using the <xref ref="topic-issue-claim-message" text="custom">message above</xref> to claim it. - </p> - </statement> + Look for some lines for issues that look different than the others and hover your mouse over the different parts. + </hint> + </exercise> - <hint> - <p> - Click on the issue title to open the issue and use the "Add a comment" box at the bottom of the page. - </p> - <p> - Remember you must type <xref ref="topic-issue-claim-message" text="custom">the message</xref> exactly as shown. - </p> - </hint> - </task> + <p> + In the GitKit FarmData2 issue tracker, contributors interested in working on an issue can request that it be assigned to them by commenting on the issue with the exact message: + </p> + + <p + xml:id="topic-issue-claim-message"> + <c>I would like to work on this please!</c> + </p> + <p> + The first person who comments on an unclaimed issue with this message will receive a response from the project maintainers. This messages will indicate that the issue has been assigned to them and the issue tracker will update to show this as you saw in <xref ref="ex-identifying-assigned-issues" />. + </p> - <task xml:id="ex-claim-an-issue-c" label="ex-claim-an-issue-c"> - <statement> + <exercise + xml:id="ex-claim-an-issue" + label="ex-claim-an-issue"> + <statement> <p> - Reload the issue tracker and check that you received a response and that the issue has been assigned to you. + Use the GitKit FarmData2 issue tracker to complete the following tasks. </p> </statement> - - <hint> - <p> - If you did not receive a response, wait a few minutes and reload the issue tracker page again. - Sometimes it takes a few minutes for your comment to be noticed and the issue to be assigned. - If you still do not receive a response check that you typed <xref ref="topic-issue-claim-message" text="custom">the message</xref> correctly. - </p> - - <p> - If you received a response telling you that you were not assigned the issue, someone else slipped a comment in just ahead of you and was assigned the issue. - If this happens, just try <xref ref="ex-claim-an-issue-b" /> again. - </p> - </hint> - </task> - </exercise> - - <exercise xml:id="ex-round1-issue-url" label="ex-round1-issue-url"> - <statement> - <p> - Give the full URL to the issue that you have been assigned, for example <c>https://github.com/my-class/GitKit-FarmData2/issues/2</c> - </p> - - <p> - <var width="60" /> - </p> - </statement> - <setup> <var> <condition string="^https://github.com/.+/issues/[0-9]+$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string=".*"> - - <feedback> - <p> - Please give the full URL using the format indicated in the question. - </p> - </feedback> - </condition> </var> </setup> - </exercise> - - <exercise xml:id="ex-why-not-assign-issues" label="ex-why-not-assign-issues"> - <statement> - <p> - It is worth noting that different projects will have different processes for claiming and assigning issues, and some projects may not assign issues at all. - What are some advantages and disadvantages of assigning issues to specific individuals? - </p> - <p> - Select each of the statements that describe an advantage of assigning issues. - </p> - </statement> - <feedback> - <p> - You can do it! Try again! - </p> - </feedback> - <choices randomize="yes"> - <choice correct="yes"> + + <task + xml:id="ex-claim-an-issue-a" + label="ex-claim-an-issue-a"> <statement> <p> - To prevent wasting effort by having two developers work on the same issue. + Choose an unassigned issue with a "Round 1" tag. </p> - </statement> - <feedback> + </statement> + <hint> + See <xref ref="ex-identifying-assigned-issues" /> for information about identifying assigned and unassigned issues. + </hint> + </task> + + <task + xml:id="ex-claim-an-issue-b" + label="ex-claim-an-issue-b"> + <statement> <p> - Assigning issues can help prevent people from duplicating work. + Comment on the issue that you chose using the <xref ref="topic-issue-claim-message" text="custom">message above</xref> to claim it. </p> - </feedback> - </choice> - <choice> + </statement> + <hint> + Click on the issue title to open the issue and use the "Add a comment" box at the bottom of the page. + </hint> + </task> + + <task + xml:id="ex-claim-an-issue-c" + label="ex-claim-an-issue-c"> <statement> <p> - Allow a developer to "hold on" to an issue, even if they are not currently working on it. + Reload the issue tracker and check that you received a response and that the issue has been assigned to you. </p> </statement> - <feedback> - <p> - Holding onto an issue that is not being worked on may prevent someone else from working on it. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> + <hint> <p> - To plan in advance who will be working each issue. + If you did not receive a response, wait a few minutes and reload the issue tracker page again. Sometimes it takes a few minutes for your comment to be noticed and the issue to be assigned. If you still do not receive a response check that you typed <xref ref="topic-issue-claim-message" text="custom">the message</xref> correctly. </p> - </statement> - <feedback> <p> - Assigning issues could work like creating a ToDo list for core project contributors. + If you received a response telling you that you were not assigned the issue, someone else slipped a comment in just ahead of you and was assigned the issue. If this happens, just try <xref ref="ex-claim-an-issue-b" /> again. </p> - </feedback> - </choice> - </choices> - <hint> - <p> + </hint> + </task> + </exercise> + + <exercise + xml:id="ex-round1-issue-url" + label="ex-round1-issue-url"> + <statement> + <p> + Give the full URL to the issue that you have been assigned, for example <c>https://github.com/my-class/GitKit-FarmData2/issues/2</c> + </p> + <p> + <var width="60" /> + </p> + </statement> + <setup> + <var> + <condition string="^https://github.com/.+/issues/[0-9]+$"> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> + <condition string=".*"> + <feedback> + <p> + Please give the full URL using the format indicated in the question. + </p> + </feedback> + </condition> + </var> + </setup> + </exercise> + + <exercise + xml:id="ex-why-not-assign-issues" + label="ex-why-not-assign-issues"> + <statement> + <p> + It is worth noting that different projects will have different processes for claiming and assigning issues, and some projects may not assign issues at all. What are some advantages and disadvantages of assigning issues to specific individuals? + </p> + </statement> + <response /> + <hint> Think about this from both the individual developer's perspective and from the overall project's perspective. - </p> - </hint> - </exercise> - </exercises> + </hint> + </exercise> + </exercises> </subsection> </section> diff --git a/source/ch-instructor-guide/ch-instructor-guide.ptx b/source/ch-instructor-guide/ch-instructor-guide.ptx index da11ef3..ce23b58 100644 --- a/source/ch-instructor-guide/ch-instructor-guide.ptx +++ b/source/ch-instructor-guide/ch-instructor-guide.ptx @@ -7,23 +7,28 @@ <introduction> <p> - The GitKit provides an introduction to the fundamental skills and concepts used in collaborative Free and Open Source Software (FOSS) development. It introduces Git and GitHub basics, and gives learners the experience of using the <url href="https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow">forking workflow</url> to contribute to a FOSS project. + The GitKit provides an introduction to the fundamental skills and concepts used in collaborative Free and Open Source Software (FOSS) development. + It introduces Git and GitHub basics, and gives learners the experience of using the <url href="https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow">forking workflow</url> to contribute to a FOSS project. </p> - <p> - If at any point you have questions about the GitKit, need help getting setup to use it in a class, or have feedback for us, please <url href="https://discord.gg/83Sb4csCeT">chat with us on Discord.</url> - </p> - - <p><alert>GitKit Use</alert></p> - <p> The GitKit is designed for use as a module within a traditional course to provide a first exposure to Git and GitHub. - It includes classroom materials, hands-on activities for labs or homework, project artifacts (repository, code, documentation, issues) captured from a genuine FOSS project, and a cloud-based development environment. The classroom materials focus on the introduction of concepts and terminology. The hands-on activities reinforce the in-class material while guiding learners through the forking workflow in the context of an authentic FOSS project. The activities are structured such that each new Git command and GitHub operation is introduced as the need for it arises in the forking workflow. + It includes classroom materials, hands-on activities for labs or homework, project artifacts (repository, code, documentation, issues) captured from a genuine FOSS project, and a cloud-based development environment. + The classroom materials focus on the introduction of concepts and terminology. + The hands-on activities reinforce the in-class material while guiding learners through the forking workflow in the context of an authentic FOSS project. + The activities are structured such that each new Git command and GitHub operation is introduced as the need for it arises in the forking workflow. </p> <p> - The GitKit minimizes prerequisite knowledge and hardware requirements. Learners are expected to have basic familiarity with files, directories and the Unix/Linux command line (e.g. <c>cd</c> and <c>ls</c>). Hands-on activities focus on small changes to documentation in markdown files, and require no prior knowledge of markdown or any programming language. The cloud-based development environment requires an internet connection and a modern web browser. + The GitKit minimizes prerequisite knowledge and hardware requirements. + Learners are expected to have basic familiarity with files, directories and the Unix/Linux command line (e.g. + <c>cd</c> and <c>ls</c>). Hands-on activities focus on small changes to documentation in markdown files, and require no prior knowledge of markdown or any programming language. + The cloud-based development environment requires an internet connection and a modern web browser. </p> + + <p> + If you have questions about the GitKit, need help getting setup to use it in a class, or have feedback for us, please <url href="https://discord.gg/83Sb4csCeT">chat with us on Discord.</url> + </p> </introduction> <!-- include sections --> diff --git a/source/ch-instructor-guide/images/deployer-done.png b/source/ch-instructor-guide/images/deployer-done.png deleted file mode 100644 index 176817b..0000000 Binary files a/source/ch-instructor-guide/images/deployer-done.png and /dev/null differ diff --git a/source/ch-instructor-guide/images/deployer-kitscript.png b/source/ch-instructor-guide/images/deployer-kitscript.png deleted file mode 100644 index 9b72963..0000000 Binary files a/source/ch-instructor-guide/images/deployer-kitscript.png and /dev/null differ diff --git a/source/ch-instructor-guide/images/linux-kitclient.png b/source/ch-instructor-guide/images/linux-kitclient.png new file mode 100644 index 0000000..5b33921 Binary files /dev/null and b/source/ch-instructor-guide/images/linux-kitclient.png differ diff --git a/source/ch-instructor-guide/images/codespace-kitclient.png b/source/ch-instructor-guide/images/vscode-kitclient.png similarity index 100% rename from source/ch-instructor-guide/images/codespace-kitclient.png rename to source/ch-instructor-guide/images/vscode-kitclient.png diff --git a/source/ch-instructor-guide/sec-instructor-communities.ptx b/source/ch-instructor-guide/sec-instructor-communities.ptx index 77644ed..ca6ba5e 100644 --- a/source/ch-instructor-guide/sec-instructor-communities.ptx +++ b/source/ch-instructor-guide/sec-instructor-communities.ptx @@ -174,32 +174,35 @@ <ul> <li> <em> - <p> - <xref ref="ex-clone-url-linux" /> + <p component="linux-kit-client"> + <xref ref="ex-find-clone-url-linux" /> + </p> + <p component="vscode-kit-client"> + <xref ref="ex-create-kit-client-vscode-b" /> </p> </em> <p> - Some students will give the URL of the upstream GitKit-FarmData2 repository for the course instead of their origin repository. A few may even give the URL of a real FarmData2 upstream repository. + Some students will try to clone the upstream GitKit-FarmData2 repository instead of their origin repository. A few may even attempt to clone the real FarmData2 repository. The Kit-tty should prevent this and provide a helpful tip. </p> </li> <li> <em> <p> - <xref ref="ex-clone-origin-linux" /> + <xref ref="ex-check-remotes" /> </p> </em> <p> - Some students will try to clone the upstream GitKit-FarmData2 repository for the course or even give the URL of a real FarmData2 upstream repository. + Checking the origin remote that is given as the answer to this question will confirm that the student has correctly cloned their origin. Again, the Kit-tty should prevent them doing this incorrectly, but if somehow it did not catching and correcting this early is important. </p> </li> <li> <em> <p> - <xref ref="ex-check-remotes-b" /> + <xref ref="ex-identifying-assigned-issues" /> </p> </em> <p> - Checking the origin remote that is given as the answer to this question will confirm that the student has correctly cloned their origin. Again, the Kit-tty should prevent them doing this incorrectly, but if somehow it did not catching and correcting this early is important. + The answer to this question will reasonably differ depending upon when students complete the exercise. There are initially 3 issues that are pre-assigned to the user that deployed the GitKit. Students who complete the exercise early are likely to all identify these issues. As additional students claim issues, other students will identify those claimed issues as well. </p> </li> <li> diff --git a/source/ch-instructor-guide/sec-instructor-intro.ptx b/source/ch-instructor-guide/sec-instructor-intro.ptx index 72513fe..dcda72a 100644 --- a/source/ch-instructor-guide/sec-instructor-intro.ptx +++ b/source/ch-instructor-guide/sec-instructor-intro.ptx @@ -12,7 +12,7 @@ </p> <p> - For questions or assistance with GitKit, you can <url href="https://discord.gg/83Sb4csCeT">chat with us on Discord.</url> + For help with GitKit, you can <url href="https://discord.gg/83Sb4csCeT">chat with us on Discord.</url> </p> </introduction> @@ -28,18 +28,26 @@ <li> <p> <url href="https://guide.runestone.academy/InstructorGuide-6.html">Create a Runestone course</url> using the - <url href="https://runestone.academy/ns/books/published/gitkit/the-gitkit-book.html?mode=browsing">GitKit</url> text. + <url href="https://runestone.academy/ns/books/published/gitkitlinux/the-gitkit-book.html?mode=browsing">GitKit (Linux Desktop Edition)</url> or the + <url href="https://runestone.academy/ns/books/published/gitkitvscode/the-gitkit-book.html?mode=browsing">GitKit (VSCode Edition)</url>. + </p> + <p> + Note that you are currently viewing the + <term component="linux-kit-client">GitKit (Linux Desktop Edition)</term> + <term component="vscode-kit-client">GitKit (VSCode Edition)</term> + . </p> </li> <li> <p> <url href="https://guide.runestone.academy/working-with-assignments-chap.html#instructor-interface_copying-assignments-4">Copy the Course Pack</url> for the GitKit from the - <term>gitkit</term> + <term component="linux-kit-client">gitkitlinux</term> + <term component="vscode-kit-client">gitkitvscode</term> base course into your course if you would like to use the provided assignments. </p> <p> - Note that the reading assignments in the course pack include sections that allow students to elect to participate in a research project aimed at (1) understanding what they think and know about open source tools and techniques and (2) assessing the effectiveness of the GitKit. The inclusion of these sections is optional and they may be removed at the discretion of the instructor. See <xref ref="topic-adopt-gitkit-text" text="type-global-title" /> for additional information. + Note that the reading assignments in the course pack include sections that allow students to elect to participate in a research project aimed at (1) understanding what they think and know about open source tools and techniques and (2) assessing the effectiveness of the GitKit. The inclusion of these sections is option and may be removed at the discretion of the instructor. See <xref ref="topic-adopt-gitkit-text" text="type-global-title" /> for additional information. </p> </li> <li> @@ -49,10 +57,10 @@ </li> <li> <p> - Click to <url href="https://codespaces.new/HFOSSedu/GitKit-Deployer-Codespaces?quickstart=1">deploy the GitKit FarmData2 repository</url> to use as the upstream. + Click to <url href="https://gitpod.io/?autostart=true&useLatest=true&editor=xterm#script_url=https%3A%2F%2Fgitlab.com%2Fhfossedu%2Fkits%2Fgitkit-deployer-gitpod%2F-%2Fraw%2Fmain%2Fdeploy.yaml%3Fref_type%3Dheads/https://github.com/HFOSSedu/GitKit-Deployer-GitPod"> Deploy the GitKit FarmData2 repository </url> to use as the upstream. </p> <p> - One deploy of the GitKit FarmData2 repository can support up to 32 students. Perform as many deploys as necessary for your course. Be sure to give each deploy a distinct name when prompted by the deployer. + One deploy of the GitKit FarmData2 repository can support up to 32 students. Perform as many deploys as necessary for your course. Be sure to give each deploy a distinct name. </p> </li> <li> @@ -62,7 +70,7 @@ </li> <li> <p> - Please consider clicking the link to the brief survey that is included in the output of the GitKit deployer. Your feedback helps us to better understand where and how the GitKit is being used. This survey can also be accessed <url href="https://drexel.qualtrics.com/jfe/form/SV_81y8BL0zy3fBw22">here</url>. + Please consider clicking the link to the brief survey that is included in the output of the GitKit deployer. Your feedback helps us to better understand where and how the GitKit is being used. This survey can also be accessed <url href="https://drexel.qualtrics.com/jfe/form/SV_81y8BL0zy3fBw22">here</url>. </p> </li> <li> @@ -103,7 +111,7 @@ </li> <li> <p> - Read <xref ref="topic-gitkit-development-environments" text="type-global-title" /> to learn about the development environment that students use with the GitKit. + Read <xref ref="topic-gitkit-development-environments" text="type-global-title" /> to learn about the two development environments that can be used with the GitKit and select one for use in your course. </p> </li> <li> @@ -114,7 +122,7 @@ </li> <li> <p> - Consider doing the GitKit for yourself as described in <xref ref="topic-do-the-gitkit" />. This is by far the best way to prepare to deliver the GitKit to a class. + Consider doing the GitKit for yourself as described in <xref ref="topic-do-the-gitkit" />. It is by far the best way to prepare to deliver the GitKit to a class. </p> </li> <li> @@ -124,7 +132,7 @@ </li> <li> <p> - Follow the steps in <xref ref="topic-gitkit-deploy" text="type-global-title" /> to deploy the upstream repository needed to use GitKit in your course. + Follow the steps in <xref ref="topic-gitkit-deploy" text="type-global-title" /> to deploy the GitKit for use in your course. </p> </li> <li> @@ -134,7 +142,7 @@ </li> <li> <p> - Refer to <xref ref="topic-gitkit-contributing" text="type-global-title" /> for information about contributing to the GitKit including where to report typos, errors, suggested improvements, feature requests or bugs. + Refer to <xref ref="topic-gitkit-contributing" text="type-global-title" /> for information about contributing to the GitKit including where to report typos, errors, suggested improvements or bugs. </p> </li> </ol> @@ -146,7 +154,7 @@ <title>Delivering GitKit

- The GitKit content is broken into 4 chapters (See ). Each chapter of the text contains the set of hands-on exercises to be completed by the students. These exercises are not intended to stand alone. Each requires some prior introduction to the concepts and terminology that they use. A separate set of slides are provided for each topic that instructors can use or adapt to introduce the necessary concepts and terminology before students complete each set of hands-on exercises. + The GitKit content is broken into 4 chapters (See ). Each chapter of the text contains the set of hands-on exercises to be completed by the students. These exercises are not intended to stand alone. They require some prior introduction to the concepts and terminology that they use. A separate set of slides are provided that instructors can use or adapt to introduce the necessary concepts and terminology before students complete the hands-on exercises.

@@ -159,18 +167,18 @@

  • - Students complete the hands-on activities contained in each chapters of this text as 2-3 hours of homework or during assigned lab periods. + Students complete the hands-on activities contained in the chapters of this text as 2-3 hours of homework or during an assigned lab period.

  • - While the GitKit was designed for nominal delivery in four 50-75-minute periods with 2-3 hours of additional hands-on work by the students, instructors have found the GitKit to be adaptable to different educational settings, student experience levels and learning objectives. Some examples include: + While the GitKit was designed for nominal delivery in four 50-75-minute periods with 2-3 hours of additional hands-on work by the students, instructors have found the GitKit to be adaptable to different educational settings, student experience levels and learning objectives.

    • - Limited Coverage: The first two GitKit topics form a cohesive unit and can be completed without continuing onto the final two topics. + Limited Coverage: The first two GitKit topics form a cohesive unit and can be completed without continuing onto the final two topics. Two examples of how this can be used include:

    • @@ -180,12 +188,12 @@
    • - A One Day Workshop: An organization has delivered the GitKit as a one-day workshop for students from low-income, first-generation, underrepresented minority backgrounds. This workshop covered just the first two GitKit topics. + A One Day Workshop: An organization delivered the GitKit as a one-day workshop for students from low-income, first-generation, underrepresented minority backgrounds. This workshop covered just the first two GitKit topics.

    • - Students with Prior Git Experience: An instructor with students who have had prior exposure to Git fundamentals (but not GitHub or the forking workflow) have skipped most of the class materials and used the hands-on activities as in-class lab activities rather than homework. + Students with Prior git Experience: An instructor with students who have had prior exposure to git fundamentals (but not GitHub or the forking workflow) have skipped most of the class materials and used the hands-on activities as in-class lab activities rather than homework.

    • @@ -202,7 +210,7 @@ GitKit Content

      - The content of the GitKit is broken into the chapters below. + The content of the GitKit is broken into the chapters below. For each chapter the key topics and activities are outlined and links are given to the slides, the chapter of the text containing the hands-on exercises and instructor notes for the chapter.

      • @@ -227,7 +235,7 @@

        • - Introduces feature branches, commits, and pull requests as part of the forking workflow. + Introduces feature branches, commits, and pull requests as part of the forking workflow.

        • @@ -267,7 +275,7 @@
        • - Provides practice with understanding merge conflicts, merging main into a feature branch, using a basic merge tool, and updating a pull request. + Provides practice with understanding merge conflicts, merging main into a feature branch, using a graphical merge tool and updating a pull request.

        @@ -281,46 +289,87 @@ Student Development Environments

        - The GitKit provides a cloud based development environment that students use to complete the hands-on GitKit activities. This development environment, which we call a KitClient, runs on GitHub Codespaces. It provides all of the tools and configuration necessary to complete the activities. The development environment also includes the Kit-tty Virtual Assistant (See and a set of automations that simulate aspects of an open source project community (See ). + The GitKit provides a cloud based development environment that students use to complete the hands-on GitKit activities. This development environment is called a KitClient. A KitClient is a pre-configured containerized development environment that provides all of the tools and configuration necessary to complete the activities. The KitClient also includes the Kit-tty Virtual Assistant (See and a set of automations that simulate project community (See ).

        - shows the development environment where students complete the hands-on activities. - -

        - - The KitClient development environment running in Codespaces. - - - - Screenshot showing the KitClient development environment running in GitHub Codespaces. - - -
        -

        + There are currently two KitClients that can be used with GitKit and the instructor may choose the KitClient to use based on the needs of their course and students. +
          +
        • +

          + Linux Desktop KitClient: shows the Linux KitClient where students complete the hands-on activities in a complete Linux virtual desktop environment. + +

          + + The Linux KitClient development environment. + + + + The Linux KitClient development environment window displaying the Linux desktop. + + +
          +

          +
        • +
        • +

          + VSCode KitClient: shows the VSCode KitClient in which students complete the hands-on activities in the VSCode interface. + +

          + + The VSCode development environment. + + + + The VSCode development environment window showing the VS Code interface. + + +
          +

          +
        • +
        + + Both of these KitClients run remotely within GitPod Workspaces and students interact with them through a Web browser. To run a KitClient, students will need will need to have a free GitPod account, which they will created as a part of the activities. +

        + +

        + There is a different edition of this text for each of the KitClients. The texts provide an equivalent experience, but adapt content to the specifics (e.g. user interface elements) of the KitClient as necessary. The instructor will adopt the text for the KitClient that has been chosen for the course (see ). +

        +

        - Note: If you are familiar with GitHub Codespaces, you will find that the interface familiar. However, the KitClient works slightly differently than a standard Codespace. In particular, when students open the KitClient no repository will be opened. Instead they are given a blank development environment into which they git clone the repository they will be using for the GitKit. This make explicit the important concept of a clone, which Codespaces hide. + You are currently viewing the + GitKit (Linux Desktop Edition) + GitKit (VSCode Edition) + of the text. You can use the following link to find the + GitKit (Linux Desktop Edition) + GitKit (VSCode Edition) if you would like to review it. + .

        The Kit-tty Virtual Assistant

        - The Kit-tty (a play on Kit and TTY), pronounced kitty, is a virtual assistant built into the development environment. The Kit-tty has been designed to catch and correct student errors that were frequently observed in early uses of the GitKit. Many of the errors caught by the Kit-tty are those that would not be discovered until students progress several steps further into the activity, at which point they can be difficult to undo. + The Kit-tty (a play on Kit and TTY), pronounced kitty, is a virtual assistant built into the development environments (i.e. KitClients) that catches common student errors and provides hints on how to perform activity steps correctly. The Kit-tty has been designed to catch and correct student errors that were frequently observed in early uses of the GitKit. Many of the errors recognized by the Kit-tty are those that typically are not discovered until students progress several steps further into the activity, at which point they require more advanced git skills to undo.

        For example, the Kit-tty intervenes when a student attempts to:

        • - commit to the main branch (an action that should not happen in the forking workflow). + commit to the main branch (an action that should not happen in the forking workflow).

        • - merge a feature branch into main (instead of vice versa). + merge a feature branch into main (instead of vice versa).

        • @@ -352,7 +401,7 @@
          • - Students claim an issue by adding a comment to its ticket in the issue tracker. An automation notices this comment and assigns the issue to the student (if it hasn't already been assigned to someone else). The automation then also responds personally as a maintainer might: "Great! I assigned you (@TheirUsername) to the issue. Have fun working on it!" + When claiming an issue by adding a comment to its ticket in the issue tracker. An automation notices this comment, assigns the issue to the student (if it hasn't already been assigned to someone else). The automation then also responds personally as a maintainer might: "Great! I assigned you (@TheirUsername) to the issue. Have fun working on it!"

          @@ -372,7 +421,7 @@

          - The captured repository is from an earlier version of FarmData2. Current active development work on FarmData2 is occurring in the FarmData2 Organization on GitHub. + Current development work on FarmData2 is occurring in the FarmData2 Organization on GitHub.

          @@ -380,7 +429,7 @@ Creating a Runestone Course using the GitKit Text

          - The GitKit text is an e-text that is available on Runestone Academy. It contains a large number of interactive elements, (nearly) all of which are auto-graded and provide immediate feedback to students as they work through the GitKit. If you are not familiar with Runestone Academy it is recommended that you read the first 6 sections of the Using eBooks with Runestone Academy guide to familiarize yourself with it. + The GitKit text is an e-text that is available on Runestone Academy. It contains a large number of interactive elements, many of which are auto-graded and provide instant feedback to students as they work through the GitKit. If you are not familiar with Runestone Academy it is recommended that you read the first 6 sections of the Using eBooks with Runestone Academy guide to familiarize yourself with it.

          @@ -389,23 +438,30 @@

        • Create a Runestone course using the - GitKit text. + GitKit (Linux Desktop Edition) or the + GitKit (VSCode Edition) + of the text. +

          +

          + Note that you are currently viewing the + GitKit (Linux Desktop Edition) + GitKit (VSCode Edition) + .

        • You can either create assignments for your students from the GitKit sections and exercises, or you can Copy the Course Pack for the GitKit from the - gitkit base course into your course. + gitkitlinux + gitkitvscode + base course into your course.

          - The course pack includes a reading assignment and a problem assignment for each of the chapter of the GitKit text (except ). The provided reading assignment for each chapter includes all sections of the chapter and is auto-graded based on student interaction with each of he chapter's sections. The provided problem assignment for each chapter includes every interactive exercise in the chapter. Exercises are auto-graded graded using % Correct and the students last answer. -

          -

          - If you adopt the course pack you can modify the sections and questions that are included in the assignments, how they are graded and also add your own questions. See the Working with Assignments section of the Using eBooks with Runestone Academy guide for more details. + The course pack includes a reading assignment and a problem assignment for each of the chapter of the GitKit text (except ). The provided reading assignment for each chapter includes all sections of the chapter and is auto-grading based on student interaction with each of he chapter's sections. The provided problem assignment for each chapter includes every interactive exercise in the chapter. Every exercise that can be auto-graded is graded using % Correct and the students last answer. If you adopt the course pack you can modify the sections and questions that are included in the assignments, how they are graded and also add your own questions. See the Working with Assignments section of the Using eBooks with Runestone Academy guide for more details.

          - Note: The reading assignments in the course pack include sections that allow students to elect to participate in a research project aimed at (1) understanding what they think and know about open source tools and techniques and (2) assessing the effectiveness of the GitKit. In addition, there are surveys at the end of each chapter by which students can provide feedback to help improve the GitKit for future students. + The reading assignments in the course pack include sections that allow students to elect to participate in a research project aimed at (1) understanding what they think and know about open source tools and techniques and (2) assessing the effectiveness of the GitKit. In addition, there are surveys at the end of each chapter by which students can provide feedback to help improve the GitKit for future students.

          • @@ -414,7 +470,7 @@

            - also allows students to consent to providing the GitKit authors with their responses to all of the GitKit exercises. If you would like to provide the GitKit authors with exercise responses from students in your course who consented please contact Dr. Braught (braught@dickinson.edu) Professor of Computer Science at Dickinson College for additional information. + The also allows students to consent to providing the GitKit authors with their responses to all of the GitKit exercises. If you would like to provide the GitKit authors with exercise responses from students in your course who consented please contact Dr. Braught (braught@dickinson.edu) Professor of Computer Science at Dickinson College for additional information.

          • @@ -461,7 +517,7 @@
          • - Review the Slide Notes for the chapter for helpful instructor tips. + Review the Slide Notes for the chapter.

          • @@ -533,29 +589,7 @@
          • - Click this link to deploy the GitKit FarmData2 repository . -

            -
          • -
          • -

            - Click the green "Create new codespace" button. -

            -
          • -
          • -

            - Creating the codespace requires a few minutes. When it is complete will see the prompt in . - -

            - - The deployer prompting for the new repository name. - - - - Screenshot showing the deployer prompting for the new repository name. - - -
            + Click this link to Deploy the GitKit FarmData2 repository .

          • @@ -569,7 +603,7 @@
          • - The GitHub username or the name of a GitHub organization to which you have write permission as the location to deploy the upstream repository. + You GitHub username to deploy into your GitHub space, or the name of a GitHub organization to which you have write permission to deploy into that organization's GitHub space.

          • @@ -582,26 +616,18 @@
          • - Wait for the deployer to complete. This typically takes several minutes because the deployer must create the issues in the issue tracker slowly to avoid being rate-limited by the GitHub API. + Wait for the deployer to complete. This typically takes several minutes because the deployer must create the issues in the issue tracker slowly to avoid being rate-limited by the GitHub API.

          • - When the deployer completes it will generate output similar , which shows the URL of your deployed GitKit FarmData2 repository. - -

            - - The deployer showing the URL of the deployed GitKit FarmData2 repository. - - - - Screenshot of the deployer showing the URL of the deployed GitKit FarmData2 repository. - - -
            + When the deployer completes it will generate output similar to the following that shows the URL of your deployed GitKit FarmData2 repository.

            - +

            +Your new repository is ready. Give the URL below to your students. +https://github.com/someLocation/GitKit-FarmData2 + +

            Copy the URL of the repository and distribute it to your students using e-mail, LMS or whatever means is convenient for you.

            @@ -616,7 +642,7 @@
          • - Please consider visiting the link to the brief survey that is included in the output of the GitKit deployer. Your feedback helps us to better understand where and how the GitKit is being used. This survey can also be accessed here. + Please consider clicking the link to the brief survey that is included in the output of the GitKit deployer. Your feedback helps us to better understand where and how the GitKit is being used. This survey can also be accessed here.

          • @@ -707,7 +733,7 @@

            - For any kind of question, difficulty, suggestion, or suspected bug, chatting with us on Discord is the place to start. + For any kind of question, difficulty, suggestion, or suspected bug, chatting with us on Discord is a great place to start.

            @@ -715,7 +741,7 @@

            - Active work on the deployer and the KitClient takes place in the HFOSSedu Github Organization. Work on HFOSS Kits more generally occurs in Kits section of the HFOSSedu GitLab Organization. + Active work on the deployer and the KitClients takes place in the Kits section of the HFOSSedu GitLab Organization.

    \ No newline at end of file diff --git a/source/ch-instructor-guide/sec-instructor-merge-conflicts.ptx b/source/ch-instructor-guide/sec-instructor-merge-conflicts.ptx index 1cd61ae..2fc641f 100644 --- a/source/ch-instructor-guide/sec-instructor-merge-conflicts.ptx +++ b/source/ch-instructor-guide/sec-instructor-merge-conflicts.ptx @@ -7,10 +7,10 @@ Merge Conflicts Instructor Notes

    - At the start of this chapter students will have made pull requests for the "Round 2" issues. Initially GitHub will report that these PRs can be merged automatically. However, the instructor will begin this topic by introducing changes to the upstream main that create merge conflicts with the fixes to each of the "Round 2" issues. Students will then observe that their PRs go from being able to be merged automatically to containing conflicts. + At the start of this chapter students will have made pull requests for the "Round 2" issues. Initially GitHub will report that these PRs can be merged automatically. However, the instructor will begin this topic by introducing changes to the upstream main that create merge conflicts with the fixes to each of the "Round 2" issues. Students will then observe that their PRs go from being able to be merged automatically to containing conflicts.

    - This chapter then focuses on the resolution of merge conflicts. The concepts of merge commits, common ancestors, best common ancestor, and non-conflicting and conflicting changes are introduced. The topic then covers the process of merging main into a feature branch, git's raw conflict information and the use of a basic merge tool. The hands-on activity concludes with the students having resolved the merge conflict in their "Round 2" pull request. Note that these PRs are never merged into the upstream as part of the GitKit activities. + This chapter then focuses on the resolution of merge conflicts. The concepts of merge commits, common ancestors, best common ancestor, and non-conflicting and conflicting changes are introduced. The topic then covers the process of merging main into a feature branch, git's raw conflict information and the use of graphical merge tool. The hands-on activity concludes with the students having resolved the merge conflict in their "Round 2" pull request. Note that these PRs are never merged into the upstream as part of the GitKit activities.

    The exercises in this chapter have the students perform the following major tasks: @@ -32,7 +32,7 @@

  • - Use VS Code's basic merge tool to resolve the conflict. + Use the VS Code merge tool to resolve the conflict.

  • @@ -137,23 +137,15 @@
  • - Slide 21 + Slides 21-23

    - Shows the basic graphical merge tool that is built into VS Code. The exercises guide the students through use this tool to resolve the conflicts in their PRs for their "Round 2" issues. + Shows the graphical merge tool that is built into VS Code. The exercises guide the students through use this tool to resolve the conflicts in their PRs for their "Round 2" issues.

  • - Slide2 22-24 - -

    - These slides are hidden by default. They show a more advanced graphical merge tool that is also built into VS Code. The exercises do not use this merge tool, but some instructors may wish to show or demonstrate it. -

    -
  • -
  • - - Slide 25-26 + Slide 24-25

    Here for review and reference and not much time needs to be spent on these slides. The final slide collects into one diagram everything that is a part of the forking workflow. It has a lot going on, but by this point students should be able to make sense of each of the actions that are illustrated. @@ -195,30 +187,37 @@

  • - - + -

    - In these exercises there are no conflicting changes and the merge would be able to be completed automatically. However, if all of the non-conflicting changes are merged into the result the program will not produce the correct result. The point being that automatic merges can check for structural conflicts, but not logical or semantic conflicts and thus caution should be used when performing merges. + In this exercise there are no conflicting changes and the merge would be able to be completed automatically. However, if all of the non-conflicting changes are merged into the result the program will not produce the correct result. The point being that automatic merges can check for structural conflicts, but not logical or semantic conflicts and thus caution should be used when performing merges.

  • - +

    - Inevitably some students will be behind on their work and will complete their sync with upstream main after you have merged the PR for the addRound2Conflicts branch. In these cases, their pull requests will not create a conflict to be resolved. + Inevitably some students will be behind on their work and will complete their sync with upstream main after you have merged the PR for the addRound2Conflicts branch. In these cases, their pull requests will not create a conflict to be resolved. These students should follow the instructions given in . These directions have them pull the mergeConflictPractice branch and create a pull request for it. That PR will then contain conflicts with the changes in the addRound2Conflicts branch that was merged into main. They will then complete the activity using the mergeConflictPractice branch as it it were their feature branch. Students not in this situation, but who would like additional practice can also pull and use the mergeConflictPractice branch at the end of the activity.

    +
  • +
  • + +

    + . +

    +

    - These students should follow the instructions given in . These directions have them pull the mergeConflictPractice branch and create a pull request for it. That PR will then contain conflicts with the changes in the addRound2Conflicts branch that was merged into main. They will then complete the activity using the mergeConflictPractice branch as it it were their feature branch. Students not in this situation, but who would like additional practice can also pull and use the mergeConflictPractice branch at the end of the activity. + By default, VS Code does not display the best common ancestor in its merge tool. The steps given in these questions has the students change the VS Code configuration such that it includes the best common ancestor.

  • - . + .

    diff --git a/source/ch-instructor-guide/sec-instructor-synchronization.ptx b/source/ch-instructor-guide/sec-instructor-synchronization.ptx index cc95e36..6c83aed 100644 --- a/source/ch-instructor-guide/sec-instructor-synchronization.ptx +++ b/source/ch-instructor-guide/sec-instructor-synchronization.ptx @@ -142,7 +142,7 @@ Note

    - This set of materials may be a little short for a 75-minute class period. The remaining class time can be used to help students who had difficulties creating a PR, whose PR's cannot be merged automatically or are missing the "Closes" or "Fixes" lines. + This set of materials may be a little short for a 75-minute class period. The remaining class time can be used to help students who had difficulties creating a PR, who's PR's cannot be merged automatically or are missing the "Closes" or "Fixes" lines.

  • @@ -193,8 +193,11 @@
  • -

    - +

    + +

    +

    +

    @@ -214,7 +217,7 @@

  • - - . + - .

    diff --git a/source/ch-instructor-guide/sec-instructor-upstreaming.ptx b/source/ch-instructor-guide/sec-instructor-upstreaming.ptx index da8a6db..7747b42 100644 --- a/source/ch-instructor-guide/sec-instructor-upstreaming.ptx +++ b/source/ch-instructor-guide/sec-instructor-upstreaming.ptx @@ -7,7 +7,7 @@ Working Locally and Upstreaming Changes Instructor Notes

    - This chapter focuses on the upstreaming process. Students learn about feature branches, staging and committing changes, pushing feature branches to their origin repository, and making a pull request. At the end of the hands-on activity each student will have experienced the full forking workflow, resulting in a pull request to the upstream GitKit-FarmData2 repository for changes that fix the "Round 1" issue that they were assigned. The "Round 1" issues have been created such that they do not conflict with each other. Thus, all of the student pull requests should be able to be merged automatically. The instructor will typically perform these merges as a demonstration at the start of the class introducing . + This chapter focuses on the upstreaming process. Students learn about feature branches, staging and committing changes, pushing feature branches to their origin repository, and making a pull request. At the end of the hands-on activity each student will have experienced the full forking workflow, resulting in a pull request to the upstream GitKit-FarmData2 repository for changes that fix the "Round 1" issue that they were assigned. The "Round 1" issues have been created such that they do not conflict with each other. Thus, all of the student pull requests should be able to be merged automatically. The instructor will typically perform these merges as a demonstration at the start of .

    The exercises in this chapter have the students perform the following major tasks: @@ -138,11 +138,11 @@

  • - +

    - If a student is seeing commit dates, usernames and messages that differ from the correct answers then it is likely that they created their fork after PRs were merged at the start of . Other than difficulty answering these questions this will not cause an issue with continuing with this chapter. Issues will arise with the exercises in and . Each of those locations provide the students with instructions for resolving the issues at the point where they arise. + If a student is seeing commit dates, usernames and messages that differ from the correct answers then it is likely that they created their fork after PRs were merged at the start of . Other than difficulty answering these questions this will not cause an issue with continuing with this chapter. Issues will arise with the exercises in and . Each of those chapters provide the students with instructions for resolving the issues at the point where they arise.

  • @@ -155,6 +155,16 @@ The git status command here should show one untracked file with modifications and that file should agree with the file that they identified in .

  • +
  • + +

    + +

    +
    +

    + This question is a good checkpoint to ensure that they have done things correctly to this point. The most recent commit in the git log output should show that they committed changes to the correct file (i.e. the one from ) and that they have used a meaningful commit message. +

    +
  • diff --git a/source/ch-merge-conflicts/ch-merge-conflicts.ptx b/source/ch-merge-conflicts/ch-merge-conflicts.ptx index 4bbf864..3185d92 100644 --- a/source/ch-merge-conflicts/ch-merge-conflicts.ptx +++ b/source/ch-merge-conflicts/ch-merge-conflicts.ptx @@ -8,14 +8,13 @@

    - This chapter focuses on merge conflicts, why they arise and how they can be resolved. We saw that maintainers are regularly merging changes from contributor's pull requests into the upstream main branch. If those changes are merged after you created your feature branch, it is possible for a merge conflict to arise. If your changes and those merged into main affect different parts of the project, then the maintainers will still be able to merge your changes automatically. However, if the changes merged into main and the changes in your feature branch alter the same code or documentation, then a merge conflict will occur. Usually, you as the contributor and the expert on your work, will be asked to resolve the merge conflict so that the maintainers can merge your pull request automatically. In completing the most previous chapter, you will have created a pull request that, after other work was merged into the upstream main branch, has resulted in a merge conflict. This set of activities takes you through the process of resolving that merge conflict. + This chapter focuses on merge conflicts, why they arise and how they can be resolved. We saw that maintainers are regularly merging changes from contributor's pull requests into the upstream main branch. If those changes are merged after you created your feature branch, it is possible for a merge conflict to arise. If your changes and those merged into main affect different parts of the project, then the maintainers will still be able to merge your changes automatically. However, if the changes merged into main and the changes in your feature branch alter the same code or documentation, then a merge conflict will occur. Usually, you as the contributor and the expert on your work, will be asked to resolve the merge conflict so that the maintainers can merge your pull request automatically. We saw that this can be done by manually editing the raw merge conflict information or by using a graphical merge tool. In completing the most previous chapter, you will have created a pull request that, after other work was merged into the upstream main branch, has resulted in a merge conflict. This set of activities takes you through the process of resolving that merge conflict.

    - diff --git a/source/ch-merge-conflicts/images/basic-merge-tool-options.png b/source/ch-merge-conflicts/images/basic-merge-tool-options.png deleted file mode 100644 index 9610331..0000000 Binary files a/source/ch-merge-conflicts/images/basic-merge-tool-options.png and /dev/null differ diff --git a/source/ch-merge-conflicts/images/conflicting-upstream-changes.png b/source/ch-merge-conflicts/images/conflicting-upstream-changes.png index 3ed481c..d0e7bf2 100644 Binary files a/source/ch-merge-conflicts/images/conflicting-upstream-changes.png and b/source/ch-merge-conflicts/images/conflicting-upstream-changes.png differ diff --git a/source/ch-merge-conflicts/images/github-pr-conflict.png b/source/ch-merge-conflicts/images/github-pr-conflict.png deleted file mode 100644 index 048ed15..0000000 Binary files a/source/ch-merge-conflicts/images/github-pr-conflict.png and /dev/null differ diff --git a/source/ch-merge-conflicts/images/github-pr-no-conflict.png b/source/ch-merge-conflicts/images/github-pr-no-conflict.png deleted file mode 100644 index a9d3c6c..0000000 Binary files a/source/ch-merge-conflicts/images/github-pr-no-conflict.png and /dev/null differ diff --git a/source/ch-merge-conflicts/images/mergetool-settings.png b/source/ch-merge-conflicts/images/mergetool-settings.png new file mode 100644 index 0000000..466b22b Binary files /dev/null and b/source/ch-merge-conflicts/images/mergetool-settings.png differ diff --git a/source/ch-merge-conflicts/images/mergetool-window-new-settings.jpg b/source/ch-merge-conflicts/images/mergetool-window-new-settings.jpg new file mode 100644 index 0000000..8b59fb0 Binary files /dev/null and b/source/ch-merge-conflicts/images/mergetool-window-new-settings.jpg differ diff --git a/source/ch-merge-conflicts/images/mergetool-window.jpg b/source/ch-merge-conflicts/images/mergetool-window.jpg new file mode 100644 index 0000000..6f2401a Binary files /dev/null and b/source/ch-merge-conflicts/images/mergetool-window.jpg differ diff --git a/source/ch-merge-conflicts/images/placeholder.txt b/source/ch-merge-conflicts/images/placeholder.txt new file mode 100644 index 0000000..4ecebfd --- /dev/null +++ b/source/ch-merge-conflicts/images/placeholder.txt @@ -0,0 +1 @@ +Can delete this if images are added. \ No newline at end of file diff --git a/source/ch-merge-conflicts/images/synching-with-upstream-with-conflict.png b/source/ch-merge-conflicts/images/synching-with-upstream-with-conflict.png deleted file mode 100644 index 945675e..0000000 Binary files a/source/ch-merge-conflicts/images/synching-with-upstream-with-conflict.png and /dev/null differ diff --git a/source/ch-merge-conflicts/images/vscode-launch-mergetool.png b/source/ch-merge-conflicts/images/vscode-launch-mergetool.png new file mode 100644 index 0000000..e9f415f Binary files /dev/null and b/source/ch-merge-conflicts/images/vscode-launch-mergetool.png differ diff --git a/source/ch-merge-conflicts/sec-appendix-a.ptx b/source/ch-merge-conflicts/sec-appendix-a.ptx index 2bdfd73..2d5020c 100644 --- a/source/ch-merge-conflicts/sec-appendix-a.ptx +++ b/source/ch-merge-conflicts/sec-appendix-a.ptx @@ -22,7 +22,7 @@ Ensure that you are in your local repository in a Terminal. Use the following commands to restore your main branch to the state before the conflicts were introduced:
    • git switch main
    • -
    • git reset --hard HEAD~1
    • +
    • git reset --hard~1

    diff --git a/source/ch-merge-conflicts/sec-confirming-the-merge-conflict.ptx b/source/ch-merge-conflicts/sec-confirming-the-merge-conflict.ptx deleted file mode 100644 index 99f3471..0000000 --- a/source/ch-merge-conflicts/sec-confirming-the-merge-conflict.ptx +++ /dev/null @@ -1,329 +0,0 @@ - - -

    - Confirming the Merge Conflict - - -

    - While you were working on your Round2 issue your instructor, playing the role of a maintainer, merged some changes into the upstream main. These changes were merged after you created the feature branch for your Round2 issue. This situation is illustrated in . -

    - -

    -

    - Conflicting Upstream Changes. - - - Changes were merged into the upstream main branch that could conflict with changes in the pull request feature branches. - - -
    -

    - -

    - The changes that your instructor merged were specifically designed to create a conflict with the change that you made when you fixed your Round2 issue. Thus, the pull request you made in now contains a conflicting change and therefore cannot be merged automatically. -

    - -

    - The activities in the remainder of this section will reinforce your understanding of how the conflict arose, confirm that your main branch is out of synch with the upstream, and that your pull request cannot be merged automatically. -

    -
    - - - - - <exercise - xml:id="ex-identifying-commits-that-conflict" label="ex-identifying-commits-that-conflict"> - <introduction> - <p> - Complete the following tasks that ask about the current situation, which is illustrated in <xref ref="fig-conflicting-upstream-changes" />. - </p> - </introduction> - - <task> - <statement> - <p> - Which of the following commits (i.e. which color) in <xref ref="fig-conflicting-upstream-changes" /> did the instructor add to the upstream <c>main</c> branch after you created the feature branch for your Round2 issue? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Dark Blue - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Lime Green - </p> - </statement> - <feedback> - <p> - The lime green commit is not in the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Brown - </p> - </statement> - <feedback> - <p> - The brown commit is not in the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Light Blue - </p> - </statement> - <feedback> - <p> - The light blue commit was added to the upstream <c>main</c> before the contributors created their feature branches. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Yellow - </p> - </statement> - <feedback> - <p> - The yellow commit was added to the upstream <c>main</c> before the contributors created their feature branches. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look at which commits are in upstream <c>main</c> branch that are not in the contributors' <c>main</c> branches. - </p> - </hint> - </task> - - <task> - <statement> - <p> - Which of the following commits (i.e. which color) in <xref ref="fig-conflicting-upstream-changes" /> did you create that will create a merge conflict with the upstream <c>main</c> branch? - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - Dark Blue - </p> - </statement> - <feedback> - <p> - The dark blue commit is already in the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Lime Green - </p> - </statement> - <feedback> - <p> - The lime green commit might create a merge conflict, but it is not your commit. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - Brown - </p> - </statement> - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Light Blue - </p> - </statement> - <feedback> - <p> - The light blue commit is already in the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Yellow - </p> - </statement> - <feedback> - <p> - The yellow commit is already in the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look for a commit in your local repository that might contain changes that could conflict with the changes in the dark blue commit. - </p> - </hint> - </task> - </exercise> - - <exercise - xml:id="ex-no-automatic-merge-on-github" - label="ex-no-automatic-merge-on-github"> - <introduction> - <p> - If everything is as we saw above, then the pull request that you created for your Round2 issue will contain a merge conflict with the upstream <c>main</c> branch. Let's confirm that it does before going on. - </p> - </introduction> - <task> - <statement> - <p> - Visit the <c>upstream</c> repo on GitHub, click on the "Pull requests" tab. - </p> - </statement> - </task> - <task> - <statement> - <p> - Find and click on your Round2 pull request. - </p> - </statement> - </task> - <task> - <statement> - <p> - Scroll down toward the bottom of the pull request. - </p> - </statement> - </task> - <task - xml:id="ex-can-branch-be-auto-merged" - label="ex-can-branch-be-auto-merged"> - <statement> - <p> - Which of the following messages do you see? - </p> - </statement> - <choices> - <choice> - <statement> - <image source="images/ch-merge-conflicts/github-pr-no-conflict.png" width="90%"> - <description> - <p> - GitHub message indicating that merging can be performed automatically. - </p> - </description> - </image> - </statement> - <feedback> - <p> - <term>IMPORTANT:</term> You should be seeing that your pull request cannot be merged automatically. <term>Follow the instructions in <xref ref="topic-appendix-a-merge-conflicts"/> to fix this problem.</term> - </p> - <p> - When your pull request cannot be merged automatically, return to this question and continue. See your instructor if you cannot resolve this problem. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <image source="images/ch-merge-conflicts/github-pr-conflict.png" width="90%"> - <description> - <p> - GitHub message indicating that there are merge conflicts that must be resolved. - </p> - </description> - </image> - </statement> - <feedback> - <p> - Excellent. Everything is as it should be. Please continue to the next exercise. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - I don't see either of the other messages. - </p> - </statement> - <feedback> - <p> - If you see a message about GitHub checking if the merge can be performed automatically, wait a few moments for one of the other messages to appear. - </p> - </feedback> - </choice> - </choices> - </task> - </exercise> - - <exercise - xml:id="ex-what-created-the-conflict" - label="ex-what-created-the-conflict"> - <statement> - <p> - We now know that your Round2 pull request contains a merge conflict and cannot be merged automatically. Place the following actions into an order which could have created this merge conflict. - </p> - <p></p> - </statement> - <blocks randomize="yes"> - <block name="branch"> - <p> - You created a feature branch. - </p> - </block> - <block name="merge" depends="branch"> - <p> - Changes were merged into upstream main. - </p> - </block> - <block name="fix" depends="branch"> - <p> - You fixed your Round2 issue. - </p> - </block> - <block name="pr" depends="branch fix"> - <p> - You made your Round2 PR. - </p> - </block> - </blocks> - <hint> - <p> - For a conflict to occur the upstream <c>main</c> branch must contain changes that are not in your feature branch. - </p> - </hint> - <hint> - <p> - When would you have to create your feature branch for the upstream <c>main</c> branch to contain changes that are not in your feature branch. - </p> - </hint> - </exercise> - - </exercises> -</section> diff --git a/source/ch-merge-conflicts/sec-extra-practice.ptx b/source/ch-merge-conflicts/sec-extra-practice.ptx index e44916c..3048cef 100644 --- a/source/ch-merge-conflicts/sec-extra-practice.ptx +++ b/source/ch-merge-conflicts/sec-extra-practice.ptx @@ -12,372 +12,103 @@ <exercises> <title /> - - <exercise - xml:id="ex-restarting-kitclient-for-extra-practice" label="ex-restarting-kitclient-for-extra-practice"> + <exercise xml:id="ex-extra-practice-merging-fetch-repo" label="ex-extra-practice-merging-fetch-repo"> <statement> <p> - To do the extra practice you'll need to have your development environment running. - </p> - <p> - Click here to <url href="https://codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1" visual="codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1">open your development environment</url>. + The upstream repository contains a branch created just for this practice. Use the following command to get this feature branch from the upstream into your local repo: + <ul marker=""> + <li> + <p> + <c>git fetch upstream merge-conflict-practice</c> + </p> + </li> + </ul> </p> <p> - Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following: + The <c>merge-conflict-practice</c> branch was created so that it contains some conflicts with the upstream <c>main</c> branch. When you have fetched this branch, think of it as if you had created it from <c>main</c>, then made some changes that resulted in conflicts with the upstream <c>main</c> branch. This leaves you at the point where you are trying to merge main into this feature branch and resolve the conflicts (e.g. like in <xref ref="fig-resolving-merge-conflict" />). </p> - - <image source="images/shared-images/DevEnv-Kitty-Ready.png" width="75%"> - <description> - The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message. - </description> - </image> </statement> - </exercise> - + <choices> + <choice correct="yes"> + <statement> + <p> + I have fetched the branch + </p> + </statement> + </choice> - <exercise - xml:id="ex-extra-practice-merging-fetch-repo" label="ex-extra-practice-merging-fetch-repo"> - <introduction> - <p> - The upstream repository contains a branch created just for this extra practice. This branch was created so that it contains some pre-made conflicts with the upstream <c>main</c> branch. - </p> - </introduction> - <task> - <statement> - <p> - Use the following command to get this feature branch from the upstream into your local repo: <c>git fetch upstream merge-conflict-practice</c> - </p> - </statement> - </task> - <task> - <statement> - <p> - Run the <c>git branch -a</c> command in the terminal to list all of the branches known to your local repository. - </p> - <p> - Which of the following branches are listed? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>main</c> - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - <c>remotes/upstream/merge-conflict-practice</c> - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>development</c> - </p> - </statement> - <feedback> - <p> - Are you sure this branch exists? - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>beta</c> - </p> - </statement> - <feedback> - <p> - Are you sure this branch exists? - </p> - </feedback> - </choice> - </choices> - </task> - <hint> - <p> - If you do not see the <c>remotes/upstream/merge-conflict-practice</c> branch, try the <c>git fetch</c> command again. - </p> - </hint> + <choice> + <statement> + <p> + I have not fetched the branch + </p> + </statement> + <feedback> + <p> + Do not make continue until you have the <c>merge-conflict-practice</c> branch set up. + </p> + </feedback> + </choice> + </choices> </exercise> - <p> - At this point you should think of the <c>merge-conflict-practice</c> branch as a feature branch that you created from your <c>main</c> and then made some changes that resulted in conflicts with the upstream <c>main</c> branch. Thinking of the <c>merge-conflict-practice</c> branch this way leaves you at the point where you are trying to merge the modified upstream <c>main</c> into your feature branch as you did in <xref ref="topic-git-merge-command" />). - </p> - <exercise xml:id="ex-extra-practice-merging-active-branch" label="ex-extra-practice-merging-active-branch"> <statement> <p> - Assuming that your <c>main</c> branch is active, select and order statements that will make the <c>merge-conflict-practice</c> branch active and then merge the <c>main</c> branch into it. Note: not all commands will be used. + Make the <c>merge-conflict-practice</c> branch active and try to merge <c>main</c> into it. Give the commands that you used and their output here. </p> </statement> - <blocks randomize="yes"> - <block> - <p> - <cline>git switch merge-conflict-practice</cline> - </p> - </block> - <block> - <p> - <cline>git merge main</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git merge merge-conflict-practice</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git switch main</cline> - </p> - </block> - </blocks> - <hint> - <p> - Review <xref ref="topic-git-merge-command" /> for how to merge <c>main</c> into a feature branch. - </p> - </hint> + <response /> </exercise> - <exercise - xml:id="ex-extra-practice-do-merge" - label="ex-extra-practice-do-merge"> - <introduction> + <exercise xml:id="ex-extra-practice-merging-resolve-conflicts" label="ex-extra-practice-merging-resolve-conflicts"> + <statement> <p> - Merging the <c>main</c> branch into the <c>merge-conflict-practice</c> branch will create some conflicts for you to resolve. + The <c>merge-conflict-practice</c> branch contains a few conflicts so the merge you attempted in <xref ref="ex-extra-practice-merging-active-branch" /> should fail. Resolve the conflicts by accepting the changes from the merge-conflict-practice branch and all of the non-conflicting changes from the main branch. </p> - </introduction> - <task - xml:id="ex-extra-practice-merge-conflicts-file" - label="ex-extra-practice-merge-conflicts-file"> - <statement> - <p> - Execute the commands you selected in <xref ref="ex-extra-practice-merging-active-branch" /> to perform the merge. - </p> - <p> - In which file were the merge conflicts created? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>README.md</c> - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>ONBOARDING.md</c> - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>INSTALL.md</c> - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>LICENSE.md</c> - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>CONTRIBUTING.md</c> - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - The file containing the conflicts should have opened in the editor automatically when you performed the <c>git merge</c> operation. - </p> - </hint> - </task> + </statement> + <choices> + <choice correct="yes"> + <statement> + <p> + I have resolved the conflicts + </p> + </statement> + </choice> - <task - xml:id="ex-extra-practice-num-merge-conflicts" - label="ex-extra-practice-num-merge-conflicts"> - <statement> - <p> - How many merge conflicts were created? - </p> - </statement> - <choices randomize="no"> - <choice correct="yes"> - <statement> - <p> - 1 - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - 2 - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - 3 - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - More than 3. - </p> - </statement> - <feedback> - <p> - Check the hint. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Examine the <c>README.md</c> file that opened when you performed the merge operation. Look for places where raw merge conflict information appears. - </p> - </hint> - </task> + <choice> + <statement> + <p> + I have not resolved the conflicts + </p> + </statement> + <feedback> + <p> + Do not make continue until you resolve the conflicts. + </p> + </feedback> + </choice> + </choices> </exercise> - <exercise xml:id="ex-extra-practice-resolving-conflicts" label="ex-extra-practice-resolving-conflicts"> + <exercise xml:id="ex-extra-practice-merging-save-commit" label="ex-extra-practice-merging-save-commit"> <statement> <p> - Choose and order the steps below to describe the sequence of things that you will do to resolve the merge conflicts that were created. + Save your changes and commit them to resolve the conflicts to your feature branch. Be sure to use a meaningful commit message. Give the commands that you used and their output here. </p> </statement> - <blocks randomize="yes"> - <block> - <p> - Edit the merge conflict information. - </p> - </block> - <block> - <p> - <cline>git stage README.md</cline> - </p> - </block> - <block> - <p> - <cline>git commit -m "<message>"</cline> - </p> - </block> - <block> - <p> - <cline>git push origin merge-conflict-practice</cline> - </p> - </block> - <block> - <p> - Create a pull request to the upstream. - </p> - </block> - </blocks> + <response /> </exercise> - <exercise xml:id="ex-extra-practice-do-it" label="ex-extra-practice-merging-do-it"> + <exercise xml:id="ex-extra-practice-merging-push-pr" label="ex-extra-practice-merging-push-pr"> <statement> <p> - Carry out the steps you identified above in <xref ref="ex-extra-practice-resolving-conflicts" /> and give a link to your pull request. - </p> - <p> - <var width="55" /> + Push the <c>merge-conflict-practice</c> branch to your <c>origin</c> and create a pull request to the upstream. Give a link to your pull request. </p> </statement> - <setup> - <var> - <condition string='^https://github\.com/DickinsonCollege/FarmData2).)/pulls[0-9]+$'> - - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Be sure that your URL is from your pull request to the upstream repository. - </p> - </feedback> - </condition> - </var> - </setup> - <hint> - <p> - Review sections <xref ref="topic-resolving-a-merge-conflict" /> and <xref ref="topic-updating-your-pull-request" />. - </p> - </hint> + <response /> </exercise> </exercises> + </section> diff --git a/source/ch-merge-conflicts/sec-git-command-summary.ptx b/source/ch-merge-conflicts/sec-git-command-summary.ptx index 93d8196..7837ddf 100644 --- a/source/ch-merge-conflicts/sec-git-command-summary.ptx +++ b/source/ch-merge-conflicts/sec-git-command-summary.ptx @@ -22,34 +22,18 @@ </statement> <matches> <match> - <premise><c>git switch <branch> </c></premise> - <response>Change the active branch.</response> + <premise><c>git merge <target> </c></premise> + <response>Merge changes from source branches into a target branch</response> </match> <match> - <premise><c>git pull upstream main </c></premise> - <response>Synchronize the local <c>main</c> branch with the upstream <c>main</c> branch.</response> + <premise><c>git merge --abort </c></premise> + <response>Undo a merge that failed due to conflicts</response> </match> <match> - <premise><c>git push origin main </c></premise> - <response>Synchronize the origin <c>main</c> branch with the local <c>main</c> branch.</response> + <premise><c>git mergetool </c></premise> + <response>Launch the configured graphical merge tool</response> </match> - <match> - <premise><c>git merge <source> </c></premise> - <response>Add changes to source branch into the active branch</response> - </match> - <match> - <premise><c>git stage <file></c></premise> - <response>Indicate that changes to a file should be included in the next commit.</response> - </match> - <match> - <premise><c>git commit -m "<message>"</c></premise> - <response>Add staged changes to the active branch.</response> - </match> - <match> - <premise><c>git push origin "<branch>"</c></premise> - <response>Copy the named branch to your origin repository.</response> - </match> - </matches> + </matches> <hint> <p> Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. diff --git a/source/ch-merge-conflicts/sec-merging-the-main-branch-into-a-feature-branch.ptx b/source/ch-merge-conflicts/sec-merging-the-main-branch-into-a-feature-branch.ptx index f0dbb6e..7d0d980 100644 --- a/source/ch-merge-conflicts/sec-merging-the-main-branch-into-a-feature-branch.ptx +++ b/source/ch-merge-conflicts/sec-merging-the-main-branch-into-a-feature-branch.ptx @@ -8,383 +8,147 @@ <introduction> <p> - Your local and origin <c>main</c> branches now contain the changes that were made to the upstream main branch. The next step is to merge the changes from the <c>main</c> branch into your feature branch. + Your local main branch now contains the changes that were made to the upstream main branch. The next step is to merge the changes from the main branch into your feature branch. This is like the example from class, which is illustrated in <xref ref="fig-merge-main-into-feature" />. + </p> + <p> + <xref ref="fig-merge-main-into-feature" /> shows the <c>main</c> branch in the right panel, the contributor's feature branch in the left panel, and the common ancestor in the middle. + </p> + <p> + <figure xml:id="fig-merge-main-into-feature"> + <caption> Merge main into feature branch </caption> + <image source="images/ch-merge-conflicts/merge-main-into-feature.png" width="75%"> + <description> + main branch timeline with feature branch merge + </description> + </image> + </figure> </p> </introduction> - <subsection - xml:id="topic-branch-vocabulary" - label="topic-branch-vocabulary"> - <title>Branch Vocabulary - -

    - shows the merge example from the class slides. -

    + + - <p> - <figure xml:id="fig-merge-main-into-feature"> - <caption> Merging the <c>main</c> branch into a feature branch. </caption> - <image source="images/ch-merge-conflicts/merge-main-into-feature.png" width="75%"> - <description> - Illustration of the <c>main</c> branch being merged into a feature branch. - </description> - </image> - </figure> - </p> - - <p> - When two branches are merged the branch containing the changes to be merged is called the <term>source branch</term>, and the branch into which the changes are merged is called the <term>target branch</term>. - <p> - </p> - When the changes in the source and target branches have been successfully merged a <term>merge commit</term> containing the merged changes is added to the target branch. - </p> - </introduction> - <exercises> - <title /> - <exercise - xml:id="ex-name-source-target-branches" label="ex-name-source-target-branches"> + <exercise xml:id="ex-name-source-target-branches" label="ex-name-source-target-branches"> + <statement> + <p> + If you are going to merge the changes from the <c>main</c> branch into your feature branch, which branches will be the source branches? Which branch will be the target branch? + </p> + </statement> + <matches> + <match order="1"> + <premise>Source Branches</premise> + <response><c>main</c></response> + </match> + <match order="2"> + <premise>Target Branch</premise> + <response>feature branch</response> + </match> + </matches> + </exercise> + + <exercise xml:id="ex-merge-main-branch" label="ex-merge-main-branch"> + <introduction> + <p> + The <c>git merge <branch name></c> command will attempt to merge the changes in the active branch with the changes in <c><branch name></c> (i.e. the source branches) into a merge commit in the currently active branch (i.e. the target branch). + </p> + </introduction> + <task xml:id="ex-merge-main-branch-a" label="ex-merge-main-branch-a"> <statement> <p> - Match the branch names to the appropriate term below. + To use the <c>merge</c> command as just described your feature branch (i.e. the target branch) must be the active branch. Switch to your feature branch and confirm that it is now the active branch. </p> - </statement> - <matches> - <match order="1"> - <premise><c>main</c></premise> - <response>Source Branch</response> - </match> - <match order="2"> - <premise>feature branch (<c>hadPig</c>)</premise> - <response>Target Branch</response> - </match> - </matches> - <hint> <p> - Read the introduction to this section. + What were the commands you used? And their output? You can copy your work into the provided textbox. </p> - </hint> - </exercise> - <exercise - xml:id="ex-merge-commit" - label="ex-merge-commit"> + </statement> + <response /> + </task> + <task xml:id="ex-merge-main-branch-b" label="ex-merge-main-branch-b"> <statement> <p> - Which commit (i.e. which color) in <xref ref="fig-merge-main-into-feature" /> is the merge commit created by merging the <c>main</c> branch into the <c>hadPig</c> branch? + Use the <c>merge</c> command to try to merge the changes contained in the <c>main</c> branch and in your feature branch into your feature branch. </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Dark blue with a brown ring. - </p> - </statement> - <feedback> - <p> - Correct. The dark blue commit in <c>main</c> was merged with the brown commit in the <c>hadPig</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Dark blue - </p> - </statement> - <feedback> - <p> - The dark blue commit is a commit in the <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Brown - </p> - </statement> - <feedback> - <p> - The brown commit is a commit in the <c>hadPig</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pink - </p> - </statement> - <feedback> - <p> - The pink commit is a commit in the <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Light blue with a white ring. - </p> - </statement> - <feedback> - <p> - The light blue with a white ring is a merge commit in <c>main</c>. Likely from merging a pull request. - </p> - </feedback> - </choice> - </choices> - <hint> <p> - Read the introduction to this section and examine <xref ref="fig-merge-main-into-feature" />. + What were the commands you used? And their output? You can copy your work into the provided textbox. </p> - </hint> - </exercise> - </exercises> - </subsection> - - <subsection - xml:id="topic-git-merge-command" - label="topic-git-merge-command"> - <title>The <c>git merge</c> Command. - -

    - The command git merge <branch name> will attempt to merge the changes in the active branch with the changes in <branch name>. -

    -
    - - - <exercise - xml:id="ex-merge-main-into-had-pig" - label="ex-merge-main-into-had-pig"> + </statement> + <response /> + </task> + </exercise> + + <exercise xml:id="ex-merge-conflict-file" label="ex-merge-conflict-file"> + <introduction> + <p> + The output from <xref ref="ex-merge-main-branch" /> should indicate that the automatic merge failed due to a conflict. If your merge command did not fail due to a conflict, return to <xref ref="ex-no-automatic-merge-on-github" /> and follow the instructions from there again. + </p> + </introduction> + <task xml:id="ex-merge-conflict-file-a" label="ex-merge-conflict-file-a"> <statement> <p> - Imagine that the <c>main</c> branch is the active branch. Select and arrange statements from those listed below such that the <c>main</c> branch will be merged into the <c>hadPig</c> branch as in <xref ref="fig-merge-main-into-feature" />. Note: Not all statements will be used. + In which file is the conflict located? </p> </statement> - <blocks randomize="yes"> - <block> - <p> - <cline>git switch hadPig</cline> - </p> - </block> - <block> - <p> - <cline>git merge main</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git merge hadPig</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git switch main</cline> - </p> - </block> - </blocks> - </exercise> - - <exercise xml:id="ex-make-feature-active" label="ex-make-feature-active"> - <introduction> - <p> - To merge the <c>main</c> branch into your feature branch, your feature branch must be the active branch. Let's ensure that your feature branch is the active branch. - </p> - </introduction> - <task> - <statement> - <p> - Use the <c>git switch <branch></c> command to make your feature branch the active branch. - </p> - </statement> - </task> - <task> - <statement> - <p> - Use the <c>git status</c> command to check that your feature branch is now the active branch. - </p> - </statement> - </task> - </exercise> - - <exercise - xml:id="ex-merge-main-into-feature-cmd" - label="ex-merge-main-into-feature-cmd"> + <response /> + </task> + <task xml:id="ex-merge-conflict-file-b" label="ex-merge-conflict-file-b"> <statement> <p> - Now that your feature branch is the active branch, give a command that will merge the <c>main</c> branch into your feature branch. + Use the <c>cat</c> command to display the file containing the conflict. </p> <p> - <var width="55" /> + Find the part of the file that contains the <em>raw conflict information</em> and copy and paste it here. Be sure to include the chevrons at the top and bottom of the conflict information. </p> </statement> - <setup> - <var> - <condition string="^git merge main$"> - <feedback> - <p> - Correct. - </p> - </feedback> - </condition> - <condition string="^git merge .+$"> - <feedback> - <p> - You want to merge the <c>main</c> branch into your feature branch, which is the active branch. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Review the format of the <c>git merge</c> command above. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - The command you want is in <xref ref="ex-merge-main-into-had-pig" />. - </p> - </feedback> - </condition> - </var> - </setup> - <hint> - Be sure you are using your GitHub origin repository (see <xref ref="ex-fork-url" />). This clone URL should contain your GitHub username and end in <c>.git</c>. - </hint> + <response /> + </task> </exercise> - <exercise - xml:id="ex-merge-main-into-feature" - label="ex-merge-main-into-feature"> + <exercise xml:id="ex-identify-ancestor-main-feature" label="ex-identify-ancestor-main-feature"> <introduction> <p> - Now let's try top merge the changes in the <c>main</c> branch into your feature branch. + Answer the following questions by copying the appropriate portion of the output that you gave in <xref ref="ex-merge-conflict-file-b" />. </p> </introduction> - <task> + <task xml:id="ex-identify-ancestor-main-feature-a" label="ex-identify-ancestor-main-feature-a"> <statement> <p> - Run your <c>merge</c> command from <xref ref="ex-merge-main-into-feature-cmd" /> in the terminal. + What is the part of the output that is the Best Common Ancestor? </p> </statement> + <response /> </task> - <task> + <task xml:id="ex-identify-ancestor-main-feature-b" label="ex-identify-ancestor-main-feature-b"> <statement> <p> - Which of the following statements best describes what happened when you ran your <c>merge</c> command? + What is the part of the output that shows the changes that the maintainers merged into the <c>main</c> branch after you made your feature branch? </p> </statement> - <choices> - <choice correct="yes"> - <statement> - <p> - The terminal displays a message indicating "Automatic merge failed; fix conflicts and then commit the result." - </p> - </statement> - <feedback> - <p> - Excellent! Because there is a merge conflict between the <c>main</c> branch and your feature branch, this is what we expect. Continue to the next exercise. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The "GNU nano" editor opens with the first line of text being "Merge branch 'main' into" your feature branch. - </p> - </statement> - <feedback> - <p> - Uh Oh! Something went wrong. Let's try to fix it. - <ol marker="1"> - <li>Press <c>Ctrl-x</c> to exit the nano editor.</li> - <li>Run the command <c>git revert --hard HEAD~1</c></li> - <li>Go back to <xref ref="ex-no-automatic-merge-on-github" /> and ensure that your pull request contains a conflict.</li> - <li>Then try your <c>merge</c> command again.</li> - </ol> - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Something else happened. - </p> - </statement> - <feedback> - <p> - Double check that your <c>merge</c> command from <xref ref="ex-merge-main-into-feature-cmd" /> is correct and that you typed it into the terminal correctly. - </p> - </feedback> - </choice> - </choices> + <response /> </task> - <task> + <task xml:id="ex-identify-ancestor-main-feature-c" label="ex-identify-ancestor-main-feature-c"> <statement> <p> - Which of the following things also happened when you ran your <c>merge</c> command? + What is the part of the output that shows your changes? </p> </statement> - <choices> - <choice correct="yes"> - <statement> - <p> - The terminal displays a message indicating that there is a "Merge conflict in README.md." - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - The <c>README.md</c> file is opened in the editor. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The conflict is automatically resolved. - </p> - </statement> - <feedback> - <p> - The conflict cannot be automatically resolved because there is a conflict. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The development environment plays a sad song because there is a conflict. - </p> - </statement> - <feedback> - <p> - That would be fun, but unfortunately not. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look at the output in the terminal and the file that is open in the development environment. - </p> - </hint> + <response /> </task> - </exercise> + </exercise> + + <exercise> + <statement> + <p> + Sometimes when you try to merge, and it fails due to a conflict you may want to undo the attempted merge. The <c>git merge --abort</c> command will undo a failed merge. + </p> + <p> + Undo the merge that you started in <xref ref="ex-merge-main-branch" /> and use the <c>cat</c> command to display the file that contains the conflict again. + </p> + <p> + Briefly explain how you can tell from the output of <c>cat</c> that the failed merge has been undone? + </p> + </statement> + <response /> + </exercise> </exercises> - </subsection> + </section> diff --git a/source/ch-merge-conflicts/sec-resolving-a-merge-conflict.ptx b/source/ch-merge-conflicts/sec-resolving-a-merge-conflict.ptx index 7ec6f02..d43a3dc 100644 --- a/source/ch-merge-conflicts/sec-resolving-a-merge-conflict.ptx +++ b/source/ch-merge-conflicts/sec-resolving-a-merge-conflict.ptx @@ -15,581 +15,218 @@ <caption> Resolving a Merge Conflict </caption> <image source="images/ch-merge-conflicts/resolving-merge-conflict.png" width="75%"> <description> - Image illustrating changes merged into the upstream that conflict with a local branch. + Cloud image of the changes merged into the upstream that conflict with a local branch </description> </image> </figure> </p> <p> - This section will walk you through the process of resolving the merge conflict. In <xref ref="topic-merging-the-main-branch-into-a-feature-branch" text="type-global-title" /> you merged the <c>main</c> branch into your feature branch. This created a merge conflict. In this section you will edit the raw merge conflict information to resolve the conflict and then you will stage and commit the merged changes. + This section will walk you through the process of resolving the merge conflict using a graphical merge tool. The flow of this process is illustrated in Figure 3. You will switch to your feature branch, perform the merge, use the graphical merge tool to resolve the resulting conflict, and then stage and commit the merged content. </p> </introduction> - <subsection - xml:id="topic-merge-conflict-information" - label="topic-merge-conflict-information"> - <title>Raw Merge Conflict Information - -

    - After completing the README.md file should be open in your editor and the raw merge conflict information should be displayed. -

    -

    - If you are not seeing the README.md file open it from the EXPLORER pane. If you are not seeing the merge conflict information, scroll through the README.md file to the location where you made your change. The raw merge conflict information should appear there. If it does not, return to and try to correct the issue. -

    -
    + + - <exercises> - <title /> + <exercise xml:id="ex-preparing-resolution" label="ex-preparing-resolution"> + <statement> + <p> + Ensure that you are on your feature branch. Then issue the command to merge the <c>main</c> branch into your feature branch (like you did in <xref ref="ex-merge-main-branch" />). The merge should once again fail because of the conflict. Use the <c>cat</c> command to confirm that the raw merge conflict information now appears in the conflicted file again. + </p> + </statement> + </exercise> + <p> + As you have seen when a merge fails <c>git</c> places the raw merge conflict information into the conflicted files. You could simply edit that file to resolve the merge conflict. However, in practice it is usually easier to use a <em>mergetool</em>. + </p> - <exercise xml:id="ex-raw-merge-information" label="ex-raw-merge-information"> - <introduction> + <p> + <term>Opening the MergeTool: </term> + </p> + <p component="linux-kit-client"> + The KitClient you are using has been configured so that the <c>git mergetool</c> command will launch the the VSCode graphical merge tool, which you can use to resolve the conflict. + </p> + <p component="vscode-kit-client"> + The KitClient you are using has configured VS Code's Merge Editor as a mergetool. + </p> + + <exercise xml:id="ex-launch-mergetool" label="ex-launch-mergetool"> + <introduction> + <p component="linux-kit-client"> + The <c>git mergetool</c> command will launch the VSCode merge tool so that you can use it to resolve the conflict. + </p> + <p component="vscode-kit-client"> + To open a file in VS Code's Merge Editor: + </p> + </introduction> + <task xml:id="ex-launch-mergetool-linux-a" label="ex-launch-mergetool-linux-a" component="linux-kit-client"> + <statement> <p> - The editor window for the <c>README.md</c> file displays the <term>raw conflict information</term> that has resulted from the merge. The following tasks ask you some question about this information. + Issue the <c>git mergetool</c> command. </p> - </introduction> - <task - xml:id="ex-raw-merge-content" - label="ex-raw-merge-content"> - <statement> - <p> - Match the terms below to the descriptions based upon what is displayed in the editor. - </p> - </statement> - <matches> - <match> - <premise>Feature branch contents</premise> - <response> - Appears with a green highlight at the top of the conflict information. - </response> - </match> - <match> - <premise>Best common ancestor</premise> - <response> - Appears with a gray highlight in the middle of the conflict information. - </response> - </match> - <match> - <premise><c>main</c> branch contents</premise> - <response> - Appears with a blue highlight at the bottom of the conflict information. - </response> - </match> - </matches> - </task> - <task - xml:id="ex-raw-merge-dividers" - label="ex-raw-merge-dividers"> - <statement> - <p> - Match the terms below to the descriptions based upon what is displayed in the editor. - </p> - </statement> - <matches> - <match> - <premise> - Left Chevrons <c><<<<<<<</c> - </premise> - <response> - Indicate the start of the merge conflict information. - </response> - </match> - <match> - <premise> - Vertical Bars <c>|||||||</c> - </premise> - <response> - Separate the feature branch content from the best common ancestor. - </response> - </match> - <match> - <premise>Equal Signs <c>=======</c></premise> - <response> - Separate the best common ancestor from the <c>main</c> branch content. - </response> - </match> - <match> - <premise> - Right Chevrons <c>>>>>>>></c> - </premise> - <response> - Indicate the end of the merge conflict information. - </response> - </match> - </matches> - </task> - </exercise> - </exercises> - </subsection> - - <subsection - xml:id="topic-resolving-the-conflict" - label="topic-resolving-the-conflict"> - <title>Resolving the Merge Conflict - -

    - Recall that the merge conflict that you are seeing arose because your feature branch and the upstream main branch contain changes to the same part of the file. In this situation, Git is not able to automatically decide which changes to keep or how to combine the changes. This decision must be made by a developer, in this case... by you! -

    -

    - It is possible to resolve merge conflicts by editing the raw merge information, including removing the chevrons and dividers. However, most development environments, including the one you are using, provide special tools to help with the resolution of merge conflicts. -

    -

    - The basic merge tool in your development environment provides four options to assist with resolving merge conflicts. These options appear in the editor just above the merge conflict information as shown in . -

    -

    -

    - The basic merge tool options. - - - Image illustrating the basic merge tool options of "Accept Current Change", "Accept Incoming Change", "Accept Both Changes", "Compare Changes". - - -
    -

    -
    - - - <exercise - xml:id="ex-merge-tool-options" - label="ex-merge-tool-options"> - <statement> <p> - Match the option you would choose to perform each of the indicated operations. + When VS Code's Merge Editor is first opened, it will open a window containing three panes (<c>LOCAL</c>, <c>REMOTE</c> and Result). The content that you see will be different, but the window that you see should be similar to the one shown in <xref ref="fig-merge-editor-window" />. </p> - </statement> - <matches> - <match> - <premise> - Accept Current Change - </premise> - <response> - Accept the changes in your feature branch. - </response> - </match> - <match> - <premise> - Accept Incoming Change - </premise> - <response> - Accept the changes in the <c>main</c> branch. - </response> - </match> - </matches> - <hint> <p> - Compare the terms used in the merge tool options to the information displayed in the first and last lines of the merge conflict information. + <figure xml:id="fig-merge-editor-window" > + <caption> Merge Editor Window (example) </caption> + <image source="images/ch-merge-conflicts/mergetool-window.jpg" width="75%"> + <description> + merge editor window + </description> + </image> + </figure> </p> - </hint> - </exercise> - - <exercise - xml:id="ex-accept-current-change" - label="ex-accept-current-change"> + </statement> + </task> + <task xml:id="ex-launch-mergetool-vscode-a" label="ex-launch-mergetool-vscode-a" component="vscode-kit-client"> <statement> <p> - Click the option that will accept the changes in your feature branch. + Open the conflicted file, and click the "Resolve in Merge Editor" ( <xref ref="fig-vscode-launch-mergetool" />) button in the lower right corner of the editor pane. </p> <p> - Choose the description below that best describes What happens? + <figure xml:id="fig-vscode-launch-mergetool" > + <caption> Conflicting Upstream Changes. </caption> + <image source="images/ch-merge-conflicts/vscode-launch-mergetool.png" width="15%"> + <description> + VS Code's "Resolve in Merge Editor" button + </description> + </image> + </figure> </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Only the changes from the feature branch remain. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Only the changes from the <c>main</c> branch remain. - </p> - </statement> - <feedback> - <p> - Check the editor contents after you click "Accept Current Change". - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The changes from the <c>main</c> branch and the chevrons remain. - </p> - </statement> - <feedback> - <p> - Check the editor contents after you click "Accept Current Change". - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The changes from the feature branch and the chevrons remain. - </p> - </statement> - <feedback> - <p> - Check the editor contents after you click "Accept Current Change". - </p> - </feedback> - </choice> - </choices> - <hint> <p> - Click "Accept Current Change" and check the editor contents. + When VS Code's Merge Editor is first opened, it will open a window containing three panes (<c>LOCAL</c>, <c>REMOTE</c> and Result). The content that you see will be different, but the window that you see should be similar to the one shown in <xref ref="fig-merge-editor-window-vscode" />. </p> - </hint> - </exercise> - </exercises> - - <conclusion> - <p> - If you would like to try out the other merge options you can undo your changes by opening the Hamburger menu (☰), clicking on "Edit" and choosing "Undo". - </p> - <p> - This basic merge tool is helpful for resolving small uncomplicated merge conflicts. Most development environments also provide more advanced merge tools for working with more complex conflicts. The use of those tools is beyond the goals of this chapter. - </p> - </conclusion> - </subsection> - - <subsection - xml:id="topic-committing-merged-changes" - label="topic-committing-merged-changes"> - <title>Committing the Merged Changes - - - <introduction> - <p> - At this point you have resolved the merge conflict, but the resulting changes have not been committed to your feature branch. In this section you will commit those changes to your feature branch. - </p> - </introduction> - <exercise - xml:id="ex-merged-git-status" - label="ex-merged-git-status"> - <introduction> <p> - Run the <c>git status</c> command in the terminal and use its output to answer the following questions. + <figure xml:id="fig-merge-editor-window-vscode" > + <caption> Merge Editor Window (example) </caption> + <image source="images/ch-merge-conflicts/mergetool-window.jpg" width="75%"> + <description> + merge editor window + </description> + </image> + </figure> </p> - </introduction> - <task - xml:id="ex-merged-status-unmerged-paths" - label="ex-merged-status-unmerged-paths"> - <statement> - <p> - Which of the following appear in the output of the <c>git status</c> command and indicate that your merged changes have not yet been committed to your feature branch? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - You have unmerged paths. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - both modified: README.md - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - no changes added to commit - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - All conflicts fixed - </p> - </statement> - <feedback> - <p> - Check the output again. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Your branch is behind 'origin' - </p> - </statement> - <feedback> - <p> - Check the output again. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Run the <c>git status</c> command and read the output carefully. - </p> - </hint> - </task> - - <task - xml:id="ex-merged-status-abort" - label="ex-merged-status-abort"> - <statement> - <p> - Imagine that after you completed the merge you realize that you didn't merge the changes the way you had intended. Which Git command could you use to undo your merge? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>git merge --abort</c> - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git merge --undo</c> - </p> - </statement> - <feedback> - <p> - Close. Check the output again. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git undo merge</c> - </p> - </statement> - <feedback> - <p> - Check the output again. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git merge revert</c> - </p> - </statement> - <feedback> - <p> - Check the output again. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Run the <c>git status</c> command and read the output carefully. - </p> - </hint> - </task> - </exercise> - - <p> - Feel free to try out the <c>git merge --abort</c> command. After you run it, the raw merge conflict information will reappear in the <c>README.md</c> file. Be sure to re-merge the changes from your feature branch before moving on. - </p> - - <exercise - xml:id="ex-stage-and-merge-changes-cmds" - label="ex-stage-and-merge-changes-cmds"> + </statement> + </task> + <task xml:id="ex-launch-mergetool-b" label="ex-launch-mergetool-b"> <statement> <p> - From <xref ref="ex-merged-status-unmerged-paths" /> you can see that you now have uncommitted changes. Those changes are the changes you made when resolving the merge conflict. The next step is to commit your changes. + Changing a few of the default settings will make the use of the merge tool easier to understand by displaying the Best Common Ancestor and both non-conflicting and conflicting changes. </p> <p> - Choose and order the commands that you would use to commit your changes to your local repository. Note: Not all commands will be used. + Use the "…" menu in the upper right of the merge tool window and check the "" and "" options as shown in <xref ref="fig-merge-editor-window-settings" />. </p> - </statement> - <blocks randomize="yes"> - <block> - <p> - <cline>git stage README.md</cline> - </p> - </block> - <block> - <p> - <cline>git commit -m "<message>"</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git push origin <branch></cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git switch main</cline> - </p> - </block> - </blocks> - <hint> <p> - See <xref ref="topic-staging-changes" /> and <xref ref="topic-committing-to-your-local-repository" /> for a review. + <figure xml:id="fig-merge-editor-window-settings" > + <caption> Merge Editor Window settings selection</caption> + <image source="images/ch-merge-conflicts/mergetool-settings.png" width="25%"> + <description> + merge editor window settings selections + </description> + </image> + </figure> </p> - </hint> - </exercise> - - <exercise - xml:id="ex-stage-merged-changes" - label="ex-stage-merged-changes"> - <statement> <p> - Run the first command from <xref ref="ex-stage-and-merge-changes-cmds" /> in the terminal. Then run the <c>git status</c> command and examine its output. + With these options enabled, the merge tool window should now contain 4 panes (<c>LOCAL</c>, Base, <c>REMOTE</c> and Result) and look similar to the one shown in <xref ref="fig-merge-editor-window-new-settings" />. </p> <p> - What does <c>git status</c> tell you to do to conclude the merge? + <figure xml:id="fig-merge-editor-window-new-settings" > + <caption> Merge Editor Window (example) with new settings</caption> + <image source="images/ch-merge-conflicts/mergetool-window-new-settings.jpg" width="75%"> + <description> + merge editor window with new settings + </description> + </image> + </figure> </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - use "git commit" to conclude merge - </p> - </statement> - <feedback> - <p> - Correct. You already knew that, but its good to know that <c>git status</c> provides helpful tips. Use it often! - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - use "git pull" to conclude merge - </p> - </statement> - <feedback> - <p> - <c>git pull</c> performs a different function and will not conclude the merge. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - use "git push" to conclude merge - </p> - </statement> - <feedback> - <p> - <c>git push</c> performs a different function and will not conclude the merge. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - use "git restore" to conclude merge - </p> - </statement> - <feedback> - <p> - <c>git restore</c> performs a different function and will not conclude the merge. - </p> - </feedback> - </choice> - </choices> - <hint> + </task> + <task xml:id="ex-launch-mergetool-c" label="ex-launch-mergetool-c"> + <statement correct="yes"> <p> - Run the <c>git status</c> command and read the output carefully. + Do you have your merge tool window showing four panes and their content? </p> - </hint> - </exercise> - - <exercise - xml:id="ex-commit-merged-changes" - label="ex-commit-merged-changes"> + </statement> + <feedback> + <p> + Do not make changes until you have your merge tool set up. + </p> + </feedback> + </task> + <task xml:id="ex-launch-mergetool-d" label="ex-launch-mergetool-d"> <statement> <p> - Run the second command from <xref ref="ex-stage-and-merge-changes-cmds" /> in the terminal. Be sure to replace the <c><message></c> placeholder with a meaningful commit message. Then use <c>git status</c> and examine the output. + Using your answer to <xref ref="ex-launch-mergetool-c" />, compare the Result pane to the Best Common Ancestor. How are they different? Why? </p> + </statement> + <response /> + </task> + </exercise> + + <exercise xml:id="ex-resolving-merge-conflict" label="ex=resolving-merge-conflict"> + <statement> + <p> + When using the merge tool, you resolve conflicts by modifying the Result pane so that it appears as desired. You can use the point-and-click "Accept ..." and "Remove ..." options provided by the merge tool to move content into or out of the Result pane or you can edit the Result pane directly. + </p> + <p> + Use the merge tool to resolve the conflict so that the Result contains: + <ul> + <li> + your changes where there is a conflict. + </li> + <li> + all of the non-conflicting changes from the main branch. + </li> + </ul> + </p> + <p> + Copy your final merged result here. + </p> + </statement> + <response /> + </exercise> + + <exercise xml:id="ex-saving-merge-resolution" label="ex-saving-merge-resolution"> + <introduction> + <p> + Save your changes in the merge tool and close the merge tool window. + </p> + <p> + Then issue a <c>git status</c> command. + </p> + </introduction> + <task xml:id="ex-saving-merge-resolution-a" label="ex-saving-merge-resolution-a"> + <statement> <p> - What does <c>git status</c> tell you that indicates that your changes have been committed? + Copy the text for your command and its output. Be sure that your output shows the names of any files containing changes that need to be committed. </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - nothing to commit, working tree clean - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - merge complete - </p> - </statement> - <feedback> - <p> - True, but that's not the message that is displayed. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - changes successfully merged - </p> - </statement> - <feedback> - <p> - True, but that's not the message that is displayed - </p> - </feedback> - </choice> - </choices> - <hint> + <response /> + </task> + <task xml:id="ex-saving-merge-resolution-b" label="ex-saving-merge-resolution-b"> + <statement> <p> - Run the <c>git status</c> command and read the output carefully. + Briefly explain why the output you see in <xref ref="ex-saving-merge-resolution-a" /> makes sense based on what you have done. </p> - </hint> - </exercise> - - </exercises> - </subsection> + </statement> + <response /> + </task> + </exercise> + + <exercise xml:id="ex-committing-merge-resolution" label="ex=committing-merge-resolution"> + <statement> + <p> + From <xref ref="ex-saving-merge-resolution" /> you can see that you now have uncommitted changes. Those changes are all of the changes you made to the Result panel when performing the merge in the merge tool. + </p> + <p> + Commit the changes you made in resolving the conflict. Be sure to use a meaningful commit message. + </p> + <p> + Copy the commands that you used and their output. + </p> + </statement> + <response /> + </exercise> + + </exercises> </section> diff --git a/source/ch-merge-conflicts/sec-synchronizing-with-the-upstream-repository.ptx b/source/ch-merge-conflicts/sec-synchronizing-with-the-upstream-repository.ptx index ec1d0f1..fb7f41d 100644 --- a/source/ch-merge-conflicts/sec-synchronizing-with-the-upstream-repository.ptx +++ b/source/ch-merge-conflicts/sec-synchronizing-with-the-upstream-repository.ptx @@ -8,149 +8,183 @@ <introduction> <p> - From the previous section you know that there is a merge conflict between the upstream <c>main</c> branch and your feature branch. Before you can resolve this conflict you will need to get the changes from the upstream <c>main</c> branch into your local and origin <c>main</c> branches. + <xref ref="fig-conflicting-upstream-changes" /> shows the <c>main</c> branch has committed changes that conflict with what the local branch wants to commit. </p> <p> - The process you learned for synchronizing with the upstream in <xref ref="topic-staying-synchronized" /> (<xref ref="topic-pulling-the-upstream-main-branch" /> and <xref ref="topic-pushing-main-to-your-origin" />) will copy the changes in the upstream <c>main</c> branch into your local and origin <c>main</c> branches. This process is illustrated in <xref ref="fig-synching-upstream-changes-with-conflict" />. - </p> - - <p> - <figure xml:id="fig-synching-upstream-changes-with-conflict" > - <caption> Synchronizing with the upstream. </caption> - <image source="images/ch-merge-conflicts/synching-with-upstream-with-conflict.png" width="75%"> + <figure xml:id="fig-conflicting-upstream-changes" > + <caption> Conflicting Upstream Changes. </caption> + <image source="images/ch-merge-conflicts/conflicting-upstream-changes.png" width="75%"> <description> - Using <c>pull</c> and <c>push</c> to synchronize the local and origin <c>main</c> branches with the upstream <c>main</c> branch. + Cloud image of the changes merged into the upstream that conflict with a local branch </description> </image> </figure> </p> - <p> - The exercises in the remainder of this section will help you to synchronize your local and origin <c>main</c> branches with the upstream <c>main</c> branch. + In class we saw that the maintainers had merged some changes into the upstream <c>main</c> after you had created your feature branch. The changes that were merged were specifically designed to conflict with the changes required for each of the Round2 issues. Thus, the pull request that you made at the end of the previous activity will now contain conflicts that prevent it from being merged automatically. This situation is shown in <xref ref="fig-conflicting-upstream-changes" />, where the maintainers have merged the dark blue commit into the <c>main</c> branch. + </p> + <p> + The activities in the remainder of this section will have you confirm that you are out of synch with the upstream and that your pull request cannot be merged automatically. It will then have you synch the <c>main</c> branch in your local and origin repos with the upstream, so that you can resolve the merge conflict. </p> </introduction> + <p> + Like the last activity, you will be working within the KitClient for this activity. + </p> + <exercises> <title/> + + <exercise xml:id="ex-restarting-kitclient-for-synching-with-conflicts" label="ex-restarting-kitclient-for-synching-with-conflicts"> + <introduction> + <p> + Restart your KitClient based on the instructions in <xref ref="topic-restarting-dev-env" /> + </p> + </introduction> + </exercise> + + <exercise xml:id="ex-identifying-commits-that-conflict" label="ex-identifying-commits-that-conflict"> + <introduction> + <p> + Answer the following based on <xref ref="fig-conflicting-upstream-changes" />. + </p> + </introduction> - <exercise - xml:id="ex-restarting-kitclient-for-synching-with-conflicts" label="ex-restarting-kitclient-for-synching-with-conflicts"> + <task> <statement> <p> - To do the synchronization you'll need to have your development environment running. - </p> - <p> - Click here to <url href="https://codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1" visual="codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1">open your development environment</url>. - </p> - <p> - Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following: + Which of the commits (i.e. which colors) in <xref ref="fig-conflicting-upstream-changes" /> might contain merge conflicts after the dark blue commit was merged? </p> - - <image source="images/shared-images/DevEnv-Kitty-Ready.png" width="75%"> - <description> - The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message. - </description> - </image> </statement> - </exercise> - - <exercise - xml:id="ex-synch-main-local-upstream" - label="ex-synch-main-local-upstream"> + <choices> + <choice correct="yes"> + <statement> + <p> + Dark Blue + </p> + </statement> + </choice> - <task - xml:id="ex-synch-main-local-upstream-cmds" - label="ex-synch-main-local-upstream-cmds"> + <choice> <statement> <p> - Assuming your feature branch is currently the active branch, arrange the the commands below into the order they would be used to synchronize your <c>main</c> branches with the upstream <c>main</c> branch. Note: Not all commands will be used. + Lime Green </p> </statement> - <blocks randomize="yes"> - <block> - <p> - <cline>git switch main</cline> - </p> - </block> - <block> - <p> - <cline>git pull upstream main</cline> - </p> - </block> - <block> - <p> - <cline>git push origin main</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git pull origin main</cline> - </p> - </block> - <block correct="no"> - <p> - <cline>git push upstream main</cline> - </p> - </block> - </blocks> - <hint> + </choice> + + <choice correct="yes"> + <statement> <p> - Review <xref ref="topic-pulling-the-upstream-main-branch" /> and <xref ref="topic-pushing-main-to-your-origin" /> for how to synchronize with the upstream <c>main</c>. + Brown </p> - </hint> - </task> + </statement> + </choice> - <task - xml:id="ex-synch-main-local-upstream-do-it" - label="ex-synch-main-local-upstream-do-it"> + <choice> <statement> <p> - Run the commands that you identified in <xref ref="ex-synch-main-local-upstream-cmds" /> in the terminal. + Green </p> </statement> - </task> + </choice> + </choices> + + + <hint> + <p> + Look at which commits are new in upstream that are not part of the local repository's <c>main</c> or feature branch. + </p> + </hint> + </task> + </exercise> + + <exercise xml:id="ex-num-commits-behind-upstream" label="ex-num-commits-behind-upstream"> + <introduction> + <p> + Visit the main page for your <c>origin</c> repo on GitHub and make sure that the <c>main</c> branch is active. You should be able to tell from this page that there have been changes to the upstream <c>main</c> branch that you have not yet synched (i.e. you are behind). + </p> + <p> + How many commits behind the upstream are you? + </p> + </introduction> + <response /> + </exercise> + + <exercise xml:id="ex-no-automatic-merge-on-github" label="ex-no-automatic-merge-on-github"> + <introduction> + <p> + Now find your pull request in the <c>upstream</c> repo on GitHub. You should see that your pull request cannot be merged automatically. + <ul marker=""> + <li>If GitHub indicates that your pull request can be merged automatically follow the instructions in <xref ref="topic-appendix-a-merge-conflicts"/> at the end of this activity sheet and then return to this question when you have a pull request that cannot be merged automatically.</li> + <li>Do not continue unless your pull request on GitHub shows that it cannot be merged automatically.</li> + </ul> + </p> + </introduction> + <task xml:id="ex-no-automatic-merge-on-github-a" label="ex-no-automatic-merge-on-github-a"> + <statement correct="yes"> + <p> + Does your pull request on GitHub show that it cannot be merged automatically? + </p> + </statement> + <feedback> + <p> + If you don't have a merge conflict, you can't do the rest of the exercises in this section. + </p> + </feedback> + </task> + <task xml:id="ex-no-automatic-merge-on-github-b" label="ex-no-automatic-merge-on-github-b"> + <statement> + <p> + Briefly explain in a sentence or two of your own words, what happened that made your pull request go from being able to be merged automatically to now not being able to be merged automatically. + </p> + </statement> + <response /> + <hint> + <p> + Think <xref ref="fig-conflicting-upstream-changes"/>! + </p> + </hint> + </task> + </exercise> - <task - xml:id="ex-confirm-origin-synch" - label="ex-confirm-origin-synch"> + <exercise xml:id="ex-synch-main-local-upstream" label="ex-synch-main-local-upstream"> + <introduction> + <p> + Use what you learned in the prior chapter to synch the <c>main</c> branch of your local and <c>origin</c> repos with the upstream. Don't forget to switch to your <c>main</c> branch first! + </p> + </introduction> + <task xml:id="ex-synch-main-local-upstream-a" label="ex-synch-main-local-upstream-a"> <statement> <p> - Let's, confirm that your origin <c>main</c> branch is now synchronized with the upstream <c>main</c> branch. + What are the commands you used? </p> + </statement> + <response /> + </task> + <task xml:id="ex-synch-main-local-upstream-b" label="ex-synch-main-local-upstream-b"> + <statement> <p> - Visit your origin repository and ensure that the <c>main</c> branch is active. + Check that you are now synchronized: + <ul> + <li> + <p> + Check that the <c>main</c> branch on your origin repo on GitHub "is up to date…" (See <xref ref="ex-num-commits-behind-upstream"/>). + </p> + </li> + <li> + <p> + Use <c>git status</c> to check that the <c>main</c> branch in your local repo is up to date with your <c>origin</c>. + </p> + </li> + </ul> </p> <p> - Near the top of the page, you should see a message that is similar to one of the following. Select the message that is most similar to what you see. + If the <c>main</c> branch in your local or origin repos are not up to date, double check your synchronization commands in part <xref ref="ex-synch-main-local-upstream-a"/> and try again. </p> </statement> - <choices> - <choice correct="yes"> - <statement> - <p> - This branch is up to date with <the upstream>. - </p> - </statement> - <feedback> - <p> - Excellent. Just as it should be. Continue on to the next exercise. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - This branch xx commits behind <the upstream>. - </p> - </statement> - <feedback> - <p> - Uh Oh. It doesn't look like your synchronization worked. Try running the commands from <xref ref="ex-synch-main-local-upstream-cmds" /> again. - </p> - </feedback> - </choice> - </choices> </task> </exercise> + </exercises> </section> diff --git a/source/ch-merge-conflicts/sec-understanding-merge-conflicts.ptx b/source/ch-merge-conflicts/sec-understanding-merge-conflicts.ptx index 3e8acc1..1890d90 100644 --- a/source/ch-merge-conflicts/sec-understanding-merge-conflicts.ptx +++ b/source/ch-merge-conflicts/sec-understanding-merge-conflicts.ptx @@ -5,831 +5,378 @@ <introduction> <p> - The exercises in this section provide practice in identifying merge conflicts and resolving them. + The exercises in this section provide practice in identifying merge conflicts and their resolutions. </p> </introduction> - <subsection xml:id="topic-merge-example-1"> - <title>Merge Example 1 + + + + <p> + <xref ref="fig-merge-conflicts-1" /> shows the <c>main</c> branch in the right panel, the contributor's feature branch in the left panel, and the common ancestor in the middle. + </p> + <p> + <figure xml:id="fig-merge-conflicts-1"> + <caption> Example merge conflicts with Best Common Ancestor. </caption> + <image source="images/ch-merge-conflicts/merge-conflicts-1.png" width="75%"> + <description> + Three panels of code (feature branch, common ancestor, main branch) + </description> + </image> + </figure> + </p> + + + <exercise xml:id="ex-merge-conflicts-practice-1" label="ex-merge-conflicts-practice-1"> + <introduction> <p> - Consider <xref ref="fig-merge-conflicts-1" />. This figure shows a <term>feature branch</term> (in the left panel) that is to be merged into the current <c>main</c> branch (in the right panel). The center panel shows the <term>best common ancestor</term> from which both the feature branch and <c>main</c> branch have diverged. - </p> - <p> - The current <c>main</c> branch contains changes, merged by the maintainers, to fix several bugs that existed in the best common ancestor. The feature branch has been changed to use more descriptive variable names, but has not fixed the bugs. - </p> - <p> - <figure xml:id="fig-merge-conflicts-1"> - <caption> Example merge conflicts with Best Common Ancestor. </caption> - <image source="images/ch-merge-conflicts/merge-conflicts-1.png" width="100%"> - <description> - Three panels of code (feature branch, best common ancestor, main branch) - </description> - </image> - </figure> + Consider the merge shown in <xref ref="fig-merge-conflicts-1" />. As shown in the right-hand panel, the maintainers have merged commits into the <c>main</c> branch that fix several bugs that existed in the program. The left-hand panel shows a contributor's feature branch with has been changed to use more descriptive variable names but that has not fixed the bugs. The center panel shows the best common ancestor of the feature and <c>main</c> branches. </p> </introduction> - <exercises> - <title /> - - <exercise xml:id="ex-merge-conflict-1-computation" label="ex-merge-conflict-1-computation"> + <task xml:id="ex-merge-conflicts-practice-1-a" label="ex-merge-conflicts-practice-1-a"> <statement> <p> - Study the program shown in the <c>main</c> branch of <xref ref="fig-merge-conflicts-1" />. Then choose the statement below that best describes the computation the program is trying to perform. Note: The Feature Branch and the Best Common Ancestor both contain bugs. + Study the program in the <c>main</c> branch and then describe in a sentence the computation that the program is trying to perform. Note: The Feature Branch and the Best Common Ancestor both contain bugs. </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Find the average of a list of numbers. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Find the total of a list of numbers. - </p> - </statement> - <feedback> - <p> - Consider the last line in the <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Count how many numbers the user enters. - </p> - </statement> - <feedback> - <p> - What does the program do besides count the numbers? - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - None of these. - </p> - </statement> - <feedback> - <p> - One of the other answers is correct. - </p> - </feedback> - </choice> - </choices> - </exercise> + <response /> + </task> - <exercise xml:id="ex-conflict-type" label="ex-ex-conflict-type"> - <introduction> + <task xml:id="ex-merge-conflicts-practice-1-b" label="ex-merge-conflicts-practice-1-b"> + <statement> <p> - When both the feature branch being merged and the <c>main</c> branch that it is being merged into contain changes with respect to the best common ancestor, those changes can be <term>non-conflicting</term> or <term>conflicting</term>. + Highlight (by clicking, or by circling) all of the lines that are non-conflicting changes in the feature branch or the <c>main</c> branch. Use the example in the slides as a guide for highlighting. </p> - </introduction> - <task xml:id="ex-non-conflicting-change" label="ex-non-conflicting-change"> - <statement> - <p> - Select the statement below that best describes a <term>non-conflicting change</term>. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - A non-conflicting change occurs when a part of the code changes in the feature branch or in the <c>main</c> branch but not in both. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - A non-conflicting change occurs when a part of the code changes in both the feature branch and the <c>main</c> branch. - </p> - </statement> - <feedback> - <p> - Review the definitions of non-conflicting and conflicting changes in the class slides. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - A non-conflicting change occurs when the best common ancestor is modified. - </p> - </statement> - <feedback> - <p> - The best common ancestor cannot be changed, all changes are either in the feature branch or the <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - A non-conflicting change occurs when part of the feature branch contains only one change. - </p> - </statement> - <feedback> - <p> - You need to consider changes to both the feature branch and the <c>main</c> branch to determine if a change is non-conflicting. - </p> - </feedback> - </choice> - </choices> - </task> - - <task xml:id="ex-conflicting-change" label="ex-conflicting-change"> - <statement> - <p> - Select the statement below that best describes a <term>conflicting change</term>. - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - A conflicting change occurs when a part of the code changes in the feature branch or in the <c>main</c> branch but not in both. - </p> - </statement> - <feedback> - <p> - Review the definitions of non-conflicting and conflicting changes in the class slides. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - A non-conflicting change occurs when a part of the code changes in both the feature branch and the <c>main</c> branch. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - A conflicting change occurs when the best common ancestor is modified. - </p> - </statement> - <feedback> - <p> - The best common ancestor cannot be changed, all changes are either in the feature branch or the <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - A conflicting change occurs when a part of the feature branch contains multiple changes. - </p> - </statement> - <feedback> - <p> - You need to consider changes to both the feature branch and the <c>main</c> branch to determine if a change is conflicting. - </p> - </feedback> - </choice> - </choices> - </task> - </exercise> + </statement> + <areas> + <tabular top="minor" bottom="minor" left="minor" right="minor"> + <row header="yes"> + <cell>Feature Branch</cell> + <cell>Best Common Ancestor</cell> + <cell><c>main</c> Branch</cell> + </row> + <row bottom="none" > + <cell><area correct="yes">total=0</area></cell> + <cell>tot=0</cell> + <cell><area correct="no">tot=0</area></cell> + </row> + <row bottom="none" > + <cell><area correct="no">count=0</area></cell> + <cell>count=0</cell> + <cell><area correct="no">count=0</area></cell> + </row> + <row bottom="none" > + <cell><area correct="no">read n</area></cell> + <cell>read n</cell> + <cell><area correct="no">read n</area></cell> + </row> + <row bottom="none" > + <cell><area correct="no">while count > n:</area></cell> + <cell>while count > n:</cell> + <cell><area correct="yes">while count < n:</area></cell> + </row> + <row bottom="none" > + <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> + <cell><nbsp/><nbsp/><nbsp/>read m</cell> + <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> + </row> + <row bottom="none" > + <cell><nbsp/><nbsp/><nbsp/><area correct="yes">total=total+m</area></cell> + <cell><nbsp/><nbsp/><nbsp/>tot=tot+m</cell> + <cell><nbsp/><nbsp/><nbsp/><area correct="no">tot=tot+m</area></cell> + </row> + <row bottom="none" > + <cell><nbsp/><nbsp/><nbsp/><area correct="no">count--</area></cell> + <cell><nbsp/><nbsp/><nbsp/>count--</cell> + <cell><nbsp/><nbsp/><nbsp/><area correct="yes">count++</area></cell> + </row> + <row> + <cell><area correct="no">average=count <solidus/> total</area></cell> + <cell>ave=count <solidus/> tot</cell> + <cell><area correct="no">ave=tot <solidus/> count</area></cell> + </row> + </tabular> + </areas> + <hint> + <p> + Merge conflicts occur when both source branches change the same line. + </p> + </hint> + </task> - <exercise - xml:id="ex-merge-conflict-1" - label="ex-merge-conflict-1"> - <introduction> + + <task xml:id="ex-merge-conflicts-practice-1-c" label="ex-merge-conflicts-practice-1-c"> + <statement> <p> - The questions below will now ask you to identify the non-conflicting and conflicting changes that exist in the merge from <xref ref="fig-merge-conflicts-1" />. + Highlight (by clicking, or by circling) all of the lines that are conflicting changes in the feature branch and the <c>main</c> branch as shown in <xref ref="fig-merge-conflicts-1" />. Use the example in the slides as a guide for highlighting. </p> - </introduction> - <task xml:id="ex-merge-conflict-1-non-conflicting" label="ex-merge-conflict-1-non-conflicting"> - <statement> - <p> - Highlight (by clicking) all of the lines in the <c>main</c> branch and the feature branch that contain non-conflicting changes. Use the example in the course slides as a guide. - </p> - <p></p> - </statement> - <areas> - <tabular top="minor" bottom="minor" left="minor" right="minor"> - <row header="yes"> - <cell>Feature Branch</cell> - <cell>Best Common Ancestor</cell> - <cell><c>main</c> Branch</cell> - </row> - <row bottom="none" > - <cell><area correct="yes">total=0</area></cell> - <cell>tot=0</cell> - <cell><area correct="no">tot=0</area></cell> - </row> - <row bottom="none" > - <cell><area correct="no">count=0</area></cell> - <cell>count=0</cell> - <cell><area correct="no">count=0</area></cell> - </row> - <row bottom="none" > - <cell><area correct="no">read n</area></cell> - <cell>read n</cell> - <cell><area correct="no">read n</area></cell> - </row> - <row bottom="none" > - <cell><area correct="no">while count > n:</area></cell> - <cell>while count > n:</cell> - <cell><area correct="yes">while count < n:</area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> - <cell><nbsp/><nbsp/><nbsp/>read m</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="yes">total=total+m</area></cell> - <cell><nbsp/><nbsp/><nbsp/>tot=tot+m</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="no">tot=tot+m</area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="no">count--</area></cell> - <cell><nbsp/><nbsp/><nbsp/>count--</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="yes">count++</area></cell> - </row> - <row> - <cell><area correct="no">average=count <solidus/> total</area></cell> - <cell>ave=count <solidus/> tot</cell> - <cell><area correct="no">ave=tot <solidus/> count</area></cell> - </row> - </tabular> - </areas> - <hint> - <p> - Non-conflicting changes occur when a part of the code changes in either the feature branch or the <c>main</c> but not both. - </p> - </hint> - </task> + </statement> + <areas> + <tabular top="minor" bottom="minor" left="minor" right="minor"> + <row header="yes"> + <cell>Feature Branch</cell> + <cell>Best Common Ancestor</cell> + <cell><c>main</c> Branch</cell> + </row> + <row bottom="none" > + <cell><area correct="no">total=0</area></cell> + <cell>tot=0</cell> + <cell><area correct="no">tot=0</area></cell> + </row> + <row bottom="none" > + <cell><area correct="no">count=0</area></cell> + <cell>count=0</cell> + <cell><area correct="no">count=0</area></cell> + </row> + <row bottom="none" > + <cell><area correct="no">read n</area></cell> + <cell>read n</cell> + <cell><area correct="no">read n</area></cell> + </row> + <row bottom="none" > + <cell><area correct="no">while count > n:</area></cell> + <cell>while count > n:</cell> + <cell><area correct="no">while count < n:</area></cell> + </row> + <row bottom="none" > + <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> + <cell><nbsp/><nbsp/><nbsp/>read m</cell> + <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> + </row> + <row bottom="none" > + <cell><nbsp/><nbsp/><nbsp/><area correct="no">total=total+m</area></cell> + <cell><nbsp/><nbsp/><nbsp/>tot=tot+m</cell> + <cell><nbsp/><nbsp/><nbsp/><area correct="no">tot=tot+m</area></cell> + </row> + <row bottom="none" > + <cell><nbsp/><nbsp/><nbsp/><area correct="no">count--</area></cell> + <cell><nbsp/><nbsp/><nbsp/>count--</cell> + <cell><nbsp/><nbsp/><nbsp/><area correct="no">count++</area></cell> + </row> + <row> + <cell><area correct="yes">average=count <solidus/> total</area></cell> + <cell>ave=count <solidus/> tot</cell> + <cell><area correct="yes">ave=tot <solidus/> count</area></cell> + </row> + </tabular> + </areas> + <hint> + <p> + Merge conflicts occur when both source branches change the same line. + </p> + </hint> + </task> - <task xml:id="ex-merge-conflict-1-conflicting" label="ex-merge-conflict-1-conflicting"> - <statement> - <p> - Highlight by clicking all of the lines in the <c>main</c> and feature branches that contain conflicting changes. Use the example in the course slides as a guide. - </p> - <p></p> - </statement> - <areas> - <tabular top="minor" bottom="minor" left="minor" right="minor"> - <row header="yes"> - <cell>Feature Branch</cell> - <cell>Best Common Ancestor</cell> - <cell><c>main</c> Branch</cell> - </row> - <row bottom="none" > - <cell><area correct="no">total=0</area></cell> - <cell>tot=0</cell> - <cell><area correct="no">tot=0</area></cell> - </row> - <row bottom="none" > - <cell><area correct="no">count=0</area></cell> - <cell>count=0</cell> - <cell><area correct="no">count=0</area></cell> - </row> - <row bottom="none" > - <cell><area correct="no">read n</area></cell> - <cell>read n</cell> - <cell><area correct="no">read n</area></cell> - </row> - <row bottom="none" > - <cell><area correct="no">while count > n:</area></cell> - <cell>while count > n:</cell> - <cell><area correct="no">while count < n:</area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> - <cell><nbsp/><nbsp/><nbsp/>read m</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="no">read m</area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="no">total=total+m</area></cell> - <cell><nbsp/><nbsp/><nbsp/>tot=tot+m</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="no">tot=tot+m</area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="no">count--</area></cell> - <cell><nbsp/><nbsp/><nbsp/>count--</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="no">count++</area></cell> - </row> - <row> - <cell><area correct="yes">average=count <solidus/> total</area></cell> - <cell>ave=count <solidus/> tot</cell> - <cell><area correct="yes">ave=tot <solidus/> count</area></cell> - </row> - </tabular> - </areas> - <hint> - <p> - Conflicting changes occur when the same part of the code is changed both the feature branch and the <c>main</c> branch. - </p> - </hint> - </task> - </exercise> + <task xml:id="ex-merge-conflicts-practice-1-d" label="ex-merge-conflicts-practice-1-d"> + <statement> + <p> + Would the feature branch in <xref ref="fig-merge-conflicts-1" /> be able to be merged automatically by the project maintainers? Briefly explain your answer. + </p> + </statement> + <response /> + </task> - <exercise - xml:id="ex-merge-conflict-1-can-merge" - label="ex-merge-conflict-1-can-merge"> - <statement> - <p> - Select the statement below that best describes why the feature branch in <xref ref="fig-merge-conflicts-1" /> would, or would not, be able to be merged automatically by the project maintainers. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The feature branch cannot be merged automatically because there is a conflicting change. - </p> - </statement> - <feedback> - <p> - Correct. The last line contains changes in both <c>main</c> and the feature branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The feature branch can be merged automatically because there all of the changes are non-conflicting. - </p> - </statement> - <feedback> - <p> - Are you sure there are no conflicting changes? - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The feature branch cannot be merged automatically because there are non-conflicting changes. - </p> - </statement> - <feedback> - <p> - Non-conflicting changes can (usually) be merged automatically. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - It is not possible to tell if the feature branch can be merged automatically. - </p> - </statement> - <feedback> - <p> - If there are conflicting changes then the feature branch will not be able to be merged automatically. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The feature branch cannot be merged automatically because there are changes both in <c>main</c> and in the feature branch. - </p> - </statement> - <feedback> - <p> - Close. What type of changes prevent automatic merges? - </p> - </feedback> - </choice> - </choices> - </exercise> + <task xml:id="ex-merge-conflicts-practice-1-e" label="ex-merge-conflicts-practice-1-e"> + <statement> + <p> + Highlight the correct lines that give a Merged Result of the program in <xref ref="fig-merge-conflicts-1" /> that combines the feature branch and the <c>main</c> branch such that the result both performs the desired computation and uses the more descriptive variable names. + </p> + </statement> + <areas language="python"> + <cline><area correct="yes">total=0</area></cline> + <cline><area correct="no">tot=0</area></cline> + <cline><area correct="yes">count=0</area></cline> + <cline><area correct="yes">read n</area></cline> + <cline><area correct="no">while count > n:</area></cline> + <cline><area correct="yes">while count < n:</area></cline> + <cline><area correct="yes">read m</area></cline> + <cline><area correct="yes">total=total+m</area></cline> + <cline><area correct="no">tot=tot+m</area></cline> + <cline><area correct="no">count--</area></cline> + <cline><area correct="yes">count++</area></cline> + <cline><area correct="no">average=count/total</area></cline> + <cline><area correct="no">ave=tot/count</area></cline> + <cline><area correct="yes">average=total/count</area></cline> + </areas> + </task> + + </exercise> - <exercise - xml:id="ex-do-merge-1" - label="ex-do-merge-1"> - <statement> - <p> - Use the table below to indicate how the feature branch would be merged into the <c>main</c> branch. Each line that contains a change is shown in boldface. Click the change the feature branch or the <c>main</c> branch to indicate the version of the line that will appear in the merged result. The merged result should include all non-conflicting changes and should resolve the conflicting change. The resulting program must perform the desired computation as identified in <xref ref="ex-merge-conflict-1-computation" /> - </p> - <p></p> - </statement> - <areas> - <tabular top="minor" bottom="minor" left="minor" right="minor"> - <row header="yes"> - <cell>Feature Branch</cell> - <cell>Best Common Ancestor</cell> - <cell><c>main</c> Branch</cell> - </row> - <row bottom="none" > - <cell><area correct="yes"><term>total=0</term></area></cell> - <cell>tot=0</cell> - <cell><area correct="no"><term>tot=0</term></area></cell> - </row> - <row bottom="none" > - <cell>count=0</cell> - <cell>count=0</cell> - <cell>count=0</cell> - </row> - <row bottom="none" > - <cell>read n</cell> - <cell>read n</cell> - <cell>read n</cell> - </row> - <row bottom="none" > - <cell><area correct="no"><term>while count > n:</term></area></cell> - <cell>while count > n:</cell> - <cell><area correct="yes"><term>while count < n:</term></area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/>read m</cell> - <cell><nbsp/><nbsp/><nbsp/>read m</cell> - <cell><nbsp/><nbsp/><nbsp/>read m</cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="yes"><term>total=total+m</term></area></cell> - <cell><nbsp/><nbsp/><nbsp/>tot=tot+m</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="no"><term>tot=tot+m</term></area></cell> - </row> - <row bottom="none" > - <cell><nbsp/><nbsp/><nbsp/><area correct="no"><term>count--</term></area></cell> - <cell><nbsp/><nbsp/><nbsp/>count--</cell> - <cell><nbsp/><nbsp/><nbsp/><area correct="yes"><term>count++</term></area></cell> - </row> - <row> - <cell><area correct="yes"><term>average=count <solidus/> total</term></area></cell> - <cell>ave=count <solidus/> tot</cell> - <cell><area correct="no"><term>ave=tot <solidus/> count</term></area></cell> - </row> - </tabular> - </areas> - <hint> - <p> - Select all of the non-conflicting changes and choose the conflicting change that ensures that the program will work correctly. - </p> - </hint> - </exercise> - </exercises> - </subsection> + <p> + <xref ref="fig-merge-conflicts-2" /> shows the <c>main</c> branch in the right panel, the contributor's feature branch in the left panel, and the common ancestor in the middle. + </p> + <p> + <figure xml:id="fig-merge-conflicts-2" > + <caption> Example merge conflicts with Best Common Ancestor. </caption> + <image source="images/ch-merge-conflicts/merge-conflicts-2.png" width="75%"> + <description> + Three panels of code (feature branch, common ancestor, main branch) + </description> + </image> + </figure> + </p> - <subsection xml:id="topic-merge-example-2"> - <title>Merge Example 2 +

    - shows another example of a contributor's feature branch that is to be merged into the main branch. -

    -

    - As in the previous example, the right-hand panel shows commits that the maintainers have merged into the main branch to fix a bug that existed in the program. The left-hand panel shows the contributor's feature branch with changes that also fix the bug, but in a different way. The center panel shows the best common ancestor of the feature and main branches. -

    -

    -

    - Example merge conflicts with Best Common Ancestor. - - - Three panels of code (feature branch, best common ancestor, main branch) - - -
    + Now consider the merge shown in . As shown in the right-hand panel, the maintainers have merged commits into the main branch that fix several bugs that existed in the program. The left-hand panel shows a contributor's feature branch with has been changed to use more descriptive variable names but that has not fixed the bugs. The center panel shows the best common ancestor of the feature and main branches.

    + + +

    + Study the program in the main branch and then describe in a sentence the computation that the program is trying to perform. Note: The ** indicates exponentiation (e.g. x**2 is x squared). Note: The Common Ancestor contains a bug that is fixed in different ways by the main branch and the feature branch. +

    +
    + +
    - - - - <exercise - xml:id="ex-merge-conflict-2-computation" label="ex-merge-conflict-2-computation"> - <statement> - <p> - Study the program in <xref ref="fig-merge-conflicts-2" />. Then choose the statement below that best describes the computation the program is trying to perform. gNote: The <c>**</c> operator indicates exponentiation, so <c>x**2</c> computes x squared. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Compute the area of a circle. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Find the circumference of a circle. - </p> - </statement> - <feedback> - <p> - Close. Notice the use of <c>**</c> to square the radius <c>r</c>. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Compute the volume of a sphere. - </p> - </statement> - <feedback> - <p> - Close, but that formula would use <c>r**3</c>. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - None of these. - </p> - </statement> - <feedback> - <p> - One of the other answers is correct. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - The <c>main</c> branch fixes the bug in a strange way. So focusing on the feature branch may be easier. - </p> - </hint> - </exercise> + <task xml:id="ex-merge-conflicts-practice-2-b" label="ex-merge-conflicts-practice-2-b"> + <statement> + <p> + Highlight (by clicking, or by circling) all of the lines that are non-conflicting changes in the feature branch or the <c>main</c> branch as shown in <xref ref="fig-merge-conflicts-1" />. Use the example in the slides as a guide for highlighting. + </p> + </statement> + <areas> + <tabular top="minor" bottom="minor" left="minor" right="minor"> + <row header="yes"> + <cell>Feature Branch</cell> + <cell>Best Common Ancestor</cell> + <cell><c>main</c> Branch</cell> + </row> + <row bottom="none"> + <cell><area correct="no">r=15</area></cell> + <cell>r=15</cell> + <cell><area correct="no">r=15</area></cell> + </row> + <row bottom="none"> + <cell><area correct="yes">pi = 3.1415927</area></cell> + <cell>pi = 3.14</cell> + <cell><area correct="no">pi = 3.14</area></cell> + </row> + <row bottom="none"> + <cell><area correct="yes">rsq = r**2</area></cell> + <cell>rsq = r*2</cell> + <cell><area correct="no">rsq = r*2</area></cell> + </row> + <row bottom="none"> + <cell><area correct="no">a = pi*rsq</area></cell> + <cell>a = pi*rsq</cell> + <cell><area correct="yes">area = pi*(rsq/2)**2</area></cell> + </row> + <row> + <cell><area correct="no">print a</area></cell> + <cell>print a</cell> + <cell><area correct="yes">print area</area></cell> + </row> + </tabular> + </areas> + <hint> + <p> + Merge conflicts occur when the feature, <c>main</c>, and common ancestor branches are all different. + </p> + </hint> + </task> - <exercise - xml:id="ex-merge-conflict-2" - label="ex-merge-conflict-2"> - <introduction> - <p> - The questions below will now ask you to identify the non-conflicting and conflicting changes that exist in the merge from <xref ref="fig-merge-conflicts-2" />. - </p> - </introduction> + <task xml:id="ex-merge-conflicts-practice-2-c" label="ex-merge-conflicts-practice-2-c"> + <statement> + <p> + Highlight (by clicking, or by circling) all of the lines that are conflicting changes in the feature branch and the <c>main</c> branch as shown in <xref ref="fig-merge-conflicts-1" />. Use the example in the slides as a guide for highlighting. + </p> + </statement> + <areas> + <tabular top="minor" bottom="minor" left="minor" right="minor"> + <row header="yes"> + <cell>Feature Branch</cell> + <cell>Best Common Ancestor</cell> + <cell><c>main</c> Branch</cell> + </row> + <row bottom="none"> + <cell><area correct="no">r=15</area></cell> + <cell>r=15</cell> + <cell><area correct="no">r=15</area></cell> + </row> + <row bottom="none"> + <cell><area correct="no">pi = 3.1415927</area></cell> + <cell>pi = 3.14</cell> + <cell><area correct="no">pi = 3.14</area></cell> + </row> + <row bottom="none"> + <cell><area correct="no">rsq = r**2</area></cell> + <cell>rsq = r*2</cell> + <cell><area correct="no">rsq = r*2</area></cell> + </row> + <row bottom="none"> + <cell><area correct="no">a = pi*rsq</area></cell> + <cell>a = pi*rsq</cell> + <cell><area correct="no">area = pi*(rsq/2)**2</area></cell> + </row> + <row> + <cell><area correct="no">print a</area></cell> + <cell>print a</cell> + <cell><area correct="no">print area</area></cell> + </row> + </tabular> + </areas> + <hint> + <p> + Merge conflicts occur when the feature, <c>main</c>, and common ancestor branches are all different. + </p> + </hint> + </task> - <task - xml:id="ex-merge-conflict-2-non-conflicting" label="ex-merge-conflict-2-non-conflicting"> - <statement> - <p> - Highlight (by clicking) all of the lines in the <c>main</c> branch and the feature branch that contain non-conflicting changes. - </p> - <p></p> - </statement> - <areas> - <tabular top="minor" bottom="minor" left="minor" right="minor"> - <row header="yes"> - <cell>Feature Branch</cell> - <cell>Best Common Ancestor</cell> - <cell><c>main</c> Branch</cell> - </row> - <row bottom="none"> - <cell><area correct="no">r=15</area></cell> - <cell>r=15</cell> - <cell><area correct="no">r=15</area></cell> - </row> - <row bottom="none"> - <cell><area correct="yes">pi = 3.1415927</area></cell> - <cell>pi = 3.14</cell> - <cell><area correct="no">pi = 3.14</area></cell> - </row> - <row bottom="none"> - <cell><area correct="yes">rsq = r**2</area></cell> - <cell>rsq = r*2</cell> - <cell><area correct="no">rsq = r*2</area></cell> - </row> - <row bottom="none"> - <cell><area correct="no">a = pi*rsq</area></cell> - <cell>a = pi*rsq</cell> - <cell><area correct="yes">area = pi*(rsq/2)**2</area></cell> - </row> - <row> - <cell><area correct="no">print a</area></cell> - <cell>print a</cell> - <cell><area correct="yes">print area</area></cell> - </row> - </tabular> - </areas> - <hint> - <p> - Non-conflicting changes occur when a part of the code changes in either the feature branch or the <c>main</c> but not both. - </p> - </hint> - </task> + <task xml:id="ex-merge-conflicts-practice-2-d" label="ex-merge-conflicts-practice-2-d"> + <statement> + <p> + Would the feature branch in <xref ref="fig-merge-conflicts-2" /> be able to be merged automatically by the project maintainers? Briefly explain your answer. + </p> + </statement> + <response /> + </task> - <task - xml:id="ex-merge-conflict2-conflicting" label="ex-merge-conflict2-conflicting"> - <statement> - <p> - Highlight (by clicking) all of the lines (if any) in the <c>main</c> branch and the feature branch that contain conflicting changes. - </p> - <p></p> - </statement> - <areas> - <tabular top="minor" bottom="minor" left="minor" right="minor"> - <row header="yes"> - <cell>Feature Branch</cell> - <cell>Best Common Ancestor</cell> - <cell><c>main</c> Branch</cell> - </row> - <row bottom="none"> - <cell><area correct="no">r=15</area></cell> - <cell>r=15</cell> - <cell><area correct="no">r=15</area></cell> - </row> - <row bottom="none"> - <cell><area correct="no">pi = 3.1415927</area></cell> - <cell>pi = 3.14</cell> - <cell><area correct="no">pi = 3.14</area></cell> - </row> - <row bottom="none"> - <cell><area correct="no">rsq = r**2</area></cell> - <cell>rsq = r*2</cell> - <cell><area correct="no">rsq = r*2</area></cell> - </row> - <row bottom="none"> - <cell><area correct="no">a = pi*rsq</area></cell> - <cell>a = pi*rsq</cell> - <cell><area correct="no">area = pi*(rsq/2)**2</area></cell> - </row> - <row> - <cell><area correct="no">print a</area></cell> - <cell>print a</cell> - <cell><area correct="no">print area</area></cell> - </row> - </tabular> - </areas> - <hint> - <p> - Conflicting changes occur when the same part of the code is changed both the feature branch and the <c>main</c> branch. - </p> - </hint> - </task> - </exercise> + <task xml:id="ex-merge-conflicts-practice-2-e" label="ex-merge-conflicts-practice-2-e"> + <statement> + <p> + Give the Merged Result to show the result of an automatic merge of the feature and <c>main</c> branches shown in <xref ref="fig-merge-conflicts-2" />. + </p> + </statement> + <areas language="python"> + <cline><area correct="yes">r = 15</area></cline> + <cline><area correct="yes">pi = 3.1415927</area></cline> + <cline><area correct="no">pi = 3.14</area></cline> + <cline><area correct="yes">rsq = r**2</area></cline> + <cline><area correct="no">rsq = r*2</area></cline> + <cline><area correct="no">a = pi*rsq</area></cline> + <cline><area correct="no">area = p*rsq</area></cline> + <cline><area correct="yes">area = pi*(rqs/2)**2</area></cline> + <cline><area correct="no">print a</area></cline> + <cline><area correct="yes">print area</area></cline> + <cline><area correct="no">print rsq</area></cline> + </areas> + </task> - <exercise - xml:id="ex-merge-conflict-2-can-merge" label="ex-merge-conflict-2-can-merge"> - <statement> - <p> - Select the statement below that best describes why the feature branch in <xref ref="fig-merge-conflicts-2" /> would, or would not, be able to be merged automatically by the project maintainers. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The feature branch can be merged automatically because there all of the changes are non-conflicting. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The feature branch cannot be merged automatically because there is a conflicting change. - </p> - </statement> - <feedback> - <p> - Are there any conflicting changes? - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The feature branch cannot be merged automatically because there are non-conflicting changes. - </p> - </statement> - <feedback> - <p> - Non-conflicting changes can (usually) be merged automatically. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - It is not possible to tell if the feature branch can be merged automatically. - </p> - </statement> - <feedback> - <p> - If there are conflicting changes then the feature branch will not be able to be merged automatically. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The feature branch cannot be merged automatically because there are changes both in <c>main</c> and in the feature branch. - </p> - </statement> - <feedback> - <p> - What type of changes prevent automatic merges? - </p> - </feedback> - </choice> - </choices> - </exercise> + <task xml:id="ex-merge-conflicts-practice-2-f" label="ex-merge-conflicts-practice-2-f"> + <statement> + <p> + Look carefully at your result in <xref ref="ex-merge-conflicts-practice-2-e" />. Will the resulting program perform the computation correctly? Briefly explain why or why not. + </p> + </statement> + <response /> + </task> - <exercise - xml:id="ex-merge-conflict-2-bad-auto" label="ex-merge-conflict-2-bad-auto"> - <statement> - <p> - Imagine that the non-conflicting changes you identified in <xref ref="ex-merge-conflict-2-non-conflicting" /> are automatically merged. Select the statement below that best describes the result. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The merged program will not work correctly because the formula for the area will be incorrect. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The merged program will work correctly because automatic merge's are guaranteed to produce a correct program. - </p> - </statement> - <feedback> - <p> - Look closely at the lines that define <c>rsq</c> and <c>area</c>. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The merged program will not work correctly because an incorrect value of pi will be used. - </p> - </statement> - <feedback> - <p> - 3.1415927 is a valid approximation of pi. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The merged program will work correctly because <c>rsq</c> is will be correctly computed as <c>r</c> squared instead of <c>r*2</c>. - </p> - </statement> - <feedback> - <p> - Look closely at how the <c>area</c> will be computed. - </p> - </feedback> - </choice> - </choices> - </exercise> + <task xml:id="ex-merge-conflicts-practice-2-g" label="ex-merge-conflicts-practice-2-g"> + <statement> + <p> + When a merge can be completed automatically, does it guarantee that the Merged Result will be correct?. + </p> + </statement> + <response /> + </task> + + </exercise> + </exercises> - <exercise - xml:id="ex-merge-conflicts-auto-always-ok" - abel="ex-merge-conflicts-auto-always-ok"> - <statement correct="no"> - <p> - When both the feature branch and the <c>main</c> branch function correctly, and the merge contains no conflicting changes then the result of an automatic merge will also be correct. - </p> - </statement> - <feedback> - </feedback> - <hint> - <p> - Consider what happened with <xref ref="ex-merge-conflict-2-non-conflicting" /> where there were no conflicting changes. - </p> - </hint> - </exercise> - </exercises> - </subsection> + </section> \ No newline at end of file diff --git a/source/ch-merge-conflicts/sec-updating-your-pull-request.ptx b/source/ch-merge-conflicts/sec-updating-your-pull-request.ptx index b33acdc..47bca8a 100644 --- a/source/ch-merge-conflicts/sec-updating-your-pull-request.ptx +++ b/source/ch-merge-conflicts/sec-updating-your-pull-request.ptx @@ -8,252 +8,44 @@ <introduction> <p> - At this point you have resolved the merge conflict and committed the changes to the feature branch in your local repository. What is left is to push that branch to your <c>origin</c>. When you do so, GitHub will automatically update your pull request to the <c>upstream</c> for that branch. + At this point you have resolved the merge conflict on the feature branch in your local repository. What is left is to push that branch to your <c>origin</c>. When you do so, GitHub will automatically update your pull request to the <c>upstream</c> for that branch. </p> </introduction> <exercises> <title /> - - <exercise - xml:id="ex-push-merge-resolution-cmd" - label="ex-push-merge-resolution-cmd"> + <exercise xml:id="ex-push-merge-resolution" label="ex-push-merge-resolution"> <statement> <p> - Give the command that will push your modified feature branch to your <c>origin</c>. - </p> - <p> - <var width="55" /> + Push your modified feature branch to your <c>origin</c>. Give the command you used and its output here. </p> </statement> - <setup> - <var> - <condition string="^git push origin (?!(main)).+$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> - <condition string="^git push upstream .+$"> - <feedback> - <p> - It looks like you are trying to push to the upstream. Try pushing to your origin instead. - </p> - </feedback> - </condition> - <condition string="^git push origin main$"> - <feedback> - <p> - It looks like you are pushing the <c>main</c> branch. Try pushing your feature branch. - </p> - </feedback> - </condition> - <condition string="^git .*"> - <feedback> - <p> - Review the <c>git push</c> command in <xref ref="topic-pushing-a-branch-to-your-origin" />. - </p> - </feedback> - </condition> - </var> - </setup> - <hint> - <p> - <xref ref="topic-pushing-a-branch-to-your-origin" /> introduced the command for pushing a feature branch to your origin. - </p> - </hint> + <response /> </exercise> - <exercise - xml:id="ex-push-merge-resolution" - label="ex-push-merge-resolution"> - <introduction> + <exercise xml:id="ex-pull-request-upstream" label="ex-pull-resquest-upstream"> + <statement> + <p> + Now visit the upstream repo and find your pull request. You should see that it can now be merged automatically. + </p> <p> - + If your PR cannot be merged automatically you have not correctly resolved the merge conflict; return to <xref ref="ex-name-source-target-branches" /> and try again. </p> - </introduction> - <task> - <statement> - <p> - Use your command from <xref ref="ex-push-merge-resolution-cmd" /> to push your feature branch to your origin. - </p> - </statement> - </task> - <task> - <statement> - <p> - Which of the following pieces of information appear in the terminal output from your command? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The URL of your origin repository. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - The name of the feature branch that you pushed. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - A bunch of information about "objects". - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The name of the file that was changed. - </p> - </statement> - <feedback> - <p> - Double check the output. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The URL of the upstream repository. - </p> - </statement> - <feedback> - <p> - Are you sure it's not your origin repository? - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - None of these. - </p> - </statement> - <feedback> - <p> - Double check the command you used to push your feature branch. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look closely at the output from your command in the terminal. - </p> - </hint> - </task> + <p> + !!Give a screenshot from your pull request showing that it can now be merged automatically. + </p> + </statement> + <response /> </exercise> - - <exercise - xml:id="ex-pull-request-upstream" - label="ex-pull-request-upstream"> - <introduction> + <exercise xml:id="ex-pull-request-url" label="ex-pull-request-url"> + <statement> <p> - Now that you've resolved the merge conflict and pushed the result to GitHub, it should be possible for the maintainers to automatically merge your pull request. Let's check! + Give the URL of your pull request. </p> - </introduction> - <task> - <statement> - <p> - Visit the <c>upstream</c> repo on GitHub, click on the "Pull requests" tab. - </p> - </statement> - </task> - <task> - <statement> - <p> - Find and click on your Round2 pull request. - </p> - </statement> - </task> - <task> - <statement> - <p> - Scroll down toward the bottom of the pull request. - </p> - </statement> - </task> - <task> - <statement> - <p> - Which of the following messages do you see? - </p> - </statement> - <choices> - <choice correct="yes"> - <statement> - <image source="images/ch-merge-conflicts/github-pr-no-conflict.png" width="90%"> - <description> - <p> - GitHub message indicating that merging can be performed automatically. - </p> - </description> - </image> - </statement> - <feedback> - <p> - Congratulations! You successfully resolved the merge conflict! Please continue to the next exercise. - </p> - </feedback> - </choice> - <choice> - <statement> - <image source="images/ch-merge-conflicts/github-pr-conflict.png" width="90%"> - <description> - <p> - GitHub message indicating that there are merge conflicts that must be resolved. - </p> - </description> - </image> - </statement> - <feedback> - <p> - Uh oh! Something didn't work. Let's try to fix it. - <ol marker="1"> - <li>Run the command <c>git revert --hard HEAD~1</c></li> - <li>Go back to <xref ref="topic-git-merge-command" />, merge <c>main</c> into your feature branch and try again to resolve the conflict.</li> - </ol> - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - I don't see either of the other messages. - </p> - </statement> - <feedback> - <p> - If you see a message about GitHub checking if the merge can be performed automatically, wait a few moments for one of the other messages to appear. - </p> - </feedback> - </choice> - </choices> - </task> + </statement> + <response /> </exercise> + </exercises> + </section> diff --git a/source/ch-staying-synchronized/ch-staying-synchronized.ptx b/source/ch-staying-synchronized/ch-staying-synchronized.ptx index f7dd609..837e4a5 100644 --- a/source/ch-staying-synchronized/ch-staying-synchronized.ptx +++ b/source/ch-staying-synchronized/ch-staying-synchronized.ptx @@ -5,7 +5,7 @@ <introduction> <p> - This topic focuses on how to keep your local and origin repositories synchronized with the project's upstream repo. + This topic focused on how to keep your local and origin repositories synchronized with the project’s upstream repo. In class you saw how changes contributed to the upstream via pull requests can be merged into the <c>main</c> branch by a project maintainer. When your changes, and those of your classmates, were merged it left your local and origin repos out of synch with the upstream. That is, the upstream <c>main</c> branch contains commits that your copies of the <c>main</c> branch do not. @@ -14,8 +14,9 @@ <p> The activities in this chapter will have you <em>synchronize</em> with the upstream. Synchronizing with the upstream ensures that your local and origin copies of the <c>main</c> branch contain all of the same commits as the upstream <c>main</c> branch. - This is something that developers do regularly to ensure that when they create a new feature branch their changes are built on the most up to date version of the project. - Once you have synchronized your repositories you will repeat the process of upstreaming your changes by finding an issue in the issue tracker, creating a feature branch, fixing the issue and making a pull request (PR). + This is something that you will want to do regularly as it ensures that when you create a new feature branch your changes are built on the most up to date version of the project. + Once you have synchronized your repositories you will repeat the process of fixing an issue and upstreaming your changes via a pull request. + You will find an issue in the issue tracker, create a feature branch, fix the issue and make a pull request (PR) to the upstream for your changes. </p> </introduction> <!-- include sections --> diff --git a/source/ch-staying-synchronized/images/changes-merged-into-upstream-pull.png b/source/ch-staying-synchronized/images/changes-merged-into-upstream-pull.png deleted file mode 100644 index 9f8573b..0000000 Binary files a/source/ch-staying-synchronized/images/changes-merged-into-upstream-pull.png and /dev/null differ diff --git a/source/ch-staying-synchronized/sec-deleting-a-feature-branch.ptx b/source/ch-staying-synchronized/sec-deleting-a-feature-branch.ptx index 4cfa854..9b609cb 100644 --- a/source/ch-staying-synchronized/sec-deleting-a-feature-branch.ptx +++ b/source/ch-staying-synchronized/sec-deleting-a-feature-branch.ptx @@ -10,433 +10,252 @@ But most developers will delete them to avoid having their repos become cluttered with old feature branches. </p> - <p> - <xref ref="fig-deleting-feature-branch"/> shows the state that will result after deleting the feature branch from your local and origin repositories. - </p> - <p> <figure xml:id="fig-deleting-feature-branch" > <caption> Deleting Feature Branches. </caption> <image source="images/ch-staying-synchronized/deleting-feature-branch.png" width="75%"> <description> - Cloud image showing that the feature branch was deleted. + Cloud image of the feature branch. </description> </image> </figure> </p> <p> - Deleting a feature branch is a two step process, first you will delete the feature branch from your local repository. Then you will push that deletion from your local branch to your origin, in order to delete it there as well. + <xref ref="fig-deleting-feature-branch"/> shows the state that will result after deleting the feature branch from your local and origin repositories. </p> </introduction> - <subsection xml:id="topic-delete-local-feature-branch" label="topic-delete-local-feature-branch"> - <title>Deleting a Feature Branch from your Local Repo - + + + <exercise xml:id="ex-deleting-feature-branch" label="ex-deleting-feature-branch"> <introduction> <p> - The first step in deleting a feature branch is to delete the feature branch from your local repository. - The exercises in this section will walk you through that process. + The first step is to delete the feature branch from your local repository. + This exercise will walk you through that process. </p> </introduction> - <exercises> - <title /> - <exercise xml:id="ex-deleting-feature-branch" label="ex-deleting-feature-branch"> + <task xml:id="ex-deleting-feature-branch-a" label="ex-deleting-feature-branch-a"> + <statement> + <p> + It is not possible to delete the active branch. + So, if you have not already, switch from your feature branch to the <c>main</c> branch. + Then give a command that lists all of the branches in your local repository. + </p> + + <p> + Which command did you type to list the local branches? + </p> + </statement> - <task xml:id="ex-deleting-feature-branch-step-order" label="ex-deleting-feature-branch-step-order" > + + <choices randomize="yes"> + <choice> <statement> <p> - Git will not allow you to delete the active branch. So typically you will switch to the <c>main</c> branch before deleting a feature branch. + <c>git switch</c> </p> + </statement> + <feedback> <p> - Choose and order the commands below to switch from your feature branch to the <c>main</c> branch and then list all of the branches in your local repository. - Not all commands will be used. + The <c>git switch</c> command is used to change the active branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + <c>git pull</c> </p> </statement> - <blocks> - <block order="1"> - <p> - <c>git switch main</c> - </p> - </block> - <block correct="no"> - <p> - <c>git log</c> - </p> - </block> - <block order="2"> - <p> - <c>git branch</c> - </p> - </block> - <block correct="no"> - <p> - <c>git switch <feature branch name></c> - </p> - </block> - <block correct="no"> - <p> - <c>git status</c> - </p> - </block> - </blocks> - <hint> + <feedback> <p> - You will need two commands, the first one to make the <c>main</c> branch active and the second to list the local branches. + The <c>git pull</c> command is used to pull changes from a remote repository to your local repository. </p> - </hint> - </task> + </feedback> + </choice> - <task xml:id="ex-deleting-feature-branch-a" label="ex-deleting-feature-branch-a"> + <choice> <statement> <p> - Run the commands you identified in <xref ref="ex-deleting-feature-branch-step-order" /> in the terminal. + <c>git commit</c> + </p> + </statement> + <feedback> + <p> + The <c>git commit</c> command is used to commit staged changes to the repository. </p> + </feedback> + </choice> + + <choice correct="yes"> + <statement> <p> - How can you tell from the output provided that your <c>main</c> branch is currently active? + <c>git branch</c> </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>main</c> an * next to it. - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - <c>main</c> appears in green. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - <c>main</c> appears in bold. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - <c>main</c> appears in italics. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - It is not possible to tell that <c>main</c> is the active branch based upon the output. - </p> - </statement> - </choice> - </choices> - <hint> + <feedback> <p> - The output should clearly indicate that <c>main</c> is the active branch in several ways. + Correct! The <c>git branch</c> command is used to display all of branches in your local repository. </p> - </hint> - </task> - </exercise> - - <exercise xml:id="ex-deleting-feature-branch-c" label="ex-deleting-feature-branch-c"> - <statement> - <p> - The command <c>git branch -D <branch></c> will delete a branch from your local repository. - </p> - </statement> - - <statement> - <p> - Give a command that will delete your feature branch. - </p> - - <p> - <var width="45" /> - </p> - </statement> - <setup> - <var> - <condition string="^git branch -D (?!main)[^<].+[^>]$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Please give the full <c>git branch</c> command using the format indicated in the question. - Be sure not to leave in the < and > symbols. - Replace the word branch with your feature branch name. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - - <exercise xml:id="ex-deleting-feature-branch-d" label="ex-deleting-feature-branch-d"> - <statement> - <p> - Run your command from <xref ref="ex-deleting-feature-branch-c"/> in the terminal and examine the output. - </p> - <p> - Which of the following looks most similar to the output you see? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Deleted branch <branch> (was <SHA code here>) - </p> - </statement> - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - error: branch <branch> not found. - </p> - </statement> - <feedback> - <p> - You should not get an error. Return to <xref ref="ex-deleting-feature-branch-c"/> and try again. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - branch deleted - </p> - </statement> - <feedback> - <p> - Look at your output again. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - there are no active branches - </p> - </statement> - <feedback> - <p> - Look at your output again. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look at your terminal window to see what appears in the output from the command you typed. - </p> - </hint> - </exercise> - </exercises> - </subsection> - - <subsection xml:id="topic-delete-origin-feature-branch" label="topic-delete-origin-feature-branch"> - <title>Deleting a feature branch from your origin + + + + + +

    + Refer back to the section on switching branches +

    +
    + + + + + +

    + From the output provided by how do you know which is the active branch? +

    +
    - -

    - In the previous exercise you deleted your feature branch from your local repository. But you have not yet deleted that feature branch from your origin repository on GitHub. The tasks in this exercise will walk you through that process. -

    -
    - - - - - -

    - First, let's confirm that your feature branch still exists in your origin. How can you check if your feature branch exists in your origin repo on GitHub? -

    -
    - - - -

    - Go to the GitHub origin repo and click on the branches button. -

    -
    - -

    - Correct! -

    -
    -
    - - -

    - Use the git branch command. -

    -
    - -

    - This command shows the local branches. -

    -
    -
    - - -

    - Use the git branch -D <branch> command. -

    -
    - -

    - This command will delete a local branch -

    -
    -
    - - -

    - There is no way to check for branches on GitHub. -

    -
    - -

    - Take another look at the GitHub interface. -

    -
    -
    -
    - -

    - Go to the origin repository on GitHub and look for something that you might use to see which branches exist. -

    -
    -
    - - - -

    - The Git command - git push -d <remote> <branch> - will delete the specified branch from the specified remote repository. -

    -

    - Give a command that will delete your feature branch from your origin repository. -

    -

    - -

    -
    - - - - -

    - Thank you. -

    -
    -
    - - -

    - Please give the full git push -d command using the format indicated in the question. - Be sure not to leave in the < and > symbols. - Replace the word remote with origin and branch with your feature branch name. -

    -
    -
    -
    -
    -
    - - - + +

    - Run your command from in the Terminal and examine the output. + It has an * next to it.

    +
    +
    + + +

    - Which of the following looks most similar to the output you see? + It appears in green.

    - - - -

    - [deleted] <branch> -

    -
    - -

    - Correct! -

    -
    -
    - - -

    - error: unable to delete '<branch>': remote ref does not exist -

    -
    - -

    - Make sure you entered your feature branch name correctly. -

    -
    -
    - - -

    - delete completed -

    -
    - -

    - Look again at the output provided in the terminal window. -

    -
    -
    - - -

    - origin updated -

    -
    - -

    - Look again at the output provided in the terminal window. -

    -
    -
    -
    - +
    + + + +

    + It appears in bold. +

    +
    +
    + + +

    - Examine the output of your git push command. + It appears in italics.

    - -
    + + - +

    - Use your browser as you did in to confirm that your feature branch is deleted from your origin repo on GitHub. - If it has not been deleted, revisit and and try again. + It is not possible to tell the active branch based upon the output provided.

    -
    -
    + + + + +

    + Refer back to the section on switching branches +

    +
    +
    + + + +

    + The command git branch -D <branch> will delete a branch from your local repository. + Use the this command to delete your feature branch. +

    +
    +
    + + + + +

    + How can you check if your branch was deleted? Be sure to check that it was deleted. + If not return to and try again. +

    +
    + +
    +
    + + + +

    + In the previous exercise you deleted your feature branch from your local repository. +

    +
    + + + + +

    + This feature branch no longer exists in your origin repo on GitHub. +

    +
    + +

    + You have only deleted the feature branch in your local repository. It still exists in your origin repository on GitHub. +

    +
    + + +

    + Make sure you look at your repository on GitHub and click the "Branches" link. +

    +
    +
    + + + + +

    + Explain how you know whether the feature branch exists in your origin repo on GitHub? +

    +
    + +
    + + + + +

    + You can delete your feature branch from your origin repo using the git CLI. + The command +

    + +

    + git push -d <remote repo name> <branch> +

    + +

    + will delete the specified branch from the specified remote repository. + Use this command to delete your feature branch from your origin repo. +

    +
    +
    + -
    - + + +

    + Use your browser as you did in to confirm that your feature branch is deleted from your origin repo on GitHub. + If it has not been deleted, revisit and try again. +

    +
    +
    + +
    diff --git a/source/ch-staying-synchronized/sec-git-command-summary.ptx b/source/ch-staying-synchronized/sec-git-command-summary.ptx index 07ddf2f..84d21d0 100644 --- a/source/ch-staying-synchronized/sec-git-command-summary.ptx +++ b/source/ch-staying-synchronized/sec-git-command-summary.ptx @@ -12,72 +12,30 @@ - <exercise xml:id="ex-git-commands-summary-synching" label="ex-git-commands-summary-synching"> - <statement> - <p> - Match the tasks on the right with the appropriate Git command listed on the left. - </p> - </statement> - <feedback> - <p> - Refer back to the sections in this chapter to see what each command does. - </p> - </feedback> - <matches> - <match> - <premise> - <c>git remote -v</c> - </premise> - <response> - List your remote repos - </response> - </match> - <match> - <premise> - <c>git remote add <remote> <URL></c> - </premise> - <response> - Add a new remote repo - </response> - </match> - <match> - <premise> - <c>git push <remote> <branch> </c> - </premise> - <response> - Synch a branch of your origin repo with your local repo - </response> - </match> - <match> - <premise> - <c>git pull <remote> <branch> </c> - </premise> - <response> - Synch a branch of your local repo with the upstream - </response> - </match> - <match> - <premise> - <c>git branch -D <branch> </c> - </premise> - <response> - Delete a feature branch from your local repo - </response> - </match> - <match> - <premise> - <c>git push -d <remote> <branch> </c> - </premise> - <response> - Delete a feature branch from your origin - </response> - </match> - </matches> - <hint> - <p> - Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. - </p> - </hint> - </exercise> + <exercise xml:id="ex-git-commands-summary-synching" label="ex-git-commands-summary-synching"> + <statement> + <p> + Match the tasks on the right with the appropriate git command listed on the left. + </p> + </statement> + <matches> <match> + <premise> + <c>git remote -v</c></premise> <response>List your remote repos</response> </match> <match> + <premise> + <c>git remote add <remote repo name> <remote repo URL></c></premise> <response>Add a new remote repo</response> </match> <match> + <premise> + <c>git pull --ff-only <remote repo name> <branch> </c></premise> <response>Synch a branch of your origin repo with your local repo</response> </match> <match> + <premise> + <c>git push <remote repo name> <branch> </c></premise> <response>Synch a branch of your local repo with the upstream</response> </match> <match> + <premise> + <c>git branch -D <branch> </c></premise> <response>Delete a feature branch from your local repo</response> </match> <match> + <premise> + <c>git push -d <remote repo name> <branch> </c></premise> <response>Delete a feature branch from your origin</response> </match> </matches> + <hint> + <p> + Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. + </p> + </hint> + </exercise> </exercises> </section> diff --git a/source/ch-staying-synchronized/sec-lets-do-it-again.ptx b/source/ch-staying-synchronized/sec-lets-do-it-again.ptx index 1ccc8ff..14a961c 100644 --- a/source/ch-staying-synchronized/sec-lets-do-it-again.ptx +++ b/source/ch-staying-synchronized/sec-lets-do-it-again.ptx @@ -7,112 +7,233 @@ <p> You’ve learned a lot about Git and GitHub. But, to become proficient with these tools takes a lot of repetition and practice. - The exercises in this section ask you to repeat the process of finding an issue, fixing it and creating a pull request as you did in <xref ref="topic-upstreaming-changes" text="type-global-title"/>. - This will give you more good practice. But also, the issue you will be fixing this time has been carefully planned as a setup for the next chapter too! + This section asks you to go through the process of finding an issue, fixing it and creating a pull request again. + This is good practice but what you will be asked to do has also been carefully planned to set us up for the next chapter too! </p> </introduction> + <exercises> + <title /> + <subsection> + <title>Claiming Another Issue - - Process of Fixing an Issue +

    - Before you get into the work of fixing a new issue, it will be helpful to review the steps that you'll need to use and they were and how they fit together. + The issue tracker in the upstream FarmData2 repository being used for these tasks.

    - - - <exercise xml:id="ex-fixing-issue-ordering" label="ex-fixing-issue-ordering"> + + <task xml:id="ex-claim-issue-a" label="ex-claim-issue-a"> <statement> <p> - The steps you carried out in <xref ref="topic-upstreaming-changes" /> are listed below in a jumbled-up order, drag them to the right to arrange them the proper order. + Use the label dropdown in the issue tracker to filter for issues labeled with the “Round2” tag. + How many issues are tagged with this label? </p> </statement> - <blocks randomize="yes"> - <block> - <p> - Claim an issue - </p> - </block> - <block> - <p> - Create a new feature branch - </p> - </block> - <block> - <p> - Switch to the feature branch - </p> - </block> - <block> - <p> - Edit the local files - </p> - </block> - <block> - <p> - Stage your changes - </p> - </block> - <block> - <p> - Commit changes to the feature branch - </p> - </block> - <block> - <p> - Push the feature branch to your origin - </p> - </block> - <block> - <p> - Make a pull request to the upstream - </p> - </block> - </blocks> + + + <choices> + <choice correct="yes"> + <statement> + <p> + 4 + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + 6 + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + 35 + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + 40 + </p> + </statement> + </choice> + </choices> + <hint> <p> - Think about the full process that you worked through from claiming your Round1 issue through making a pull request for your changes. + ADD HINT HERE </p> </hint> - </exercise> - </exercises> + </task> + + + <task xml:id="ex-claim-issue-b" label="ex-claim-issue-b"> + <statement> + <p> + Clearly there are not enough “Round2” issues for everyone to have their own as was the case with the “Round1” issues. + So, this time there will be multiple people working on the same issue. + </p> + + <p> + Pick one of the “Round2” issues to work on and make a comment on it to indicate your interest in working on it. + Note it is not necessary that the issue be assigned to you this time. + Try to spread out across the issues so that multiple people have commented that they are working on each one. + Give the Issue # and title that you chose. + </p> + </statement> + <response /> + </task> + </exercise> </subsection> - <subsection xml:id="topic-claim-round-two-issue" label="topic-claim-round-two-issue"> - <title>Claim a Round2 Issue - + + Fixing the Issue and Upstreaming Your Changes + + + +

    + Now you will go through the process of fixing the issue and making a pull request. + You will use the same process that you used for your “Round1” issue earlier. + That process had a number of steps. + They are listed below in a jumbled-up order, determine the proper order. +

    +
    + +

    + Create a new feature branch +

    +
    + +

    + Switch to the feature branch +

    +
    +

    - Now it is time to find a new issue to work on. + Edit the local files

    -
    + + +

    + Stage your changes +

    +
    + +

    + Commit changes to the feature branch +

    +
    + +

    + Push the feature branch to your origin +

    +
    + +

    + Make a pull request to the upstream +

    +
    + + +

    + HINT HERE. +

    +
    +
    + + + +

    + Use the process that you outlined in to fix your “Round2” issue and create a pull request to the upstream for your changes. +

    + +

    + Be sure to: +

      +
    • +

      + Use a descriptive name for your branch. +

      +
    • + +
    • +

      + Use a meaningful message when committing your changes to the feature branch. +

      +
    • + +
    • +

      + Provide a useful title and description when creating your pull request. +

      +
    • + +
    • +

      + Include a “Closes” or “Fixes” line in your pull request description so that the associated issue number will be closed automatically if your pull request is merged. +

      +
    • +
    +

    +
    - - - <exercise xml:id="ex-claim-issue" label="ex-claim-issue"> + + <task xml:id="ex-fixing-issue-process-a" label="ex-fixing-issue-process-a"> <statement> <p> - Go to the issue tracker in the <em>upstream FarmData2 repository</em> that you are using for your course. + Which of the following Git commands did you use for the steps indicated below. + The command references that you created in <xref ref="ex-git-commands-summary-synching"/> may also come in handy here. </p> + </statement> + <matches> <match> + <premise> + <c>git branch <branch></c></premise> <response>Create feature branch</response> </match> <match> + <premise> + <c>git switch <branch></c></premise> <response>Switch to feature branch</response> </match> <match> + <premise> + <c>git stage <file></c></premise> <response>Add changes to stage</response> </match> <match> + <premise> + <c>git commit -m "message"</c></premise> <response>Commit changes</response> </match> <match> + <premise> + <c>git push</c></premise> <response>Push feature branch</response> </match> </matches> + <hint> <p> - Use the "Labels" dropdown in the issue tracker to filter for issues labeled with the “Round2” tag. + Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. </p> + </hint> + </task> + + + <task xml:id="ex-fixing-issue-process-b" label="ex-fixing-issue-process-b"> + <statement> <p> - How many issues have the Round2 tag? + Which of the following would be the best name for a feature branch for issue #37 that adds a link to the NSF award in the Acknowledgements section? </p> </statement> - <choices> - <choice correct="yes"> + + + <choices randomize="yes"> + <choice> <statement> <p> - 4 + issue37 </p> </statement> + <feedback> <p> - Correct. + This branch name doesn't provide enough information. + What is issue 37? </p> </feedback> </choice> @@ -120,475 +241,217 @@ <choice> <statement> <p> - 6 + adding-link </p> </statement> + <feedback> <p> - Be sure you have selected the "Round2" label. + This branch name is too generic. </p> </feedback> </choice> - <choice> + + <choice correct="yes"> <statement> <p> - 35 + adding-nsf-link-acknowledgement </p> </statement> + <feedback> <p> - Be sure you have selected the "Round2" label. + Correct! This branch name describes the work to be done in the branch. </p> </feedback> </choice> + <choice> <statement> <p> - 39 + nsf-acknowledgement </p> </statement> + <feedback> <p> - Be sure you have selected the "Round2" label. + This branch name doesn't specify what is being done with regard to the NSF acknowledgement. </p> </feedback> </choice> </choices> + <hint> <p> - Make sure you have the Round2 tag selected in the "Labels" dropdown. The "Labels" dropdown is between the "Author" and "Projects" dropdowns. + Refer back to the section on creating branches <xref ref="topic-creating-a-feature-branch"/> for information on branch names. </p> </hint> - </exercise> + </task> - <exercise xml:id="ex-claim-issue-b" label="ex-claim-issue-b"> + + <task xml:id="ex-fixing-issue-process-c" label="ex-fixing-issue-process-c"> <statement> <p> - Clearly there are not enough “Round2” issues for everyone to have their own as was the case with the “Round1” issues. - So, this time there will be multiple people working on the same issue. + Which of the following would be the best commit message for the fix for issue 38 that adds a link to the GNOME Community Engagement Challenge in the acknowledgements? + </p> + </statement> + + + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + Added the URL for GNOME to the acknowledgements section of the REAMDE file. + </p> + </statement> + + <feedback> + <p> + Correct! This commit message briefly but completing describes the change made. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Added URL. + </p> + </statement> + + <feedback> + <p> + This commit message doesn't provide enough information about the URL added. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Updated README. + </p> + </statement> + + <feedback> + <p> + This commit message doesn't provide enough information about what has been changed in the README file. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Fixed typo. + </p> + </statement> + + <feedback> + <p> + This commit message is too generic and does not describe the change for this issue. + </p> + </feedback> + </choice> + </choices> + + <hint> + <p> + Refer back to the section on creating branches <xref ref="topic-committing-to-your-local-repository"/> for information on commit messages. </p> + </hint> + </task> + </exercise> + + <exercise xml:id="ex-pull-request-info" label="ex-pull-request-info"> + <introduction> + <p> + Give the following information about your pull request. + Hint: You can revisit the prior sections to refresh your memory on the terms <term>Base Repository</term>, <term>Head Repository</term>, <term>Base Branch</term> and <term>Compare Branch</term>. + </p> + </introduction> + + <task xml:id="ex-pull-request-info-a" label="ex-pull-request-info-a"> + <statement> <p> - Pick one of the “Round2” issues to work on and make a comment on it to indicate your interest in working on it. - Note it is not necessary that the issue be assigned to you this time. - Try to spread out across the issues so that multiple people have commented that they are working on each one. + The number of your PR </p> + </statement> + <response /> + </task> + + + <task xml:id="ex-pull-request-info-b" label="ex-pull-request-info-b"> + <statement> <p> - Give the number of the issue you chose. + Full URL of your PR </p> + </statement> + <response /> + </task> + + <task xml:id="ex-pull-request-info-c" label="ex-pull-request-info-c"> + <statement> <p> - <var width="10" /> + Base Repository URL </p> </statement> - <setup> - <var> - <condition string="^#?(36|37|38|39)$"> - <feedback> - <p> - Thank you for selecting a Round2 issue. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Make sure that your issue is labeled as a Round2 issue. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - </exercises> - </subsection> + <response /> + </task> - <subsection> - <title>Fix the Issue - -

    - Now that you have an issue to work on, it is time to fix it. But before you actually start fixing the issue, let's review some of the Git commands and a few other important ideas you'll need to use to carry out the steps from . -

    -
    - - - - <exercise xml:id="ex-fixing-issue-process" label="ex-fixing-issue-process"> - - <task xml:id="ex-fixing-issue-process-a" label="ex-fixing-issue-process-a"> - <statement> - <p> - Match the Git commands will you use for each of the tasks indicated below. - </p> - </statement> - <matches> - <match> - <premise> - <c>git branch <branch></c> - </premise> - <response> - Create your feature branch - </response> - </match> - <match> - <premise> - <c>git switch <branch></c> - </premise> - <response> - Switch to your feature branch - </response> - </match> - <match> - <premise> - <c>git stage <file></c> - </premise> - <response> - Stage your changes for a commit. - </response> - </match> - <match> - <premise> - <c>git commit -m "message"</c> - </premise> - <response> - Commit your changes to the active branch. - </response> - </match> - <match> - <premise> - <c>git push origin <branch></c> - </premise> - <response> - Push your feature branch to your origin. - </response> - </match> - </matches> - <hint> - <p> - The command reference that you created in <xref ref="topic-git-command-summary-upstreaming"/> may come in handy here. - </p> - </hint> - </task> - - - <task xml:id="ex-fixing-issue-process-b" label="ex-fixing-issue-process-b"> - <statement> - <p> - When creating branches you should always use name that describes what is being done in the branch, without being too long. This will help you to remember the purpose of the branch, but not make it onerous to type. - </p> - <p> - Which of the following would be the best name for a feature branch for issue #37 that adds a link to the NSF award in the Acknowledgements section? - </p> - </statement> - - <choices randomize="yes"> - <choice> - <statement> - <p> - issue37 - </p> - </statement> - <feedback> - <p> - This branch name identifies the issue but you would have to remember what that issue is to know what the branch does. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - adding-link - </p> - </statement> - <feedback> - <p> - This branch sort of describes what is being done, but isn't specific enough to know what the branch really does. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - link-nsf-award - </p> - </statement> - <feedback> - <p> - Correct. This branch name has enough context to describe what the branch does without being excessively long. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - add-link-to-nsf-award-in-acknowledgements-section - </p> - </statement> - - <feedback> - <p> - This branch name is very descriptive but seems excessively long. Can you imagine typing that over and over again? - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Refer back to <xref ref="topic-creating-a-feature-branch" text="type-global-title"/> for information on branch names. - </p> - </hint> - </task> - - <task xml:id="ex-fixing-issue-process-c" label="ex-fixing-issue-process-c"> - <statement> - <p> - When writing commit messages for the <c>git commit</c> the message should be descriptive of what the changes in the commit do. - </p> - <p> - Which of the following would be the best commit message for the fix for issue 38 that adds a link to the GNOME Community Engagement Challenge in the acknowledgements? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Adds the URL for GNOME to the acknowledgements section of the REAMDE.md file. - </p> - </statement> - <feedback> - <p> - Correct. This commit message briefly but completing describes the change made. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Added URL. - </p> - </statement> - <feedback> - <p> - This commit message doesn't provide enough information about the URL added. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Updated README.md. - </p> - </statement> - <feedback> - <p> - This commit message doesn't provide enough information about what has been changed in the README.md file. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Fixed a typo. - </p> - </statement> - <feedback> - <p> - This commit message is too generic and does not actually describe the changes that would be committed for this issue. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Refer back to <xref ref="topic-committing-to-your-local-repository" text="type-global-title"/> for information on commit messages. - </p> - </hint> - </task> - </exercise> - </exercises> - </subsection> - <subsection xml:id="topic-upstreaming-round2-changes" label="topic-upstreaming-round2-changes"> - <title>Upstreaming the Changes - -

    - Now that you have fixed the issue and pushed your feature branch, the last thing to do is to make a pull request. -

    -
    - - - <exercise xml:id="ex-pull-request-info-b" label="ex-pull-request-info-b"> + <task xml:id="ex-pull-request-info-d" label="ex-pull-request-info-d"> <statement> <p> - Make a pull request for your feature branch to the upstream repository for your course. + Head Repository URL </p> + </statement> + <response /> + </task> + + + <task xml:id="ex-pull-request-info-e" label="ex-pull-request-info-e"> + <statement> <p> - Enter the full URL of your PR below. + Base Branch </p> + </statement> + <response /> + </task> + + <task xml:id="ex-pull-request-info-f" label="ex-pull-request-info-f"> + <statement> <p> - <var width="65" /> + Compare Branch </p> </statement> - <setup> - <var> - <condition string="^https://github\.com/.+/pull/[0-9]+$"> - <feedback> - <p> - Thank you for supplying your pull request URL. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Make sure you have the complete URL of the PR starting with https and ending with the number of your pull request. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - - <exercise xml:id="ex-pull-request-problem" label="ex-pull-request-problem"> - <introduction> + <response /> + </task> + + + <task xml:id="ex-pull-request-info-g" label="ex-pull-request-info-g"> + <statement> <p> - Because there were a limited number of “Round2” issues, other students in your class will have worked on the same Round2 issue as you id. Thus, they will also have made pull requests that contain changes to the same line(s) in the <c>README.md</c> file as you did. The tasks below will ask you some questions about this situation. + The line number of the README.md file that you changed. + Hint: use the diff you saw in the prior chapter. </p> - </introduction> - - <task xml:id="ex-round-two-pull-request-pre-merge" label="ex-round-two-pull-request-pre-merge"> - <statement> - <p> - Assume for now that the maintainers have not merged any pull requests that fix the Round2 issue that is addressed by your pull request. - </p> - <p> - Which of the following statements best describes this situation. - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - GitHub will indicate that your PR can be merged automatically because it does not contain any conflicts with the upstream <c>main</c> branch. - </p> - </statement> - <feedback> - <p> - Correct. While your PR changes the same lines of the <c>README.md</c> file as the other PRs, none of those PRs have been merged into the upstream <c>main</c>. Thus, your PR will not contain any conflicts with the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - GitHub will indicate that your PR cannot be merged automatically because it contains a conflict with the upstream <c>main</c> branch. - </p> - </statement> - <feedback> - <p> - While your PR changes the same lines of the <c>README.md</c> file as the other PRs, none of those PRs have been merged into the upstream <c>main</c>. Thus, your PR will not contain any conflicts with the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - If your PR was the first one submitted for your Round2 issue, GitHub will indicate that it can be merged automatically, otherwise it will indicate that it cannot because there is a conflict with the upstream <c>main</c>. - </p> - </statement> - <feedback> - <p> - The order in which the PR's are created does not matter. A conflict will only arise after the changes in one of the PRs are merged into the upstream <c>main</c>. Thus, because no PRs have been merged there is no conflict between your PR and the upstream <c>main</c> at this point. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - GitHub will indicate that your PR can be merged automatically because it does not contain conflicts with any of the other PRs that have been submitted for your Round2 issue. - </p> - </statement> - <feedback> - <p> - Your PR and the others for your Round2 issue change the same lines, so in some sense your PR conflicts with the other PRs. However, none of them have been merged into the upstream <c>main</c> yet. Thus, there is no conflict between your PR and the upstream <c>main</c> at this point. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Visit your PR in the upstream repo and see what GitHub tells you about whether it can be merged or not. - </p> - </hint> - </task> - - <task xml:id="ex-round-two-pull-request-post-merge" label="ex-round-two-pull-request-post-merge"> - <statement> - <p> - Now assume that the maintainers have merged one of the other pull requests (not yours) that fix your Round2 issue. - </p> - <p> - Which of the following statements best describes this situation. - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - GitHub will indicate that your PR can be merged automatically because it does not contain any conflicts with the upstream <c>main</c> branch. - </p> - </statement> - <feedback> - <p> - Your PR will have changed the same lines in <c>README.md</c> as the merged PR. The changes from the merged PR are now in the upstream <c>main</c> branch. Thus, your feature branch will now have conflicts with the upstream <c>main</c> branch and will not be able to be merged automatically. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - GitHub will indicate that your PR cannot be merged automatically because it contains a conflict with the upstream <c>main</c> branch. - </p> - </statement> - <feedback> - <p> - Correct. A PR for the Round2 issue you were working on has been merged into the upstream <c>main</c>. Your PR contained changes that changed the same lines of the <c>README.md</c> file as the merged PR. Thus, your PR will have conflicts with the upstream <c>main</c> branch and will not be able to be merged automatically. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - If your PR for your Round2 issue was submitted before the other one was merged, GitHub will indicate that your PR can be merged automatically. - </p> - </statement> - <feedback> - <p> - The order in which the PR's are created does not matter. GitHub reevaluates whether there is a conflict each time you visit the PR page. Thus, because the other PR was merged, and it changed the same lines in <c>README.md</c> as your PR, your PR will now contain a conflict with the upstream <c>main</c> branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - GitHub will indicate that your PR cannot be merged automatically because it contain conflicts with all of the other PRs that have been submitted for your Round2 issue. - </p> - </statement> - <feedback> - <p> - Your PR will in some sense contain conflicts with all of the other PRs for the same Round2 issue. However, only the conflict with the upstream <c>main</c> branch matter here. That conflict was created when the other PR for your Round2 issue was merged. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Visit your PR in the upstream repo and see what GitHub tells you about whether it can be merged or not. - </p> - </hint> - </task> - </exercise> - </exercises> + </statement> + <response /> + </task> + </exercise> + + <exercise xml:id="ex-pull-request-problem" label="ex-pull-request-problem"> + <statement> + <p> + Because there were a limited number of “Round2” issues, other students will have been simultaneously making changes to fix the same lines in the same files. + Describe in a few sentences how this might create a problem in the future. + </p> + </statement> + <response /> + </exercise> </subsection> + </exercises> </section> diff --git a/source/ch-staying-synchronized/sec-overview-of-synchronizing-with-the-upstream-repository.ptx b/source/ch-staying-synchronized/sec-overview-of-synchronizing-with-the-upstream-repository.ptx index fe742bc..d796778 100644 --- a/source/ch-staying-synchronized/sec-overview-of-synchronizing-with-the-upstream-repository.ptx +++ b/source/ch-staying-synchronized/sec-overview-of-synchronizing-with-the-upstream-repository.ptx @@ -4,191 +4,27 @@ <title>Overview of Synchronizing with the Upstream Repository -

    - As you saw in , as changes from pull requests (yours and others) are merged into upstream main, the main branches in your local and origin repos will get out of synch with the upstream. -

    + As changes from pull requests (yours and others) are merged into upstream main, the main branches in your local and origin repos will get out of synch with the upstream.

    Now, recall that upstream main should be the starting point for all new work. - So, before you can work on something new, you'll need to ensure that your main branches look like the upstream main (i.e. + So, before you can work on something new, you’ll want to make your main branches look like the upstream main (i.e. you will synchronize them with the upstream). This is a two-step process. - First, you will pull the upstream main into your local repository and then you will push it to your origin. - shows how pulling main from the upstream and then pushing it to your origin synchronizes the main branches. + You will pull the upstream main into your local repository and then you will push it to your origin. + shows how pulling main from the upstream and then pushing it to your origin synchs the main branches.

    - Synchronizing the local and origin main branches with the upstream. + Synch with Upstream. - Cloud image showing how the main branches of the local and origin repository are synchronized with the upstream. + Cloud image of how upstream and the local repository are out of synch.

    - - - - <exercise xml:id="ex-over-synch" label="ex-over-synch"> - <introduction> - <p> - Answer the following questions using <xref ref="fig-synching-with-upstream" /> - </p> - </introduction> - - <task xml:id="ex-over-synch-a" label="ex-over-synch-a"> - <statement> - <p> - Which action will copy changes from the upstream repository to your local repository? - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - Pushing to your origin. - </p> - </statement> - <feedback> - <p> - The push operation copies changes from your local repository to a remote repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pulling from your origin. - </p> - </statement> - <feedback> - <p> - The pull operation copies changes from a remote repository to your local repo. But which remote repo do you need to copy from? - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pushing to the upstream. - </p> - </statement> - <feedback> - <p> - The push operation copies changes from your local repository to a remote repository. But, recall that you do not have permission to push to upstream. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - Pulling from the upstream . - </p> - </statement> - <feedback> - <p> - Correct. Pulling from the upstream copies the changes that have been merged into upstream into your local repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Switching to your feature branch. - </p> - </statement> - <feedback> - <p> - Switching branches does not move information between your local repository and a remote repository. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look back to at the figure to see which arrow goes from the upstream to your local repository. - </p> - </hint> - </task> - - <task xml:id="ex-over-synch-b" label="ex-over-synch-b"> - <statement> - <p> - Which action copies changes from your local repository to your origin repository? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Pushing to your origin. - </p> - </statement> - - <feedback> - <p> - Correct. Pushing to your origin will copy changes from your local repository to your origin repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pulling from your origin. - </p> - </statement> - <feedback> - <p> - Pulling copies changes from a remote repository into your local repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pushing to the upstream. - </p> - </statement> - <feedback> - <p> - Pushing copies changes from your local repository to a remote repository. But recall that you do not have permission to push to upstream <c>main</c>. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pulling from the upstream. - </p> - </statement> - <feedback> - <p> - Correct. Pulling from the upstream copies changes that have been merged into the upstream to your local repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Switching to your feature branch. - </p> - </statement> - - <feedback> - <p> - Switching branches does not move information between your local repository and a remote repository. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look back to at the figure to see which arrow goes from your local repository to the origin. - </p> - </hint> - </task> - </exercise> - </exercises> + </section> diff --git a/source/ch-staying-synchronized/sec-pulling-the-upstream-main-branch.ptx b/source/ch-staying-synchronized/sec-pulling-the-upstream-main-branch.ptx index 795c2ce..3da4645 100644 --- a/source/ch-staying-synchronized/sec-pulling-the-upstream-main-branch.ptx +++ b/source/ch-staying-synchronized/sec-pulling-the-upstream-main-branch.ptx @@ -4,226 +4,194 @@ <title>Pulling the Upstream <c>main</c> Branch - - <statement> - <p> - The next step in getting synchronized with the upstream is to pull the changes to the <c>main</c> branch from the upstream repo to your local repo. - </p> - - <p> - <xref ref="fig-changes-merged-into-upstream-pull" /> illustrates the state after several commits have been merged into upstream <c>main</c> and those changes have been pulled into the <c>main</c> branch in the local repo. - </p> - - <p> - <figure xml:id="fig-changes-merged-into-upstream-pull" > - <caption> Pulling changes from upstream <c>main</c> branch into the local <c>main</c> branch. </caption> - <image source="images/ch-staying-synchronized/changes-merged-into-upstream-pull.png" width="75%"> - <description> - Cloud image illustrating changes being pulled into the local <c>main</c> branch from the upstream <c>main</c> branch. - </description> - </image> - </figure> - </p> - - <p> - This section walks you through the process of pulling changes from the upstream <c>main</c> branch into your local <c>main</c> branch. - </p> - </statement> - - <exercise xml:id="ex-ensure-main-is-active-branch" label="ex-ensure-main-is-active-branch"> - <introduction> - <p> - To pull the changes from the upstream <c>main</c> branch into your local repo you first need to ensure that <c>main</c> is the active branch in your local repo. - </p> - </introduction> - <task xml:id="ex-check-if-main-is-active-cmd" label="ex-check-if-main-is-active-cmd"> - <statement> - <p> - Which command can you use to check if <c>main</c> is the active branch? - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - <c>git log</c> - </p> - </statement> - <feedback> - <p> - The <c>git log</c> command gives information about the commits that have been made to the active branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git branch main</c> - </p> - </statement> - <feedback> - <p> - The <c>git branch main</c> command will try to create a new branch with the name <c>main</c>. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - <c>git status</c> - </p> - </statement> - <feedback> - <p> - Correct! The <c>git status</c> command can be used to check which branch is active. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git switch main</c> - </p> - </statement> - <feedback> - <p> - The <c>git switch main</c> command will make <c>main</c> main the active branch, not check which branch is active. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Refer to <xref ref="subsec-git-status-command"/>. - </p> - </hint> - </task> - - <task xml:id="ex-switch-to-main-cmd" label="ex-switch-to-main-cmd"> - <statement> - <p> - If your active branch is not <c>main</c> which command could you use to make <c>main</c> the active branch? - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - <c>git log</c> - </p> - </statement> - - <feedback> - <p> - The <c>git log</c> command gives information about the commits that have been made to the active branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git branch main</c> - </p> - </statement> - <feedback> - <p> - The <c>git branch main</c> command will try to create a new branch with the name <c>main</c>. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - <c>git status</c> - </p> - </statement> - <feedback> - <p> - The <c>git status</c> command will give you information about the active branch, it does not switch branches. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - <c>git switch main</c> - </p> - </statement> - <feedback> - <p> - Correct! The <c>git switch main</c> command will make <c>main</c> the active branch. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Refer back to the section in the previous chapter on switching branches <xref ref="topic-switching-branches"/> - </p> - </hint> - </task> - - <task> - <statement> - <p> - Use the commands you have identified in the previous tasks to ensure that <c>main</c> is the active branch. Do not go on until your <c>main</c> branch is the active branch. - </p> - </statement> - </task> - - - </exercise> - - <exercise xml:id="ex-git-pull-cmd" label="ex-git-pull-cmd"> + <title /> + <exercise xml:id="ex-active-branch" label="ex-active-branch"> + <introduction> + The next step is to pull the changes to the <c>main</c> branch from the upstream repo to your local repo. + This section walks you through that process. + </introduction> + + + <task xml:id="ex-active-branch-a" label="ex-active-branch-a"> <statement> <p> - The command - <c>git pull <remote> <branch></c> - will pull any new commits from the specified branch in the remote repo and add them onto the end of the active branch of your local repo. - <c><branch></c> can be a name like <c>origin</c>. + To pull the changes from the upstream main branch into your local repo you first need to ensure that <c>main</c> is the active branch in your local repo. + Check the active branch in your local repo. + What command did you use? </p> + </statement> + + + <choices randomize="yes"> + <choice> + <statement> + <p> + <c>git log</c> + </p> + </statement> + + <feedback> + <p> + The <c>git log</c> command tells you the commits made to the active branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + <c>git branch main</c> + </p> + </statement> + + <feedback> + <p> + The <c>git branch main</c> command will create a new branch with the name <c>main</c>. + </p> + </feedback> + </choice> + + <choice correct="yes"> + <statement> + <p> + <c>git status</c> + </p> + </statement> + + <feedback> + <p> + Correct! The <c>git status</c> command tells you active branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + <c>git switch main</c> + </p> + </statement> + + <feedback> + <p> + The <c>git switch main</c> command will change the active branch to main, not check what is the active branch. + </p> + </feedback> + </choice> + </choices> + + <hint> <p> - Give a <c>git pull</c> command that will pull new commits from the <c>main</c> branch of the upstream repo and add them to your <c>main</c> branch. + Refer back to the section in the previous chapter on switching branches <xref ref="topic-switching-branches"/> </p> + </hint> + </task> + + + <task xml:id="ex-active-branch-b" label="ex-active-branch-b"> + <statement> <p> - <var width="45" /> + If your active branch in not the <c>main</c> branch change the active branch now. + What command changes the active branch to main? </p> </statement> - <setup> - <var> - <condition string="^git pull upstream main$"> - <feedback> - <p> - Correct. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Please give the full <c>git pull</c> command using the format indicated in the question. - Be sure not to leave in the < and > symbols. - Replace the words remote and branch with the appropriate names. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - - <exercise xml:id="ex-git-pull-doit" label="ex-git-pull-doit"> + + + <choices randomize="yes"> + <choice> + <statement> + <p> + <c>git log</c> + </p> + </statement> + + <feedback> + <p> + The <c>git log</c> command tells you the commits made to the active branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + <c>git branch main</c> + </p> + </statement> + + <feedback> + <p> + The <c>git branch main</c> command will create a new branch with the name <c>main</c>. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + <c>git status</c> + </p> + </statement> + + <feedback> + <p> + The <c>git status</c> command tells you active branch, it does not switch branches. + </p> + </feedback> + </choice> + + <choice correct="yes"> + <statement> + <p> + <c>git switch main</c> + </p> + </statement> + + <feedback> + <p> + Correct! The <c>git switch main</c> command will change the active branch to main. + </p> + </feedback> + </choice> + </choices> + + <hint> + <p> + Refer back to the section in the previous chapter on switching branches <xref ref="topic-switching-branches"/> + </p> + </hint> + </task> + + + <task xml:id="ex-active-branch-c" label="ex-active-branch-c"> <statement> <p> - Run the command from <xref ref="ex-git-pull-cmd"/> in the terminal and examine the output. + The command </p> + <p> - It should not contain any error messages. - If it does, look at the format of the command from <xref ref="ex-git-pull-cmd"/> and try again. + <c>git pull --ff-only <remote repo name> <branch></c> + </p> + + <p> + will pull any new commits from the specified branch in the remote repo and add them onto the end of the active branch of your local repo. + Use the <c>git pull</c> command above to pull and add the commits from the main branch of the upstream repo to your <c>main</c> branch. </p> + </statement> + </task> + + + <task xml:id="ex-active-branch-d" label="ex-active-branch-d"> + <statement> <p> - Which of the following appear in the output of the <c>git pull</c> command? + Examine the output from <xref ref="ex-active-branch-b"/>. + It should not contain any error messages. + If it does, return to <xref ref="ex-active-branch-b"/> and try again. + Which of the following is shown in the output of the <c>git pull</c> command? </p> </statement> + + <choices randomized="yes"> <choice correct="yes"> <statement> @@ -232,6 +200,7 @@ </p> </statement> </choice> + <choice correct="yes"> <statement> <p> @@ -239,6 +208,7 @@ </p> </statement> </choice> + <choice correct="yes"> <statement> <p> @@ -246,6 +216,7 @@ </p> </statement> </choice> + <choice correct="yes"> <statement> <p> @@ -253,6 +224,7 @@ </p> </statement> </choice> + <choice> <statement> <p> @@ -261,11 +233,13 @@ </statement> </choice> </choices> + <hint> <p> Make sure you look at all of the lines of output and the color coding of the lines. </p> </hint> - </exercise> + </task> + </exercise> </exercises> </section> diff --git a/source/ch-staying-synchronized/sec-pushing-main-to-your-origin.ptx b/source/ch-staying-synchronized/sec-pushing-main-to-your-origin.ptx index 5a6109f..ce8885f 100644 --- a/source/ch-staying-synchronized/sec-pushing-main-to-your-origin.ptx +++ b/source/ch-staying-synchronized/sec-pushing-main-to-your-origin.ptx @@ -4,120 +4,106 @@ <title>Pushing <c>main</c> to Your Origin - + <title /> + <exercise xml:id="ex-synching-main-to-origin" label="ex-synching-main-to-origin"> <introduction> <p> - Your local <c>main</c> branch is now in synch with the upstream <c>main</c> branch. However, the updates that you pulled into your local <c>main</c> branch are not yet in your origin repository. The exercises in this section will guide you the process of getting them there. + Your local main branch is now in synch with the upstream main branch. + What’s left is to also synch the main branch in your origin repo. </p> </introduction> - <exercise xml:id="ex-synching-main-to-origin-a" label="ex-synching-main-to-origin-a"> + + <task xml:id="ex-synching-main-to-origin-a" label="ex-synching-main-to-origin-a"> <statement> <p> Recall that you previously used the - <c> git push <remote> <branch> </c> - command to push your feature branch from your local repo to your origin repo. </p> + <p> - Give a <c>git push</c> command that will push the <c>main</c> branch of your local repo to your remote <c>origin</c> repo. + <c> git push <remote repo name> <branch> </c> </p> + <p> - <var width="45" /> + command to push your feature branch from your local repo to your origin repo. + Use the <c>git push</c> command to push the <c>main</c> branch of your local repo to your remote <c>origin</c> repo. </p> </statement> - <setup> <var> <condition string="^git push origin main$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string=".*"> + </task> - <feedback> - <p> - Please give the full <c>git push</c> command using the format indicated in the question. - Be sure not to leave in the < and > symbols. - Replace the words remote and branch with the appropriate names. - </p> - </feedback> - </condition> </var> </setup> - </exercise> - <exercise xml:id="ex-synching-main-to-origin-b" label="ex-synching-main-to-origin-b"> - <introduction> + <task xml:id="ex-synching-main-to-origin-b" label="ex-synching-main-to-origin-b"> + <statement> <p> - Run the <c>git push</c> command you wrote in <xref ref="ex-synching-main-to-origin-a"/> in the Terminal and examine the output. + Examine the output from <xref ref="ex-synching-main-to-origin-a"/>. + You should see a lot of information about deltas and objects. + Those are terms related to the inner workings of git that we will not worry about. + If you don’t see this information about deltas and objects but see an error message instead, revisit <xref ref="ex-synching-main-to-origin-a"/> and try again. </p> - </introduction> - <task xml:id="ex-synch-push-output-error"> - <statement> <p> - Examine the output from your <c>git push</c> command. - You should see a lot of information about <em>deltas</em> and <em>objects</em>. Those are terms related to the inner workings of Git that we will not worry about. + The last two lines of the output in part a should contain some recognizable information. + What do you think that these lines are telling you? </p> + </statement> + + + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + The URL of your origin on GitHub. + </p> + </statement> + </choice> + + <choice correct="yes"> + <statement> + <p> + The name of the branch pushed to GitHub. + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + The URL of the upstream repository on GitHub. + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + A list of all the files changed in the local repository. + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + A list of all the branches in the local repository. + </p> + </statement> + </choice> + </choices> + + <hint> <p> - If you don't see information about deltas and objects but see an error message instead, revisit <xref ref="ex-synching-main-to-origin-a"/> and try again. + Only look at the last two lines, the one that starts with "To" and the one that starts with a SHA code. </p> - </statement> - </task> - - <task xml:id="ex-synch-push-output-info" label="ex-synch-push-output-info"> - <statement> - <p> - The last two lines of the output should contain some recognizable information. What do you think that these lines are telling you? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The URL of your origin on GitHub. - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - The name of the branch that you pushed to GitHub. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - The URL of the upstream repository on GitHub. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - A list of all the files changed in the local repository. - </p> - </statement> - </choice> - <choice> - <statement> - <p> - A list of all the branches in the local repository. - </p> - </statement> - </choice> - </choices> - <hint> - <p> - Only look at the last two lines, the one that starts with "To" and the one that starts with a SHA code. - </p> - </hint> - </task> - </exercise> - </exercises> - - <p> - As with most things related to Git and GitHub, there are a number of different ways to synchronize. - For example, you can also fetch the changes from the upstream main to your origin and then pull them from there to your local repository. - If you are curious, you can check out this GitHub link: <url href="https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork" visual="https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork">Syncing a fork</url> - </p> + </hint> + </task> + </exercise> + <conclusion> + <p> + As with most things related to Git and GitHub, there are a number of different ways to synchronize. + For example, you can also fetch the changes from the upstream main to your origin and then pull them from there to your local repository. + If you are curious, you can check out this GitHub link: <url href="https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork" visual="https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork">Syncing a fork</url> + </p> + </conclusion> + </exercises> </section> diff --git a/source/ch-staying-synchronized/sec-understanding-changes-to-the-upstream-repository.ptx b/source/ch-staying-synchronized/sec-understanding-changes-to-the-upstream-repository.ptx index 7e43d3b..2f317cc 100644 --- a/source/ch-staying-synchronized/sec-understanding-changes-to-the-upstream-repository.ptx +++ b/source/ch-staying-synchronized/sec-understanding-changes-to-the-upstream-repository.ptx @@ -7,385 +7,243 @@ <p> If the upstream maintainers decide that the changes in your PR (pull request) are good for the project, they will merge them into the upstream <c>main</c> branch. That way they become a part of the main project, and everyone can benefit from your work. - In class your instructor played the role of a maintainer and demonstrated how the changes contained in pull requests are merged into the upstream. <xref ref="fig-changes-merged-into-upstream" /> shows the upstream with several new changes merged into it's <c>main</c> branch. + In class your instructor played the role of an upstream maintainer and demonstrated how the changes contained in pull requests are merged. </p> </introduction> <exercises> - <title /> - <p> - <xref ref="fig-changes-merged-into-upstream" /> illustrates the state after several commits have been merged into upstream <c>main</c>. - </p> + <title /> + <p> + <xref ref="fig-changes-merged-into-upstream" /> illustrates the state after several commits have been merged into upstream <c>main</c>. + </p> + + <p> + <figure xml:id="fig-changes-merged-into-upstream" > + <caption> Changes Merged into Upstream. </caption> + <image source="images/ch-staying-synchronized/changes-merged-into-upstream.png" width="75%"> + <description> + Cloud image of the changes merged into upstream. + </description> + </image> + </figure> + </p> + + <exercise xml:id="ex-merged-commits" label="ex-merged-commits"> + <introduction> + <p> + Answer the following questions using <xref ref="fig-changes-merged-into-upstream" /> + </p> + </introduction> + + + <task xml:id="ex-merged-commits-a" label="ex-merged-commits-a"> + <statement> + <p> + Which commits (give the colors) were merged into the upstream <c>main</c> since the contributor created the feature branch that is shown? + </p> + </statement> + + + <choices> + <choice> + <statement> + <p> + Red + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + Yellow + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + Green + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + Blue + </p> + </statement> + </choice> + + <choice correct="yes"> + <statement> + <p> + Pink + </p> + </statement> + </choice> + + <choice correct="yes"> + <statement> + <p> + Lime Green + </p> + </statement> + </choice> + </choices> + + <hint> + <p> + Look at which commits are new in upstream that are not part of the local repository's <c>main</c> or feature branch. + </p> + </hint> + </task> - <p> - <figure xml:id="fig-changes-merged-into-upstream" > - <caption> Changes Merged into Upstream. </caption> - <image source="images/ch-staying-synchronized/changes-merged-into-upstream.png" width="75%"> - <description> - Cloud image showing some changes merged into the upstream <c>main</c> branch. - </description> - </image> - </figure> - </p> - <exercise xml:id="ex-merged-commits" label="ex-merged-commits"> - <introduction> + <task xml:id="ex-merged-commits-b" label="ex-merged-commits-b"> + <statement> + <p> + Which of the commits did the managers merge from the contributor's pull request? + </p> + </statement> + + + <choices> + <choice> + <statement> + <p> + Red + </p> + </statement> + + <feedback> + <p> + Red was in <c>main</c> prior to the contributor creating the feature branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Yellow + </p> + </statement> + + <feedback> + <p> + Yellow was in <c>main</c> prior to the contributor creating the feature branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Green + </p> + </statement> + + <feedback> + <p> + Green was in <c>main</c> prior to the contributor creating the feature branch. + </p> + </feedback> + </choice> + + <choice correct="yes"> + <statement> + <p> + Blue + </p> + </statement> + + <feedback> + <p> + Blue was part of the contributor's feature branch. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Pink + </p> + </statement> + + <feedback> + <p> + Pink was part of another contributor's pull request. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Lime Green + </p> + </statement> + + <feedback> + <p> + Lime green was part of another contributor's pull request. + </p> + </feedback> + </choice> + </choices> + + <hint> + <p> + Look at which commits are in the local repository's feature branch. + </p> + </hint> + </task> + + + <task xml:id="ex-merged-commits-c" label="ex-merged-commits-c"> + <statement> + <p> + Briefly explain how the pink commit could have gotten into the upstream <c>main</c>. + </p> + </statement> + <response /> + </task> + </exercise> + + <exercise xml:id="ex-origin-main-behind-main" label="ex-origin-main-behind-main" > + <introduction> + GitHub will inform you when the active branch in your origin repo is out of synch with the upstream. + </introduction> + + + <task xml:id="ex-origin-main-behind-main-a" label="ex-origin-main-behind-main-a"> + <statement> <p> - Answer the following questions using <xref ref="fig-changes-merged-into-upstream" /> + Use your browser to visit your origin repo on GitHub and ensure that the <c>main</c> branch is selected. + Find the part of the page that indicates that your <c>main</c> branch is <em>behind</em> (i.e. + not the same as, or out of synch with) the upstream <c>main</c>. </p> - </introduction> - - <task xml:id="ex-merged-commits-a" label="ex-merged-commits-a"> - <statement> - <p> - Which commits (give the colors) were merged into the upstream <c>main</c> after the contributor created their local feature branch? - </p> - </statement> - <choices> - <choice> - <statement> - <p> - Red - </p> - </statement> - </choice> - <choice> - <statement> - <p> - Yellow - </p> - </statement> - </choice> - <choice> - <statement> - <p> - Green - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - Blue - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - Pink - </p> - </statement> - </choice> - <choice correct="yes"> - <statement> - <p> - Lime Green - </p> - </statement> - </choice> - </choices> - - <hint> - <p> - Look at which commits are in the upstream <c>main</c> branch that are not part of the local repository's <c>main</c> branch. - </p> - </hint> - </task> - - <task xml:id="ex-merged-commits-b" label="ex-merged-commits-b"> - <statement> - <p> - Which of the commits did the managers merge from the contributor's pull request? - </p> - </statement> - <choices> - <choice> - <statement> - <p> - Red - </p> - </statement> - <feedback> - <p> - Red was in <c>main</c> prior to the contributor creating the feature branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Yellow - </p> - </statement> - <feedback> - <p> - Yellow was in <c>main</c> prior to the contributor creating the feature branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Green - </p> - </statement> - <feedback> - <p> - Green was in <c>main</c> prior to the contributor creating the feature branch. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - Blue - </p> - </statement> - <feedback> - <p> - Correct. Blue was part of the contributor's feature branch. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Pink - </p> - </statement> - <feedback> - <p> - Pink was part of another contributor's pull request. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - Lime Green - </p> - </statement> - <feedback> - <p> - Lime green was part of another contributor's pull request. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look at which commits are in the local repository's feature branch. - </p> - </hint> - </task> - - - <task xml:id="ex-merged-commits-c" label="ex-merged-commits-c"> - <statement> - <p> - Which of the following statements explains how the pink commit might have gotten into the upstream <c>main</c> branch? - </p> - </statement> - - <choices randomize="yes"> - <choice> - <statement> - <p> - The contributor made the pink commit to their feature branch. - </p> - </statement> - <feedback> - <p> - The contributor's feature branch did not contain the pink commit. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - A maintainer merged the contributor's pull request. - </p> - </statement> - <feedback> - <p> - The contributor's pull request contained the blue commit, not the pink commit. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - A maintainer merged a pull request from another contributor which contained the pink commit. - </p> - </statement> - <feedback> - <p> - Correct. The pink commit was part of a feature branch that another contributor submitted via a pull request. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The pink commit is not part of the upstream <c>main</c>. - </p> - </statement> - <feedback> - <p> - The pink commit is part of the upstream <c>main</c>. - It was merged after the pull request that contained the blue commit. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Look at which commits are in the local repository's feature branch. - This shows the changes made by this contributor. - Other changes were made by other contributors and accepted by the maintainer as a pull request. - </p> - </hint> - </task> - </exercise> - - <exercise xml:id="ex-origin-main-behind-main" label="ex-origin-main-behind-main" > - <introduction> + </statement> + </task> + + <p> + If you do not see a message that your main branch is behind the upstream <c>main</c> branch go to <xref ref="topic-appendix-a-staying-synchronized" /> of this chapter and follow the instructions there. + Once you complete <xref ref="topic-appendix-a-staying-synchronized" />, return to <xref ref="ex-origin-main-behind-main" />. + </p> + + + <task xml:id="ex-origin-main-behind-main-b" label="ex-origin-main-behind-main-b"> + <statement> <p> - At this point the upstream <c>main</c> branch should have changes that are not contained in your origin and local <c>main</c> branches. That is, you <alert>are out of synch</alert> with the upstream. - - When your origin repository is out of synch with the upstream, GitHub will display a message that informs you. Let's investigate this message. + Briefly explain what has happened that caused your origin’s <c>main</c> branch to get <em>behind</em> the upstream <c>main</c>. </p> - </introduction> - - - <task xml:id="ex-origin-main-behind-main-a" label="ex-origin-main-behind-main-a"> - <statement> - <p> - Use your browser to visit your origin repo on GitHub and ensure that the <c>main</c> branch is selected. - </p> - <p> - Which of the following messages do you see that indicates that your origin's main branch is behind the upstream <c>main</c>? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - This branch is x commits behind <c>main</c>. - </p> - </statement> - <feedback> - <p> - Correct! Being behind means that the upstream <c>main</c> branch contains changes that your origin <c>main</c> branch does not. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - This branch is x commits ahead of <c>main</c>. - </p> - </statement> - <feedback> - <p> - Being ahead means that your origin <c>main</c> branch contains changes that are not in the upstream <c>main</c> branch. However, right now your origin <c>main</c> should be behind the upstream <c>main</c> branch. - </p> - <p> - <alert>You will need to fix this before continuing.</alert> Go to <xref ref="topic-appendix-a-staying-synchronized" /> of this chapter and follow the instructions there. Once you complete <xref ref="topic-appendix-a-staying-synchronized" />, return to this exercise. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - I do not see either of those messages. - </p> - </statement> - <feedback> - <p> - Seeing no message indicates that origin <c>main</c> branch is up to date with (i.e. identical to) the upstream <c>main</c> branch. - However, Right now your origin <c>main</c> should be behind the upstream <c>main</c> branch. - </p> - <p> - <alert>You will need to fix this before continuing.</alert> Go to <xref ref="topic-appendix-a-staying-synchronized" /> of this chapter and follow the instructions there. Once you complete <xref ref="topic-appendix-a-staying-synchronized" />, return to this exercise. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - You can find the relevant message in a box just below the branch name drop down near the top left of your origin's GitHub page. - </p> - </hint> - </task> - - <task xml:id="ex-origin-main-behind-main-b" label="ex-origin-main-behind-main-b"> - <statement> - <p> - Which of the following statements describes what could have happened to cause your origin's <c>main</c> branch to get behind the upstream <c>main</c>? - </p> - </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - Another contributor has made a pull request to the upstream for changes that they have made. - </p> - </statement> - - <feedback> - <p> - In order for this to affect the upstream <c>main</c> a maintainer would have to have merged their pull request. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - You have made a pull request to the upstream for a feature branch on which you have been working. - </p> - </statement> - <feedback> - <p> - In order for this to affect the upstream <c>main</c> a maintainer would have to have merged your pull request. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - You have committed changes to your local <c>main</c> branch and pushed it to your origin. - </p> - </statement> - <feedback> - <p> - Here your origin <c>main</c> branch would contain changes that are not in the upstream <c>main</c> branch, so your branch would be ahead, not behind. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - A maintainer merged a pull request and you have not yet updated your origin's <c>main</c> branch to include these changes. - </p> - </statement> - <feedback> - <p> - Correct. The manager merging the pull request will add changes to the upstream <c>main</c> branch that are not in your <c>main</c> branches. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Think about how changes may been added to the upstream <c>main</c> after you made your feature branch, and while you were working. - </p> - </hint> - </task> - </exercise> + </statement> + <response /> + </task> + </exercise> </exercises> </section> diff --git a/source/ch-staying-synchronized/sec-verifying-the-upstream-remote.ptx b/source/ch-staying-synchronized/sec-verifying-the-upstream-remote.ptx index 8a280da..3f75901 100644 --- a/source/ch-staying-synchronized/sec-verifying-the-upstream-remote.ptx +++ b/source/ch-staying-synchronized/sec-verifying-the-upstream-remote.ptx @@ -1,392 +1,285 @@ <?xml version="1.0" encoding="UTF-8"?> <section xml:id="topic-verifying-the-upstream-remote" xmlns:xi="http://www.w3.org/2001/XInclude" > - <title>Setting the Upstream Remote + Creating and Verifying the Upstream Remote + Verifying the Upstream Remote + + In order to pull changes from the upstream you will need to tell your local repository where the upstream is. + In earlier figures, dotted orange lines were used to indicate that your local repository knew about the origin and that the origin knew about the upstream. + But there was no orange dotted line from your local repository to the upstream. + That is because, by default, your local repository isn’t aware of the upstream. + - -

    - Before you will be able to pull changes from the upstream you will need to tell your local repository where the upstream is. - In earlier figures (e.g. ), there were dotted orange lines indicating that your local repository knew about your origin and that your origin knew about the upstream. - However, there was no orange dotted line from your local repository to the upstream. That is because, by default, your local repository isn’t aware of the upstream. -

    -

    - In a dotted orange line was added pointing from your local repository to the upstream. Git will need this information so that it can pull changes from the upstream into your local repository. In this section, you will be adding this information by setting the upstream remote. -

    + + When you open a fork in GitPod, GitPod clones its repository. + This creates a remote named origin that points to the repository it cloned. + When you clone a repository, this is typically the only remote created automatically. + But GitPod goes a step further. + It also creates upstream remote that points to the repository that your origin forked from. +

    + Like the last activity, you will be working within the KitClient for this activity. +

    + + + + <exercise xml:id="ex-restarting-kitclient-for-synching" label="ex-restarting-kitclient-for-synching"> + <p> + Restart your KitClient based on the instructions in <xref ref="topic-restarting-dev-env"/> + </p> + </exercise> - <subsection xml:id="topic-restarting-dev_environment-synch"> - <title>Restarting the Development Environment + + + To synchronize your fork, you will need to use this upstream remote. + First, let's confirm that GitPod correctly created the upstream remote. + This exercise will walk you through that process. + - -

    - Like prior chapters, you will be working within your development environment for this activity. -

    + + In order to pull from the upstream you will first need to make your local repository aware of the upstream. + This is done by setting a remote for it. + This exercise will walk you through that process. - - - <exercise xml:id="ex-restarting-kitclient-for-synching" label="ex-restarting-kitclient-for-synching"> + + <task xml:id="ex-setting-upstream-a" label="ex-setting-upstream-a"> + <statement> <p> - Click here to <url href="https://codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1" visual="codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1">open your development environment</url>. - Please be patient as this can take a few minutes. - When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following: - - <image source="images/shared-images/DevEnv-Kitty-Ready.png" width="75%"> - <description> - The GitKit Development Environment. - The development environment is ready when you see the "Kit development environment is ready for use" message. - </description> - </image> + The <c>git remote -v</c> command lists the names and URLs of all of the remote repositories (or just <term>remotes</term> for short) that your local repo knows about. + Run this command in the directory that contains your local repository. </p> - </exercise> - </exercises> - </subsection> + </statement> + </task> - <subsection xml:id="topic-understanding-remotes"> - <title>Understanding Remotes + + +

    + How is the origin remote indicated in represented in ? +

    +
    - -

    - A remote is a repository that is stored on GitHub, or another repository hosting sited. -

    -

    - A Git remote is the URL of a remote and an associated name (e.g. origin, upstream). Git uses Git remotes to locate remote repositories. Though it can be confusing, the remote is also commonly used as a synonym for Git remote. -

    -
    - - - - <exercise xml:id="ex-listing-remotes" label="ex-listing-remotes"> - <statement> - <p> - The <c>git remote -v</c> command lists the name and URL for all of the Git remotes associated with your local repository. - </p> - <p> - Be sure that you are in the directory containing your local repository and run the <c>git remote -v</c> command. - </p> - </statement> - </exercise> - - <exercise xml:id="ex-remotes-output" label="ex-remotes-output"> - <introduction> - <p> - Examine the output of the <c>git remote -v</c> command from <xref ref="ex-listing-remotes" />. You should see two lines labeled origin (fetch and pull), that both show the same URL. - </p> - </introduction> - - <task xml:id="ex-checking-the-origin-remote" label="ex-checking-the-origin-remote"> + <choices randomize="yes"> + <choice correct="yes"> <statement> <p> - Where does the URL for the origin remote point? + It is labeled as "origin". </p> </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - It points to the GitKit FarmData2 repository that your instructor created for the course. - </p> - </statement> - <feedback> - <p> - The repository that your instructor create is serving as the upstream repository. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - It points to your copy of the GitKit FarmData2 repository that you forked from the upstream. - </p> - </statement> - <feedback> - <p> - Correct! The origin is your fork that is contained in your GitHub space. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - It points to the repository for the live FarmData2 project. - </p> - </statement> - <feedback> - <p> - That repository would be the upstream if you were working on the live project. - </p> - </feedback> - </choice> - </choices> - <hint> + + <feedback> <p> - Look at the part of the origin remote's URL that comes after `github.com`. This part indicates where on GitHub the repository is located. Is it in your GitHub space? + Correct! The diagram shows your origin remote on the top left side with the label "origin". </p> - </hint> - </task> + </feedback> + </choice> - <task xml:id="ex-origin-in-figure" label="ex-origin-in-figure"> + <choice> <statement> <p> - What in <xref ref="fig-changes-merged-into-upstream" /> represents the origin Git remote that is associated with your local repository? + It is labeled as "upstream". </p> </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The dotted orange arrow on the left that points from your local repository to the origin. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The dotted orange arrow at the top that points from your origin repository to the upstream. - </p> - </statement> - <feedback> - <p> - The arrow at the top represents a Git remote associated with your origin repository, not your local repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The blue cylinder at the top left of the figure. - </p> - </statement> - <feedback> - <p> - The blue cylinders represent remote repositories. This question is asking about the Git remote. - </p> - </feedback> - </choice> - </choices> - <hint> + </choice> + + <choice> + <statement> <p> - Look at the diagram again. The origin Git remote will be associated with your local repo and will indicate where the origin repository is located. + It is labeled as "local". </p> - </hint> - </task> - </exercise> - </exercises> - </subsection> - - <subsection xml:id="topic-setting-the-upstream" label="topic-setting-the-upstream"> - <title>Adding the Upstream Remote - - -

    - Notice that the output from the git remote -v command did not include the location of the upstream repository. Thus, before you will be able to pull changes from the upstream into your local repository you will need to set the upstream remote. This will tell Git where the upstream repository is located. -

    -

    - The exercises in this section will walk you through the process of setting the upstream remote. -

    -
    + + - - - <exercise xml:id="ex-getting-upstream-url" label="ex-getting-upstream-url"> - <statement> - <p> - Use your browser to navigate to the GitHub page for the <em>upstream Gitkit FarmData2 repo</em> that you are using for this course. Hint: You can find the GitHub page for the upstream using the "forked from:" link at the top of the GitHub page for your origin repository. - </p> + <choice> + <statement> + <p> + It is labeled as "feature branch". + </p> + </statement> + </choice> + </choices> + + <hint> <p> - Once you find the GitHub page for the upstream, you can get its URL by clicking the “Code” button and using the "Local" tab. This URL will end in <c>.git</c>. + When you issued the <c>git remote -v</c> command pay attention to the name given to the fetch and pull URLs. </p> + </hint> + </task> + + + <task xml:id="ex-setting-upstream-b-vscode" label="ex-setting-upstream-b-vscode" component="vscode-kit-client"> + <statement> <p> - Enter the URL of the upstream GitKit FarmData2 you are using for your course below. + Confirm that <c>upstream</c> points to the upstream project on GitHub. + How did you confirm it? </p> + </statement> + <response /> + </task> + + + <task xml:id="ex-setting-upstream-c-linux" label="ex-setting-upstream-c-linux" component="linux-kit-client"> + <statement> <p> - <var width="45" /> + To create a new remote that tells your local repo about the upstream you will need the URL of the upstream repo. + Use your browser to navigate to the <em>upstream FarmData2 repo</em> that you are using for this course and give its URL here. + Hint: You can find the <c>upstream</c> using the link from your origin repo in GitHub. + Once you find the upstream, you can get the URL by using the “Code” button in the upstream repo, it ends in <c>.git</c>. </p> </statement> - <setup> - <var> - <condition string="^https://github\.com/(?!(FarmData2|DickinsonCollege)).+/.+\.git$"> - <feedback> - <p> - Looks good! But just to be sure, double check that this URL agrees with the one you gave in <xref ref="ex-upstream-url" />. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Be sure you are copying the URL of the upstream for your class as given by your instructor. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - - <exercise xml:id="ex-setting-upstream-remote" label="ex-setting-upstream-remote"> + <response /> + </task> + + + <task xml:id="ex-setting-upstream-d-linux" label="ex-setting-upstream-d-linux" component="linux-kit-client"> <statement> <p> - The <c>git remote</c> command you used to display the Git remotes is also used to add a new Git remote. + The git remote command can also be used to add a new remote to your local repo. + The format for this command is: </p> + <p> - The format for this command is: <c>git remote add <name> <URL></c> + <c> git remote add <remote repo name> <remote repo URL></c> </p> + <p> - Give a command that will create a new Git remote named <em>upstream</em> that points to the <em>GitKit FarmData2 upstream repository</em> that you are using for this course. + Use the above command to create a remote named <c>upstream</c> that points to the <em>FarmData2 upstream repository</em> that you are using for this exercise. </p> + </statement> + </task> + + + <task xml:id="ex-setting-upstream-e-linux" label="ex-setting-upstream-e-linux" component="linux-kit-client"> + <statement> <p> - <var width="65" /> + Use the <c>git remote -v</c> command to confirm that the new upstream remote has been added. </p> </statement> - <setup> - <var> - <condition string="^git remote add upstream https://github\.com/(?!(FarmData2|DickinsonCollege)).+/.+\.git$"> - <feedback> - <p> - Looks good! But just to be sure, double check that the URL you used agrees with the one you gave in <xref ref="ex-getting-upstream-url" />. - </p> - </feedback> - </condition> - <condition string=".*"> - <feedback> - <p> - Double check the format of your command and the URL that you are using. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - - <exercise xml:id="ex-checking-upstream-remote" label="ex-checking-upstream-remote"> + </task> + + + <task xml:id="ex-setting-upstream-f-linux" label="ex-setting-upstream-f-linux" component="linux-kit-client"> <statement> <p> - Use the <c>git remote -v</c> command. - What do you see that confirms that you have successfully added the upstream Git remote? + The upstream remote provides your local repo with the information it needs to find the upstream repo. + In git this information is represented using a URL. + How is this information represented in <xref ref="fig-changes-merged-into-upstream" />? </p> </statement> - <choices> - <choice> - <statement> - <p> - Two lines beginning with origin and giving the URL of the upstream repository. - </p> - </statement> - <feedback> - <p> - The lines beginning with <c>origin</c> are the origin remote and give the URL of your origin repository. - </p> - </feedback> - </choice> - <choice correct="yes"> - <statement> - <p> - Two lines beginning with upstream and giving the URL of the upstream repository. - </p> - </statement> - <feedback> - <p> - Correct! The URL of the upstream is where you will be pulling changes from. - </p> - </feedback> - </choice> - <choice> - <statement> - Neither of the above. - </statement> - <feedback> - <p> - One of the above answers is correct. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Think about the different between origin vs. - upstream. - </p> - </hint> - </exercise> - - - <exercise xml:id="ex-upstream-in-figure" label="ex-upstream-in-figure"> - <statement> - <p> - You just added the upstream Git remote to your local repository. How is this Git remote represented in <xref ref="fig-synching-with-upstream" />? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The dotted orange arrow on the right that points from your local repository to the upstream. - </p> - </statement> - <feedback> - <p> - Correct. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The dotted orange arrow on the left that points from your local repository to the origin. - </p> - </statement> - <feedback> - <p> - The arrow on the left represents the origin Git remote. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The dotted orange arrow at the top that points from your origin repository to the upstream. - </p> - </statement> - <feedback> - <p> - The arrow at the top represents a Git remote associated with your origin repository, not your local repository. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The blue cylinder at the top right of the figure. - </p> - </statement> - <feedback> - <p> - The blue cylinders represent remote repositories. This question is asking about the Git remote. - </p> - </feedback> - </choice> - </choices> - <hint> - <p> - Look at the diagram again. The upstream Git remote will be associated with your local repo and will indicate where the upstream repository is located. - </p> - </hint> - </exercise> - </exercises> - <p> - Note that you will only need to set the upstream remote once for a repository. - Once the upstream remote is set you will be able to pull from the upstream repo as often as is necessary. - </p> - </subsection> + <choices randomize="yes"> + <choice> + <statement> + <p> + It is labeled as "origin". + </p> + </statement> + </choice> + + <choice correct="yes"> + <statement> + <p> + It is labeled as "upstream". + </p> + </statement> + + <feedback> + <p> + Correct! The diagram shows your upstream remote on the top right side with the label "upstream". + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + It is labeled as "local". + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + It is labeled as "feature branch". + </p> + </statement> + </choice> + </choices> + + <hint> + <p> + When you issued the <c>git remote -v</c> command pay attention to the name given to second set of fetch and pull URLs. + </p> + </hint> + </task> + + + <task xml:id="ex-setting-upstream-c-vscode" label="ex-setting-upstream-c-vscode" component="vscode-kit-client"> + <statement> + <p> + The upstream remote provides your local repo with the information it needs to find the upstream repo. + In git this information is represented using a URL. + How is this information represented in <xref ref="fig-changes-merged-into-upstream" />? + </p> + </statement> + + + <choices randomize="yes"> + <choice> + <statement> + <p> + It is labeled as "origin". + </p> + </statement> + </choice> + + <choice correct="yes"> + <statement> + <p> + It is labeled as "upstream". + </p> + </statement> + + <feedback> + <p> + Correct! The diagram shows your upstream remote on the top right side with the label "upstream". + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + It is labeled as "local". + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + It is labeled as "feature branch". + </p> + </statement> + </choice> + </choices> + + <hint> + <p> + When you issued the <c>git remote -v</c> command pay attention to the name given to second set of fetch and pull URLs. + </p> + </hint> + </task> + </exercise> + <conclusion component="linux-kit-client"> + Note that you will only need to set the upstream remote once for a repository. + Once the upstream remote is set you will be able to pull from the upstream repo as often as is necessary. + </conclusion> + </exercises> </section> diff --git a/source/ch-upstreaming-changes/sec-committing-to-your-local-repository.ptx b/source/ch-upstreaming-changes/sec-committing-to-your-local-repository.ptx index 464b3fd..6c60936 100644 --- a/source/ch-upstreaming-changes/sec-committing-to-your-local-repository.ptx +++ b/source/ch-upstreaming-changes/sec-committing-to-your-local-repository.ptx @@ -59,13 +59,6 @@ Fix typo </p> </block> </blocks> - - <hint> - <p> - Commit messages should be as specific as possible regarding the changes made. - Something like "fix typo" is too generic as it can apply to lots of different changes. - </p> - </hint> </task> @@ -90,180 +83,33 @@ Extend harvest logs </p> </block> </blocks> - - <hint> - <p> - Commit messages should be as specific as possible regarding the changes made. - Which of the messages provides information about what is added and where? - </p> - </hint> </task> </exercise> <exercise xml:id="ex-committing-changes" label="ex-committing-changes"> - <statement> + <introduction> <p> The <c>git commit -m "<message>"</c> command commits all of the staged files to the currently active branch with the specified commit message. + Use the <c>git commit</c> command to commit your staged changes to your local repository with a meaningful commit message. </p> + </introduction> - <p> - Write a <c>git commit</c> command for the change you made in the space below. - Be sure to include a meaningful message. - </p> - - <p> - <var width="55" /> - </p> - </statement> - <setup> - <var> - <condition string='^git commit -m ["].+["]$'> - <feedback> - <p> - Thank you. - Your command is in the proper format, please make sure the commit message is meaningful. - </p> - </feedback> - </condition> - <condition string=".*"> - - <feedback> - <p> - Double check the format of your command. - </p> - </feedback> - </condition> - </var> - </setup> - </exercise> - <exercise xml:id="ex-committing-changes-new-a" label="ex-committing-changes-new-a"> - <statement> - <p> - Use the <c>git commit</c> command you wrote in <xref ref="ex-committing-changes"/> to commit your staged changes to your local repository with a meaningful commit message. - </p> + <task xml:id="ex-committing-changes-a" label="ex-committing-changes-a"> + <statement> + <p> + Provide the command you entered. + </p> + </statement> + <response /> + </task> - <p> - Look at the output produced. - </p> - </statement> - - - <choices randomize="yes"> - <choice> - <statement> - <p> - It shows the name of the file changed in the square brackets [ ]. - </p> - </statement> - - <feedback> - <p> - The first part of the first line is not the file name, take another look at the output. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - It shows the name of the feature branch that contains the change in the square brackets [ ]. - </p> - </statement> - - <feedback> - <p> - The first part of the first line is the feature branch name. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - It shows the SHA code of the commit in the square brackets [ ]. - </p> - </statement> - - <feedback> - <p> - The second part of the first line is the SHA code of the commit. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - It shows the commit message. - </p> - </statement> - - <feedback> - <p> - The last part of the first line is the commit message. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - It shows the number of files changed. - </p> - </statement> - - <feedback> - <p> - The first part of the second line is the number of files changed. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - It shows the number of lines inserted. - </p> - </statement> - - <feedback> - <p> - The second part of the second line is the number of lines inserted. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It shows every line that was inserted and/or deleted. - </p> - </statement> - - <feedback> - <p> - The output should not show the individual line changes, rather a summary of the changes. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - There should be two lines of output. - The first will provide 3 different pieces of information. - The second provides what additional information? - </p> - </hint> - </exercise> - <exercise xml:id="ex-committing-changes-new-ex" label="ex-committing-changes-new-ex"> <task xml:id="ex-committing-changes-b" label="ex-committing-changes-b"> <statement> <p> Now use the <c>git status</c> command again. - Compare your output to the output in <xref ref="ex-staging-changes-b"/>. + Compare your output to the output in <xref ref="ex-staging-changes-c" />. What two changes have occurred that reflect that your changes have been staged? </p> </statement> @@ -302,59 +148,16 @@ </statement> </choice> </choices> - <hint> - <p> - You have staged and committed all modified files. - </p> - </hint> </task> + <task xml:id="ex-committing-changes-c" label="ex-committing-changes-c"> <statement> <p> How do you know your changes have been committed? </p> </statement> - - <choices> - <choice correct="yes"> - <statement> - <p> - The <c>git commit</c> message showed a new SHA. - </p> - </statement> - </choice> - - <choice correct="yes"> - <statement> - <p> - The <c>git status</c> command does not show the files you modified for your change. - </p> - </statement> - </choice> - - <choice> - <statement> - <p> - The <c>git status</c> command shows your modified files in green. - </p> - </statement> - </choice> - - <choice> - <statement> - <p> - The <c>git commit</c> message says "no changes added to commit". - </p> - </statement> - </choice> - </choices> - - <hint> - <p> - There should be no modified files that are still staged and the <c>git commit</c> should have showed you the number of lines changed. - </p> - </hint> + <response /> </task> @@ -362,49 +165,12 @@ <statement> <p> Use the <c>git log</c> command to show the 3 most recent commits to your branch. - Refer back to your output from <xref ref="ex-understanding-project-history-new-aa"/>. + How is this output different from what you observed in Question #1? Briefly explain why? <term>Note: Question #1 is now a multiple choice question. + Maybe there should be multiple choice questions here that are similar (showing that the new commit appears in the log). + I'm not sure I understand this - Question #1 is a parson's question.</term> </p> </statement> - - - <choices> - <choice correct="yes"> - <statement> - <p> - The top commit shown is your latest commit. - </p> - </statement> - - </choice> - - <choice> - <statement> - <p> - The bottom commit shown is your latest commit. - </p> - </statement> - </choice> - - <choice> - <statement> - <p> - Your commit is not shown. - </p> - </statement> - - <feedback> - <p> - Feedback 3 - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - The log shows the latest commits first. - </p> - </hint> + <response /> </task> @@ -424,12 +190,6 @@ <c>git status</c> </p> </statement> - - <feedback> - <p> - <c>git status</c> shows what files have been changed and staged. - </p> - </feedback> </choice> <choice> @@ -438,12 +198,6 @@ <c>git stage main</c> </p> </statement> - - <feedback> - <p> - <c>git stage main</c> is not a proper command. - </p> - </feedback> </choice> <choice> @@ -452,12 +206,6 @@ <c>git branch main</c> </p> </statement> - - <feedback> - <p> - <c>git branch main</c> would try to create a new branch named <c>main</c>. - </p> - </feedback> </choice> <choice correct="yes"> @@ -466,110 +214,27 @@ <c>git switch main</c> </p> </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> </choice> </choices> - - <hint> - <p> - To change the active branch you need to switch to it. - </p> - </hint> </task> <task xml:id="ex-committing-changes-f" label="ex-committing-changes-f"> - <statement correct="no"> + <statement correct="yes"> <p> The output of the <c>git log</c> command now shows the information about the commit you made. </p> </statement> - - <hint> - <p> - What branch are you on, the <c>main</c> branch or your feature branch? In which branch did you make your changes? - </p> - </hint> </task> <task xml:id="ex-committing-changes-g" label="ex-committing-changes-g"> <statement> <p> - The commit is not shown in the <c>git log</c> output because: + Briefly explain how you know. </p> </statement> - - - <choices> - <choice correct="yes"> - <statement> - <p> - You are on the <c>main</c> branch and the commit is on the feature branch. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - You are on the feature branch and the commit is on the <c>main</c> branch. - </p> - </statement> - - <feedback> - <p> - You should be on the <c>main</c> branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The <c>git status</c> command should be used to show the commits. - </p> - </statement> - - <feedback> - <p> - The <c>git status</c> command is used to see what files have been changed and staged. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It only shows the first commit made, not every commit. - </p> - </statement> - - <feedback> - <p> - The <c>git log</c> command will show multiple commits with the most recent appearing first. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Commits are specific to branches. - You must be on the proper branch to see a commit. - </p> - </hint> + <response /> </task> </exercise> </exercises> diff --git a/source/ch-upstreaming-changes/sec-creating-a-feature-branch.ptx b/source/ch-upstreaming-changes/sec-creating-a-feature-branch.ptx index 28fac78..f616fb0 100644 --- a/source/ch-upstreaming-changes/sec-creating-a-feature-branch.ptx +++ b/source/ch-upstreaming-changes/sec-creating-a-feature-branch.ptx @@ -8,41 +8,23 @@ When you set out to make changes to the project you will do so by working on a feature branch. The exercises in this section will walk you through the process of creating a feature branch on which you will fix the issue that you claimed in <xref ref="topic-the-issue-tracker" />. </p> - - <p> - <xref ref="fig-create-feature-branch" /> illustrates this process. The feature branch that you will create is shown in orange. - </p> - - <p> - <figure xml:id="fig-create-feature-branch"> - <caption> Create Feature Branch. </caption> - <image source="images/ch-upstreaming-changes/create-feature-branch.png" width="75%"> - <description> - Cloud image of origin, upstream, and local branches. - </description> - </image> - </figure> - </p> </introduction> <exercises> <title/> - <exercise xml:id="ex-creating-a-branch" label="ex-creating-a-branch"> + <exercise xml:id="ex-git-status-command" label="ex-git-status-command"> <introduction> <p> - The <c>git branch <name></c> command creates a new branch with the given <em>name</em>. - When creating a branch, you should give it a short but descriptive name (e.g. - <em>FixTypoInReadme</em>). - Note: <em>name</em> may not have spaces, so you can use - (dashes) or CammelCaseText to divide words in your branch names. - Remember not to include the < > when writing your own command. + The <c>git status</c> command provides the current status of your local repository. + Use the <c>git status</c> command to see the current status of your local <em>GitKit-FarmData2</em> repository. </p> </introduction> - <task xml:id="ex-creating-a-branch-a" label="ex-creating-a-branch-a"> + <task xml:id="ex-git-status-command-a" label="ex-git-status-command-a"> <statement> <p> - If you want to create a new feature branch named <em>fixTypoInName</em>, which command should you use? + What part of the output tells you which branch is currently active in your repository? </p> </statement> @@ -51,13 +33,13 @@ <choice correct="yes"> <statement> <p> - <c>git branch fixTypoInName</c> + The branch name is displayed in the first line after "On branch". </p> </statement> <feedback> <p> - Correct! + Correct! The first line specifies the current branch. </p> </feedback> </choice> @@ -65,13 +47,14 @@ <choice> <statement> <p> - <c>git branch <fixTypoInName></c> + The branch name is displayed at the end of the second line. + It is "origin/main". </p> </statement> <feedback> <p> - The command should not contain < >. + The second line specifies the origin branch not the active branch. </p> </feedback> </choice> @@ -79,13 +62,13 @@ <choice> <statement> <p> - <c>branch fixTypoInName</c> + The branch name is not displayed in the output from this git command. </p> </statement> <feedback> <p> - The command is missing <c>git</c>. + Look again, the active branch is listed. </p> </feedback> </choice> @@ -93,13 +76,14 @@ <choice> <statement> <p> - <c>git fixTypoInName</c> + The branch name is displayed at the end of the last line. + It is "working tree". </p> </statement> <feedback> <p> - The command is missing <c>branch</c>. + The last line indicates if there are changes to commit. </p> </feedback> </choice> @@ -107,252 +91,104 @@ <hint> <p> - Look back at the format of the command in the previous description. + Look at the first line of the output from the <c>git status</c> command. </p> </hint> </task> - <task xml:id="ex-creating-a-branch-b" label="ex-creating-a-branch-b"> + <task xml:id="ex-git-status-command-b" label="ex-git-status-command-b"> <statement> <p> - Adapt the command from <xref ref="ex-creating-a-branch-a" /> to create a branch for the issue you claimed. - Type that command now. - </p> - - <p> - What output was produced when you typed the <c>git branch</c> command? + Your output should contain the text “Your branch is up to date with 'origin/main'.” What do you think it means that your branch is “up to date”? </p> </statement> + <response /> + </task> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - No output was provided. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It said the branch was created. - </p> - </statement> - - <feedback> - <p> - Look at the terminal window again. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It gave an error statement. - </p> - </statement> - - <feedback> - <p> - Your branch was not created. - Make sure your branch name does not contain spaces and < > - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The current branch is <branch name>. - </p> - </statement> - - <feedback> - <p> - Look at the terminal window again. - </p> - </feedback> - </choice> - </choices> - - <hint> + <task xml:id="ex-git-status-command-c" label="ex-git-status-command-c"> + <statement> <p> - Look back at the format of the command and make sure you type it correctly. + Your output should contain the text “nothing to commit, working tree clean.” What do you think it means that you have “nothing to commit.” Hint: when would you have something to commit? This is the opposite of that! </p> - </hint> + </statement> + <response /> </task> </exercise> - <exercise xml:id="ex-checking-a-branch" label="ex-checking-a-branch"> + <exercise xml:id="ex-creating-a-branch" label="ex-creating-a-branch"> <introduction> <p> - The <c>git branch</c> command without the branch name lists all branches. + The <c>git branch <name></c> command creates a new branch with the given <em>name</em>. + When creating a branch, you should give it a short but descriptive name (e.g. + <em>FixTypoInReadme</em>). + Note: <em>name</em> may not have spaces, so you can use - (dashes) or CammelCaseText to divide words in your branch names. </p> </introduction> - <task xml:id="ex-checking-a-branch-a" label="ex-checking-a-branch-a"> + <task xml:id="ex-creating-a-branch-a" label="ex-creating-a-branch-a"> <statement> <p> - Type <c>git branch</c> and look at the output produced. - Which of the following do you see listed? + <p> + Create a new feature branch with a descriptive name that you will use to fix the issue that you claimed. + Remember not to include the < > when writing your own command. + Type the command you entered below. + </p> </p> </statement> + <response /> + </task> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>main</c> - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - <c>name</c> which is the name of your feature branch - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git</c> - </p> - </statement> - - <feedback> - <p> - <c>git</c> is a command and should not be your branch name - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c><name></c> which is the name of your feature branch - </p> - </statement> + <task xml:id="ex-creating-a-branch-b" label="ex-creating-a-branch-b"> + <statement correct="no"> + <p> + Use the <c>git status</c> command again now. + </p> + <p> + Creating a new branch with the <c>git branch</c> command makes your new branch the active branch. + </p> + </statement> - <feedback> - <p> - The branch name should not have < >. - </p> - </feedback> - </choice> - </choices> + <feedback> + <p> + <c>git branch <name></c> only creates the branch. + </p> + </feedback> <hint> <p> - If you don't see your branch name it means it was not created. - Try creating it again using the format of the command from <xref ref="ex-creating-a-branch-a"/>. + After you create a branch what needs to be done to make it active? </p> </hint> </task> - - <task xml:id="ex-checking-a-branch-b" label="ex-checking-a-branch-b"> + <task xml:id="ex-creating-a-branch-c" label="ex-creating-a-branch-c"> <statement> <p> - By looking at the output provided by <c>git branch</c> how can you tell which is the active branch? + How can you tell from the output in <xref ref="ex-creating-a-branch-b" /> if it switched you to the new branch? </p> </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - It will have an * before the branch name. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - The branch name will appear in green. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The branch name will appear in italics. - </p> - </statement> - - <feedback> - <p> - Look at the output provided in the terminal window again. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The branch name will appear in bold. - </p> - </statement> - - <feedback> - <p> - Look at the output provided in the terminal window again. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - There are two ways the active branch is indicated. - </p> - </hint> + <response /> </task> </exercise> <p> - Refer back to <xref ref="fig-create-feature-branch"/> to see the process you just completed. + <xref ref="fig-create-feature-branch" /> illustrates the process you just completed to create a feature branch. The feature branch created is shown in orange. + </p> + + <p> + <figure xml:id="fig-create-feature-branch"> + <caption> Create Feature Branch. </caption> + <image source="images/ch-upstreaming-changes/create-feature-branch.png" width="75%"> + <description> + Cloud image of origin, upstream, and local branches. + </description> + </image> + </figure> </p> + </exercises> </section> diff --git a/source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx b/source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx index 96595c4..9dbc983 100644 --- a/source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx +++ b/source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx @@ -87,13 +87,43 @@ The questions in this exercise will help you to better understand what this information means. </p> </introduction> - + + + <task xml:id="ex-pull-request-b-i" label="ex-pull-request-b-i"> + <introduction> + <p> + Copy the URLs from the gray bar into the textboxes below. + </p> + </introduction> + + + <task xml:id="ex-pull-request-b-i-a" label="ex-pull-request-b-i-a"> + <statement> + <p> + Base Repository + </p> + </statement> + <response /> + </task> + + + <task xml:id="ex-pull-request-b-i-b" label="ex-pull-request-b-i-b"> + <statement> + <p> + Head Repository + </p> + </statement> + <response /> + </task> + </task> + + <task xml:id="ex-pull-request-b-ii" label="ex-pull-request-b-ii"> <statement> <p> - The terms “Base Repository” and “Head Repository” are generic labels that GitHub uses for the two repositories that are involved in the pull request. + The terms “Base Repository” and “Head Repository” in <xref ref="ex-pull-request-b-i"/> are generic labels that GitHub uses for the two repositories that are involved in the pull request. Often, and in our case, these two repositories will be your origin repository and the project's upstream repository. - Match the right hand column with either head repository or base repository to indicate which term refers to your origin and which refers to the upstream. + Examine the URL's from <xref ref="ex-pull-request-b-i"/> and match the right hand column with either head repository or base repository to indicate which term refers to your origin and which refers to the upstream. </p> </statement> <matches> <match> @@ -118,7 +148,7 @@ Match the right hand column with either base branch or compare branch to indicate which is “pulled from” or “merged into”. </p> </statement> - <matches> <match> + <!-- part of this original question has been omitted regarding the names of the branches --> <matches> <match> <premise> <c>base branch</c></premise> <response>merged into</response> </match> <match> <premise> @@ -126,7 +156,7 @@ <hint> <p> The base is where you want your changes merged into. - The compare is where your changes are being pulled from. + The head is where your changes are being pulled from. </p> </hint> </task> @@ -179,7 +209,7 @@ </p> <p> - The #123 part of the line should automatically become a link to the issue. + The #123 part of the line should automatically become a link to the ticket. If it does not, check to be sure you have entered the information exactly as shown above. </p> </statement> @@ -189,7 +219,7 @@ <task xml:id="ex-pull-request-finish-d" label="ex-pull-request-finish-d"> <statement> <p> - Check the status of your PR and confirm that it can be merged automatically. + Check that status of your PR and confirm that it can be merged automatically. The status will be listed at the top of the GitHub page below the image from <xref ref="ex-pull-request-b"/> </p> </statement> @@ -234,30 +264,12 @@ <p> <var width="55" /> </p> + <!-- THIS NEEDS TO BE UPDATED WITH FEEDBACK AND A REGULAR EXPRESSION TO MAKE SURE THE STUDENT IS IN THE UPSTREAM REPOSITORY --> </statement> - <setup> <var> <condition string='^https://github.com/(?!(FarmData2/FarmData2|DickinsonCollege/FarmData2))(.+/.+)/pull/[0-9]+$'> - <feedback></feedback> - </condition> <condition string=".*"> - - <feedback> - <p> - The upstream repository is the repository you forked from. - Double check that you aren't in your origin repository. - </p> - </feedback> - </condition> </var> </setup> - - <hint> - <p> - In GitHub look at the top left side of the browser window. - If it says "forked from" with a link it means you are in your fork instead of the upstream repository. - Click that link to go to the upstream repository. - </p> - </hint> </exercise> <exercise xml:id="ex-pull-request-files" label="ex-pull-request-files"> - <statement> + <introduction> <p> On your pull request page there will be “Files Changed” tab: </p> @@ -277,8 +289,13 @@ It also indicates the changes you have made. The project maintainers will often use this diff to see the details of what you have changed. </p> + </introduction> + + + <task xml:id="ex-pull-request-files-a" label="ex-pull-request-files-a"> + <statement> <p> - Which of the following describes how the diff indicates the changes that you made? + Briefly describe how the diff indicates the changes that you made. </p> </statement> @@ -292,12 +309,6 @@ The change(s) appear in both in bold. </p> </statement> - - <feedback> - <p> - Correct! You can see the changes by comparing the red and green lines. - </p> - </feedback> </choice> <choice> @@ -306,12 +317,6 @@ The line(s) which contains the change(s) appears once in red. </p> </statement> - - <feedback> - <p> - The red only shows what is being deleted. - </p> - </feedback> </choice> <choice> @@ -320,12 +325,6 @@ The line(s) which contains the change(s) appears once in green. </p> </statement> - - <feedback> - <p> - The green only shows what is being inserted. - </p> - </feedback> </choice> <choice> @@ -334,21 +333,9 @@ Only the changed word(s) appear with the old in strike through and the new next to it. </p> </statement> - - <feedback> - <p> - GitHub doesn't use strike through to indicate changes. - </p> - </feedback> </choice> </choices> - - <hint> - <p> - The diff command will color code the changes. - Lines that are changed will show both the original line and the updated line. - </p> - </hint> - </exercise> - </exercises> - </section> + </task> + </exercise> + </exercises> +</section> diff --git a/source/ch-upstreaming-changes/sec-editing-local-files.ptx b/source/ch-upstreaming-changes/sec-editing-local-files.ptx index a163621..5024c9f 100644 --- a/source/ch-upstreaming-changes/sec-editing-local-files.ptx +++ b/source/ch-upstreaming-changes/sec-editing-local-files.ptx @@ -7,7 +7,6 @@ <p> In the last two sections you created a feature branch and switched to that branch. In this section you will edit your local files to fix the issue that you claimed in the issue tracker. - Confirm you are on your feature branch now. </p> </introduction> @@ -20,80 +19,42 @@ </p> <p> - Provide the URL to the issue that you claimed in the issue tracker. + Provide a link to the issue that you claimed in the issue tracker. </p> <p> <var width="55" /> </p> </statement> - <setup> <var> <condition string="^https://github.com/.+/issues/\b([1-9]|[12][0-9]|3[0-5])\b$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string=".*"> - - <feedback> - <p> - Make sure you have pasted the complete URL starting with https and ending with the issue number. - </p> - </feedback> - </condition> </var> </setup> + <!-- THIS NEEDS TO BE UPDATED WITH FEEDBACK AND A REGULAR EXPRESSION TO MAKE SURE THE STUDENT IS IN THE ISSUE TRACKER --> </exercise> <exercise xml:id="ex-locate-claimed-issue" label="ex-locate-claimed-issue"> <introduction> <p> Read the issue that you claimed. - To make the requested change you will need to open the file. - Click <em><Code></em> to see the files in the repository. - Use the issue to locate the file. - Once you have found it, click on it to open it. </p> </introduction> - <statement> - <p> - In which file will you be making changes to address your issue? Hint: Look at the text of your issue in the issue tracker. - Be careful to use the same capitalization as given in the issue. - </p> - <p> - <var width="55" /> - </p> - </statement> - <setup> <var> <condition string="^ONBOARDING.md|CONTRIBUTING.md|INSTALL.md|README.md$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> <condition string=".*"> + <task xml:id="ex-locate-claimed-issue-a" label="ex-locate-claimed-issue-a"> + <statement> + <p> + In which file will you be making changes to address your issue? Hint: Look at the text of your issue in the issue tracker. + </p> + </statement> + <response /> + </task> - <feedback> - <p> - Double check the spelling of the file name, that the name is ALL CAPS, the .md at the end of the file name is included and in lower case. - </p> - </feedback> - </condition> </var> </setup> - </exercise> - <exercise xml:id="ex-locate-claimed-issue-b" label="ex-locate-claimed-issue-b"> - <statement> - <p> - Use a text editor to modify the file you identified in <xref ref="ex-locate-claimed-issue" /> so that the issue you claimed has been fixed. - </p> - <p> - Find the file in the <em>Explorer</em> pane to the left. This should show you the list of all the files and folders in the project. If you do not see the list of files and folders, click on the icon that looks like one sheet of paper on top of another. - </p> - <p> - Open the file in the editor and make the changes in the issue you claimed. - </p> - <p> - Your changes should be automatically saved. - </p> - </statement> + + <task xml:id="ex-locate-claimed-issue-b" label="ex-locate-claimed-issue-b"> + <statement> + <p> + Use a text editor to modify the file you identified in <xref ref="ex-locate-claimed-issue-a" /> so that the issue you claimed has been fixed. + Be sure to save your changes. + </p> + </statement> + </task> </exercise> <p> @@ -119,24 +80,20 @@ </p> <p> - If you see the message "nothing to commit, working tree clean", it means that your edits in the previous exercise were not saved. + What does the output tell you about the current status of the repository? If you see the message "nothing to commit, working tree clean", it means that your edits in the previous exercise were not saved. Go back and save your edits and then issue the <c>git status</c> command again before answering the questions below. </p> </introduction> - <task xml:id="ex-verify-changes-new-a" label="ex-verify-changes-new-a"> + <task xml:id="ex-verify-changes-a" label="ex-verify-changes-a"> <statement> + <!-- <p> - Paste the output of the <c>git status</c> command below. + What two things does the output tell you about the file that you edited? If you see the message “nothing to commit, working tree clean,” it means that your edits in the previous exercise were not saved. + <term>NOTE: may want to change this so that it asks which files are staged, untracked, etc.</term> Go back and save your edits and then issue the <c>git status</c> command again before describing the two things that the output tells you. </p> - </statement> - <response /> - </task> - - - <task xml:id="ex-verify-changes-a" label="ex-verify-changes-a"> - <statement> + --> <p> How many files are not staged? </p> @@ -168,7 +125,7 @@ <feedback> <p> - Correct! The file you changed has been modified but not staged yet. + Correct! The file you changes has been modified but not staged yet. </p> </feedback> </choice> @@ -213,7 +170,7 @@ <task xml:id="ex-verify-changes-b" label="ex-verify-changes-b"> <statement> <p> - How many files will be committed? + How many files are added to the commit? </p> </statement> @@ -242,7 +199,7 @@ <feedback> <p> - Unless you already issued the <c>git stage</c> command you shouldn't have any files ready to be committed. + Unless you already issued the <c>git add</c> command you shouldn't have any files ready to be committed. </p> </feedback> </choice> @@ -285,84 +242,89 @@ </exercise> <exercise xml:id="ex-verify-changes-with-diff" label="ex-verify-changes-with-diff"> - <statement> + <introduction> <p> The <c>git diff</c> command provides another way to examine or confirm the changes you have been making. Note <em>diff</em> is just short for <em>difference</em>, and is called this because it is used to show differences. - By default the <c>git diff</c> command will show you any changes that have been made to your local files that have not yet been staged. + By default the <c>git diff</c> command will show you any changes that have been made to your local files as compared to the version in the most recent commit in the active branch. Run the <c>git diff</c> command now. </p> + </introduction> - <p> - How is the change that you made indicated in the output from <c>git diff</c>? - </p> - </statement> + <task xml:id="ex-verify-changes-with-diff-a" label="ex-verify-changes-with-diff-a"> + <statement> + <p> + How is the change that you made indicated in the output from <c>git diff</c>? + </p> + </statement> - <choices randomize="yes"> - <choice> - <statement> - <p> - The new text is in red, the old text is in green. - </p> - </statement> - - <feedback> - <p> - Look again to see what color your change appears in. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - The new text is in green, the old text is in red. - </p> - </statement> - - <feedback> - <p> - Correct! The original text is in red, your changes are in green. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - Only the new text appears. - </p> - </statement> - - <feedback> - <p> - Look again, you should see the original text as well. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The old text appears with a strike-through line across it. - </p> - </statement> - - <feedback> - <p> - Strike-through is not part of the feedback git commands can provide. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Look at the feedback again and look for your change. - Do you also see the original text? - </p> - </hint> + + <choices randomize="yes"> + <choice> + <statement> + <p> + The new text is in red, the old text is in green. + </p> + </statement> + + <feedback> + <p> + Look again to see what color your change appears in. + </p> + </feedback> + </choice> + + <choice correct="yes"> + <statement> + <p> + The new text is in green, the old text is in red. + </p> + </statement> + + <feedback> + <p> + Correct! The original text is in red, your changes are in green. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + Only the new text appears. + </p> + </statement> + + <feedback> + <p> + Look again, you should see the original text as well. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + The old text appears with a strike-through line across it. + </p> + </statement> + + <feedback> + <p> + Strike-through is not part of the feedback git commands can provide. + </p> + </feedback> + </choice> + </choices> + + <hint> + <p> + Look at the feedback again and look for your change. + Do you also see the original text? + </p> + </hint> + </task> </exercise> </exercises> </section> diff --git a/source/ch-upstreaming-changes/sec-exploring-your-local-repository.ptx b/source/ch-upstreaming-changes/sec-exploring-your-local-repository.ptx index e7cae19..5297f7b 100644 --- a/source/ch-upstreaming-changes/sec-exploring-your-local-repository.ptx +++ b/source/ch-upstreaming-changes/sec-exploring-your-local-repository.ptx @@ -5,190 +5,71 @@ <introduction> <p> - Like in the previous chapter, you will be working within the development environment for this exercise. - </p> - - <p> - <term> Current State: </term> - </p> - - <p> - <xref ref="fig-fork-and-clone-local" /> shows where you should be based upon the exercises in the previous chapter. You will have forked the upstream FarmData2 repository into your own GitHub account. You will then have cloned your fork into a local repository in the development environment. Your local files at this point are a copy that reflects the current state of the upstream <c>main</c> branch. - </p> - - <p> - Let's explore this state just a little before making the changes that address the issue that you have claimed. - </p> - - <p> - <figure xml:id="fig-fork-and-clone-local"> - <caption> Fork, Clone and Local Files. </caption> - <image source="images/ch-upstreaming-changes/fork_clone_local_files.png" width="75%"> - <description> - Cloud image of fork, clone, and local files. - </description> - </image> - </figure> + Like in the previous chapter, you will be working within the KitClient for this exercise. </p> </introduction> + <p> + <term> Current State: </term> + </p> - <subsection xml:id="subsec-restarting-development-environment"> - <title>Restarting the Development Environment +

    + shows where you should be based upon the exercises in the previous chapter. You will have forked the upstream FarmData2 repository into your own GitHub account. You will then have cloned your fork into a local repository on your computer. Your local files at this point are a copy that reflects the current state of the upstream main branch. +

    - -

    -

    -
    +

    + Let's explore this state just a little before making the changes that address the issue that you have claimed. +

    - - - <exercise xml:id="ex-restarting-kitclient-for-upstreaming" label="ex-restarting-kitclient-for-upstreaming"> - <p> - Click here to <url href="https://codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1" visual="codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1">open your development environment</url>. - Please be patient as this can take a few minutes. - When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following: <image source="images/shared-images/DevEnv-Kitty-Ready.png" width="75%"> + <p> + <figure xml:id="fig-fork-and-clone-local"> + <caption> Fork, Clone and Local Files. </caption> + <image source="images/ch-upstreaming-changes/fork_clone_local_files.png" width="75%"> <description> - The GitKit Development Environment. - The development environment is ready when you see the "Kit development environment is ready for use" message. + Cloud image of fork, clone, and local files. </description> </image> - </p> - </exercise> - </exercises> -</subsection> - - -<subsection xml:id="subsec-git-log-command"> - <title><c>git log</c> +
  • +

    - + + + <exercise xml:id="ex-restarting-kitclient" label="ex-restarting-kitclient"> <p> - The <c>git log</c> command provides a way to see information about the history of the project. - It will display information about the most recent commits that have been made to the repository. - By default, <c>git log</c> displays information about the 10 most recent commits. - You can append a -2 (or -5) to show only the most recent 2 (or 5) commits. + Restart your KitClient based on the instructions in <xref ref="topic-restarting-dev-env" />. </p> - </introduction> - - <exercises> - <title /> - <exercise xml:id="ex-understanding-project-history-new" label="ex-understanding-project-history-new"> - <task xml:id="ex-understanding-project-history-new-a" label="ex-understanding-project-history-new-a"> - <statement> - <p> - Which of the following commands will provide the four most recent commits? - </p> - </statement> - - - <choices randomize="yes"> - <choice> - <statement> - <p> - <c>git log</c> - </p> - </statement> - - <feedback> - <p> - This will provide information about the 10 most recent commits, not just the first four. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git log 4</c> - </p> - </statement> - - <feedback> - <p> - This is not the proper format, a symbol is missing before the 4. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - <c>git log -4</c> - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git log +4</c> - </p> - </statement> - - <feedback> - <p> - The symbol before the 4 is incorrect. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Refer back to the beginning of this subsection for specifics about the <c>git log</c> command. - </p> - </hint> - </task> - - - <task xml:id="ex-understanding-project-history-new-aa" label="ex-understanding-project-history-new-aa"> - <statement> - <p> - Ensure that you are in your cloned repo (i.e. - the <em>GitKit-FarmData2</em> directory is your working directory). - Then use the <c>git log</c> command from <xref ref="ex-understanding-project-history-new-a"/> to display the information about the 4 most recent commits. - (If you don't see all four recent commits, press "return" or "spacebar" to see more; when you are done, press "q" to quit.) - </p> + </exercise> - <p> - A line that begins with "commit" appears at the start of the information about each commit. - That line also contains a long string of numbers and letters. - That string is called the <term>SHA (secure hashing algorithm)</term> hash. - It is a string of digits (0-9) and letters (a-f) known as a hexadecimal number and it provides a unique identifier for the commit. - Following the SHA hash is information about the author, the date the commit was made and the commit message that was used to describe the changes. - </p> + <p> + The <c>git log</c> command provides a way to see information about the history of the project. + It will display information about the most recent commits that have been made to the repository. + By default, <c>git log</c> displays information about the 10 most recent commits. + You can append a -2 (or -5) to show only the most recent 2 (or 5) commits. + </p> - <p> - Paste the output of the <c>git log</c> command you typed in the space below. - </p> - </statement> - <response/> - </task> - </exercise> - </exercises> -</subsection> + <exercise xml:id="ex-understanding-project-history" label="ex-understanding-project-history"> + <introduction> + <p> + Ensure that you are in your cloned repo (i.e. + the <em>GitKit-FarmData2</em> directory is your working directory). + Then use the <c>git log</c> command to display the information about the 4 most recent commits. + (If you don't see more all four recent commits, press "return" or "spacebar" to see more; when you are done, press "q" to quit.) + </p> + <p> + A line that begins with "commit" appears at the start of the information about each commit. + That line also contains a long string of numbers and letters. + That string is called the <term>SHA (secure hashing algorithm)</term> hash. + It is a string of digits (0-9) and letters (a-f) known as a hexadecimal number and it provides a unique identifier for the commit. + Following the SHA hash is information about the author, the date the commit was made and the commit message that was used to describe the changes. + </p> -<subsection xml:id="subsec-understanding-git-log-output"> - <title>Reviewing the <c>git log</c> Output +

    + Use the output from the git log command to answer the following questions about the project history. Note, if you have started this exercise late, new commits may have been added. If so, you will need to look at more than the 5 most recent commits to answer the question. +

    +
    - -

    - Use the output from the to answer the following questions about the project history. - Note, if you have started this exercise late, new commits may have been added. -

    -
    - - - <exercise xml:id="ex-understanding-project-history" label="ex-understanding-project-history"> <task xml:id="ex-understanding-project-history-a" label="ex-understanding-project-history-a"> <statement> <p> @@ -257,13 +138,11 @@ <hint> <p> - Look at the dates of each commit. - The SHA code appears above the author of the commit and date the commit was made. + Look at the dates of each commit. The SHA code appears above the author of the commit and date the commit was made. </p> </hint> </task> - <task xml:id="ex-understanding-project-history-b" label="ex-understanding-project-history-b"> <statement> <p> @@ -271,7 +150,6 @@ </p> </statement> - <choices randomize="yes"> <choice> <statement> @@ -324,7 +202,7 @@ <feedback> <p> - There is a more recent commit. + There is a more recent commit. </p> </feedback> </choice> @@ -337,7 +215,6 @@ </hint> </task> - <task xml:id="ex-understanding-project-history-c" label="ex-understanding-project-history-c"> <statement> <p> @@ -345,7 +222,6 @@ </p> </statement> - <choices randomize="yes"> <choice correct="yes"> <statement> @@ -411,15 +287,13 @@ </hint> </task> - <task xml:id="ex-understanding-project-history-d" label="ex-understanding-project-history-d"> <statement> <p> - What is the purpose of the most recent commit by Elad Sheskin (username: shes-dev)? + What is the purpose of the most recent commit by shes-dev? </p> </statement> - <choices randomize="yes"> <choice correct="yes"> <statement> @@ -497,255 +371,8 @@ This commit is older than the others, try a <c>git log</c> command that shows a few more commits. </p> </hint> - </task> - </exercise> - </exercises> -</subsection> - - -<subsection xml:id="subsec-git-status-command"> - <title><c>git status</c> - - -

    - The git status command provides the current status of your local repository. - Use the git status command to see the current status of your local GitKit-FarmData2 repository. -

    -
    - - - - <exercise xml:id="ex-git-status-command" label="ex-git-status-command"> - <task xml:id="ex-git-status-command-a" label="ex-git-status-command-a"> - <statement> - <p> - What part of the output tells you which branch is currently active in your repository? - </p> - </statement> - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The branch name is displayed in the first line after "On branch". - </p> - </statement> - - <feedback> - <p> - Correct! The first line specifies the current branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The branch name is displayed at the end of the second line. - It is "origin/main". - </p> - </statement> - - <feedback> - <p> - The second line specifies the origin branch not the active branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The branch name is not displayed in the output from this git command. - </p> - </statement> - - <feedback> - <p> - Look again, the active branch is listed. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The branch name is displayed at the end of the last line. - It is "working tree". - </p> - </statement> - - <feedback> - <p> - The last line indicates if there are changes to commit. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Look at the first line of the output from the <c>git status</c> command. - </p> - </hint> - </task> - - - <task xml:id="ex-git-status-command-b" label="ex-git-status-command-b"> - <statement> - <p> - Your output should contain the text “Your branch is up to date with 'origin/main'.” What do you think it means that your branch is “up to date”? - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - It means that your branch contains all of the commits in the origin <c>main</c> branch. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It means that the origin <c>main</c> branch contains all of the commits in your local branch. - </p> - </statement> - - <feedback> - <p> - Think about what is being compared in that statement. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It means that your branch contains all of the issues in the origin <c>main</c> branch. - </p> - </statement> - - <feedback> - <p> - Issues are not part of a branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It means that the origin <c>main</c> branch contains all of the issues in your branch. - </p> - </statement> - - <feedback> - <p> - Issues are not part of a branch. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Think about what could be "out of date". - What differences might there be between the origin <c>main</c> and your branch? - </p> - </hint> - </task> - - - <task xml:id="ex-git-status-command-c" label="ex-git-status-command-c"> - <statement> - <p> - Your output should contain the text “nothing to commit, working tree clean.” What do you think it means that you have “nothing to commit.” - </p> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - It means that you haven't made any changes. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It means that you haven't created any issues. - </p> - </statement> - - <feedback> - <p> - Issues aren't part of a branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It means you haven't made any branches. - </p> - </statement> - - <feedback> - <p> - Branches aren't committed. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It means the origin <c>main</c> branch doesn't have any changes. - </p> - </statement> - - <feedback> - <p> - This statement is referring to your local branch, not origin <c>main</c>. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - When would you have something to commit? This is the opposite of that! - </p> - </hint> </task> </exercise> </exercises> -</subsection> - -<conclusion> - <p> - In the next section you will create a feature branch. - </p> -</conclusion> </section> diff --git a/source/ch-upstreaming-changes/sec-git-command-summary.ptx b/source/ch-upstreaming-changes/sec-git-command-summary.ptx index f374308..30e8a76 100644 --- a/source/ch-upstreaming-changes/sec-git-command-summary.ptx +++ b/source/ch-upstreaming-changes/sec-git-command-summary.ptx @@ -22,39 +22,21 @@ <premise> <c>git log</c></premise> <response>Display recent commits made to the active branch.</response> </match> <match> <premise> - <c>git branch <branch></c></premise> <response>Create a new feature branch.</response> </match> <match> + <c>git branch <branch> </c></premise> <response>Create a new feature branch.</response> </match> <match> <premise> - <c>git branch</c></premise> <response>Lists all branches.</response> </match> <match> + <c>git switch <branch> </c></premise> <response>Change the active branch</response> </match> <match> <premise> - <c>git switch <branch></c></premise> <response>Change the active branch</response> </match> <match> + <c>git status </c></premise> <response>Check the current state of your local repo.</response> </match> <match> <premise> - <c>git status</c></premise> <response>Check the current state of your local repo.</response> </match> <match> + <c>git status <file name> </c></premise> <response>Display the changes that you made to a file.</response> </match> <match> <premise> - <c>git diff</c></premise> <response>Displays unstaged changes.</response> </match> <match> + <c>git stage <file name> </c></premise> <response>Stage changed files to be committed to the repo.</response> </match> <match> <premise> - <c>git diff --staged</c></premise> <response>Displays staged changes.</response> </match></matches> - <hint> - <p> - Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. - </p> - </hint> - </exercise> - - <exercise xml:id="ex-git-commands-summary-upstreaming-2" label="ex-git-commands-summary-upstreaming-2"> - <statement> - <p> - Match the tasks on the right with the appropriate git command listed on the left. - </p> - </statement> - <matches> <match> - <premise> - <c>git stage <file name></c></premise> <response>Stage changed files to be committed to the repo.</response> </match> <match> - <premise> - <c>git add <file name></c></premise> <response>Another way to stage changed files for a commit.</response> </match> <match> + <c>git add <file name> </c></premise> <response>Another way to stage changed files for a commit.</response> </match> <match> <premise> - <c>git commit -m "message"</c></premise> <response>Commit staged files with a message.</response> </match> <match> + <c>git commit -m "message" </c></premise> <response>Commit staged files with a message.</response> </match> <match> <premise> - <c>git push <remote> <branch></c></premise> <response>Push a feature branch to your origin.</response> </match> </matches> + <c>git push <remote repo name> <branch> </c></premise> <response>Push a feature branch to your origin.</response> </match> </matches> <hint> <p> Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. diff --git a/source/ch-upstreaming-changes/sec-pushing-a-branch-to-your-origin.ptx b/source/ch-upstreaming-changes/sec-pushing-a-branch-to-your-origin.ptx index d4009d7..4d2e46c 100644 --- a/source/ch-upstreaming-changes/sec-pushing-a-branch-to-your-origin.ptx +++ b/source/ch-upstreaming-changes/sec-pushing-a-branch-to-your-origin.ptx @@ -31,15 +31,13 @@ <exercise xml:id="ex-list-branches" label="ex-list-branches"> <statement> <p> - The <c>git branch</c> command lists all of the branches that exist in your local repository. + The <c>git branch -l</c> (lower case L, not one) command lists all of the branches that exist in your local repository. </p> - <p> How many branches are in your local repository? </p> </statement> - <choices> <choice> <statement> @@ -47,7 +45,6 @@ 1 - <c>main</c> </p> </statement> - <feedback> <p> Look again, you should see more than just the <c>main</c> branch. @@ -58,13 +55,12 @@ <choice> <statement> <p> - 1 - <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> + 1 - <c>feature branch</c> </p> </statement> - <feedback> <p> - Look again, you should see more than just the <em>feature branch</em>. + Look again, you should see more than just the <c>feature</c> branch. </p> </feedback> </choice> @@ -72,13 +68,12 @@ <choice correct="yes"> <statement> <p> - 2 - <c>main</c> and <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> + 2 - <c>main</c> and <c>feature branch</c> </p> </statement> - <feedback> <p> - Correct! Your local repository will have both the <c>main</c> branch and your <em>feature branch</em>. + Correct! Your local repository will have both the <c>main</c> branch and your <c>feature</c> branch. </p> </feedback> </choice> @@ -89,10 +84,9 @@ 3 or more with differing branch names </p> </statement> - <feedback> <p> - If you have more than 2 branches perhaps you created a <em>feature branch</em> multiple times by accident. + If you have more than 2 branches perhaps you created a feature branch multiple times by accident. </p> </feedback> </choice> @@ -120,7 +114,6 @@ </p> </statement> - <choices> <choice correct="yes"> <statement> @@ -128,62 +121,56 @@ 1 - <c>main</c> </p> </statement> - <feedback> <p> Correct! There is only 1 branch, <c>main</c> in your origin repository on GitHub. </p> </feedback> </choice> - + <choice> <statement> <p> - 1 - <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> + 1 - <c>feature branch</c> </p> </statement> - <feedback> <p> - Look again, your <em>feature branch</em> should not be listed in GitHub as it is only in your local repository. + Look again, your <c>feature</c> branch should not be listed in GitHub as it is only in your local repository. </p> </feedback> </choice> - + <choice> <statement> <p> - 2 - <c>main</c> and <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> + 2 - <c>main</c> and <c>feature branch</c> </p> </statement> - <feedback> <p> - Look again, your <em>feature branch</em> should not be listed in GitHub as it is only in your local repository. + Look again, your <c>feature</c> branch should not be listed in GitHub as it is only in your local repository. </p> </feedback> </choice> - + <choice> <statement> <p> 3 or more with differing branch names </p> </statement> - <feedback> <p> - Perhaps you aren't in your origin repository. - Make sure you see your GitHub userid in the upper left hand corner of your GitHub tab. + Perhaps you aren't in your origin repository. Make sure you see your GitHub userid in the upper left hand corner of your GitHub tab. </p> </feedback> </choice> </choices> - + <hint> <p> - Make sure you are in your origin repository, not the upstream repository. - Refer to <xref ref="fig-pushing-feature-branch"/> and look at the origin to see what branches appear on GitHub. + Make sure you are in your origin repository, not the upstream repository. Refer to <xref ref="fig-pushing-feature-branch"/> and look at the origin to see what branches should appear on GitHub. </p> </hint> </task> @@ -195,247 +182,129 @@ Why is there a difference between the branches in your origin repository and your local repository? </p> </statement> + <response /> + </task> + </exercise> + <p component="linux-kit-client"> + <term>Getting a Personal Access Token: </term> + </p> - <choices> - <choice correct="yes"> - <statement> - <p> - You created a branch in your local repository but it does not appear in the origin repository yet. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - You created a branch in the origin repository but it does not appear in your local repository. - </p> - </statement> - - <feedback> - <p> - Your branch is in your local repository, not the origin repository. - </p> - </feedback> - </choice> + <p component="linux-kit-client"> + Before you will be able to push your feature branch to GitHub you will have to get a <term>Personal Access Token (PAT)</term> from GitHub. + A PAT is like a password but has some security benefits. + In particular, you can have multiple different PATs. + Each one can have different limits on what can be done with it and each one can be revoked individually without affecting the others. + </p> - <choice> - <statement> - <p> - Someone else created a branch in the origin repository. - </p> - </statement> + <p component="linux-kit-client"> + When interacting with GitHub using the git CLI (e.g. + when pushing a branch), GitHub requires that you use a PAT for authentication instead of your password. + </p> - <feedback> - <p> - Branches are created in the local repository. - It is possible that someone else created a branch in their local repository and pushed it to their origin. - You have a different origin repository so you would not see it. - </p> - </feedback> - </choice> + <exercise xml:id="ex-getting-pat" label="ex-getting-pat" component="linux-kit-client"> + <introduction> + <p> + Follow GitHub's instructions for creating a (classic) personal access token: <url href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic" visual="docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic">Creating a Personal Access Token (classic)</url>. + </p> - <choice> - <statement> + <p> + When doing so be sure to: + <ul> + <li> <p> - Someone else created a branch in their local repository and it appears in the origin repository. + Choose “repo” for the “scopes and permissions.” </p> - </statement> + </li> - <feedback> + <li> <p> - It is possible that someone else created a branch in their local repository and pushed it to their origin. - You have a different origin repository so you would not see it. + Be sure to copy and paste your PAT somewhere safe – maybe e-mail it to yourself. + You will not be able to retrieve it again after you leave the page. </p> - </feedback> - </choice> - </choices> + </li> + </ul> + </p> - <hint> - <p> - All the work you have done in this chapter is on your local machine. - What should be appearing in your local repository that is not in the origin repository? - </p> - </hint> - </task> + <p> + Note: Typing or even copy and pasting your PAT every time it is needed can be a hassle. + To help, the git CLI provides what is known as the <term>credential helper</term>. + The git CLI in the KitClient has configured the credential helper so that your PAT will be stored when you enter it the first time. + It will then be used automatically for future commands. + If you are curious, you can learn more about the credential helper here: <url href="https://techexpertise.medium.com/storing-git-credentials-with-git-credential-helper-33d22a6b5ce7" visual="techexpertise.medium.com/storing-git-credentials-with-git-credential-helper-33d22a6b5ce7">Storing Git Credentials with Git Credential Helper</url>. + </p> + </introduction> </exercise> <p> <term>Pushing your Feature Branch: </term> </p> - <exercise xml:id="ex-push-branch-linux" label="ex-push-branch-linux"> - <statement> + <exercise xml:id="ex-push-branch-linux" label="ex-push-branch-linux" component="linux-kit-client"> + <introduction> <p> - The <c>git push <remote> <branch></c> command will push the specified branch of your local repository to the specified remote repository (i.e. + The <c>git push <remote repository name> <branch></c> command will push the specified branch of your local repository to the specified remote repository (i.e. on GitHub). </p> <p> - You will need to push your <em>feature branch</em> from your local repository to your <em>origin repository</em> on GitHub. - You have given your remote repository the name <c>origin</c> which you can use instead of the full URL. - For example, <c>git push origin <branch></c> and the name of your branch where you committed your change. - Type the command now. + Use a command that will push your <em>feature branch</em> from your local repository to your <em>origin repository</em> on GitHub. </p> <p> - The output should not contain any error messages. - If you see error messages, make sure you spelled your branch name correctly and your command is in the proper format and does not include < >. - The last few lines should also give you some indication that your push was successful. - Look at the last two lines of output produced. + Note: You can use the name of the remote repository, so you do not need to use the full URL. + You will also need to paste your PAT as the password when it is requested. <em>The cursor will not move when you put in the PAT nor will you see any characters. After you type or paste it hit Enter</em> </p> - </statement> - - - <choices> - <choice correct="yes"> - <statement> - <p> - The second to last line is the URL of the origin repository. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - The last line provides the name of the branch in the local repository that was <em>pushed</em> to the origin repository. - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The second to last line is the URL of your local repository. - </p> - </statement> - - <feedback> - <p> - Your local repository does not have a URL, it is on your local machine. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The last line provides the URL of the branch in the local repository that was <em>pushed</em> to the origin repository. - </p> - </statement> - - <feedback> - <p> - This shows the name of the branch, not a URL. - </p> - </feedback> - </choice> - </choices> + </introduction> + </exercise> - <hint> + <exercise xml:id="ex-push-error-linux" label="ex-push-error-linux" component="linux-kit-client"> + <introduction> <p> - There are several lines of output that mention deltas. - Ignore these. - Make sure you are looking at the last two lines - the first of which begin with <em>To</em> and the second of which begins with a hexademical code. + The output from <xref ref="ex-push-branch-linux"/> should not contain any error messages. + The last few lines should also give you some indication that that your push was successful. + Visit your origin repository on GitHub and check that the branch was pushed. </p> - </hint> + </introduction> </exercise> - <exercise xml:id="ex-push-error-linux" label="ex-push-error-linux"> - <statement> + <exercise xml:id="ex-push-branch-vscode" label="ex-push-branch-vscode" component="vscode-kit-client"> + <introduction> <p> - Visit your origin repository on GitHub and check that the branch was pushed. - You may have to reload the page. + The <c>git push <remote repo name> <branch></c> command will push the specified branch of your local repo to the specified remote repo (i.e. + on GitHub). </p> + <p> - How can you tell your branch was pushed? + Use a command that will push your <em>feature branch</em> from your local repo to your <em>origin repo</em> on GitHub. </p> - </statement> - - - <choices> - <choice correct="yes"> - <statement> - <p> - The number next to the <em>Branches</em> link is now 2. - </p> - </statement> - - <feedback> - <p> - Correct! The number of branches should have increased. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - When I click on <em>Branches</em> my branch is now listed in addition to <c>main</c>. - </p> - </statement> - - <feedback> - <p> - Correct! You should be able to see both branches on this page. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - The number of issues has increased. - </p> - </statement> - - <feedback> - <p> - Pushing a branch will not create an issues. - </p> - </feedback> - </choice> - <choice> - <statement> - <p> - The number of pull requests has increased. - </p> - </statement> + <p> + Note: You can use the name of the remote repo, so you do not need to use the full URL. + </p> + </introduction> + </exercise> - <feedback> - <p> - Pushing a branch will not create a pull request. - </p> - </feedback> - </choice> - </choices> + <exercise xml:id="ex-push-error-vscode" label="ex-push-error-vscode" component="vscode-kit-client"> + <introduction> + <p> + When you attempted to push in <xref ref="ex-push-branch-vscode"/>, you should have gotten an authorization error. + When this happens VSCode will prompt you in the lower right to open GitPod and configure the authorization. + Do that. + When done, return to your GitPod workspace and try the push again. + It should work. + </p> - <hint> <p> - There are multiple ways you can tell that your branch has been pushed by looking at the <em>origin repository</em> on GitHub. + If you get the same pop up, open it again. + Look for the GitHub authorization. + Click the "..." menu next to it and edit it. + Ensure that "repo" with read/write permissions are set and save it. + It will send you to GitHub to complete the authorization. + When done, return to your GitPod workspace and try the push again. + It should work. </p> - </hint> + </introduction> </exercise> </exercises> </section> diff --git a/source/ch-upstreaming-changes/sec-staging-changes.ptx b/source/ch-upstreaming-changes/sec-staging-changes.ptx index 3480d14..e01aaf9 100644 --- a/source/ch-upstreaming-changes/sec-staging-changes.ptx +++ b/source/ch-upstreaming-changes/sec-staging-changes.ptx @@ -28,65 +28,48 @@ <title/> <introduction> <p> - The exercises in this section will walk you through staging the changes you made to your <em>Local Files</em>. - </p> - - <p> - The <c>git stage <file></c> command adds the indicated file to the stage, preparing it to become a part of the next commit. + The exercises in this section will walk you through staging the changes you made to your <em>Local Files</em>. </p> </introduction> <exercise xml:id="ex-staging-changes" label="ex-staging-changes"> - <statement> - <p> - Write a <c>git stage <file></c> command to stage the file that you edited. + <introduction> + <p> + The <c>git stage <file></c> command adds the indicated file to the stage, preparing it to become a part of the next commit. + Use the <c>git stage <file></c> command now to stage the file that you edited. </p> - <p> - Enter the command you wrote below. - </p> - <p> - <var width="55" /> - </p> - </statement> - <setup> - <var> - <condition string="^git stage(\s+)(CONTRIBUTING.md|INSTALL.md|ONBOARDING.md|README.md)$"> - <feedback> - <p> - Thank you. - </p> - </feedback> - </condition> - <condition string="^git stage(\s+)!(CONTRIBUTING.md|INSTALL.md|ONBOARDING.md|README.md)$"> - <feedback> - <p> - Are you sure that is the file that the issue asked you to edit? - </p> - </feedback> - </condition> - </var> - </setup> - <hint> + </introduction> + + + <task xml:id="ex-staging-changes-a" label="ex-staging-changes-a"> + <statement> <p> - Check your issue again to see which file you should have edited. + Provide the command you entered. </p> - </hint> - </exercise> + </statement> + <response /> + </task> + - <exercise xml:id="ex-staging-changes-b" label="ex-staging-changes-b"> + <task xml:id="ex-staging-changes-b" label="ex-staging-changes-b"> <statement> <p> - Now run the <c>git status</c> command again. - Paste the output of the <c>git status</c> command below. + Note that git also has a <c>git add</c> command that is equivalent to <c>git stage</c>. + So, you can add files to the stage using either <c>git stage</c> or <c>git add</c>. + These activities will use <c>git stage</c> because it seems more descriptive of what is happening. + However, you are likely to see <c>git add</c> used in other resources, so it is worth knowing that they are equivalent. + Provide the <c>git add</c> command that would be equivalent to your answer in <xref ref="ex-staging-changes-a" />. </p> </statement> <response /> - </exercise> + </task> + - <exercise xml:id="ex-staging-changes-c" label="ex-staging-changes-c"> + <task xml:id="ex-staging-changes-c" label="ex-staging-changes-c"> <statement> <p> - Compare your output in <xref ref="ex-staging-changes-b" /> to the output in <xref ref="ex-verify-changes-new-a" />. + Now run the <c>git status</c> command again. + Compare your output in <xref ref="ex-staging-changes-a" /> to the output in <xref ref="ex-verify-changes-a" />. </p> <p> @@ -105,7 +88,7 @@ <feedback> <p> - Correct! After issuing the <c>git stage</c> command the file will be staged. + Correct! After issuing the <c>git stage</c> (or <c>git add</c>) command the file will be staged. </p> </feedback> </choice> @@ -119,7 +102,7 @@ <feedback> <p> - Did you change more than 1 file by accident? Verify that you only changed the file specified in your issue. + Once you have issued the <c>git stage</c> command it show that the file is ready to be committed. </p> </feedback> </choice> @@ -155,12 +138,13 @@ <hint> <p> - Staged means a file has been modified and will be added to the commit. + Staged means a file has been modified and added to the commit. </p> </hint> - </exercise> + </task> + - <exercise xml:id="ex-staging-changes-d" label="ex-staging-changes-d"> + <task xml:id="ex-staging-changes-d" label="ex-staging-changes-d"> <statement> <p> How many files are listed as ready to be committed? @@ -228,98 +212,10 @@ <hint> <p> - Staged means a file has been modified and will be added to the commit. + Staged means a file has been modified and added to the commit. </p> </hint> - </exercise> - - - <exercise xml:id="ex-staging-changes-diff" label="ex-staging-changes-diff"> - <statement> - <p> - Run the <c>git diff</c> command again. - What output is produced? - </p> - </statement> - - - <choices> - <choice correct="yes"> - <statement> - <p> - No output is produced. - </p> - </statement> - - <feedback> - <p> - Correct! There are no differences because your changes were staged. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It shows the file name that I changed. - </p> - </statement> - - <feedback> - <p> - If you are seeing the file name you changed it means either you made additional changes after the <c>git stage</c> command was done or your <c>git stage</c> command did not work properly. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It shows the code I added in green. - </p> - </statement> - - <feedback> - <p> - If you are seeing code changes it means either you made additional changes after the <c>git stage</c> command was done or your <c>git stage</c> command did not work properly. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - It shows the code I deleted in red. - </p> - </statement> - - <feedback> - <p> - If you are seeing code changes it means either you made additional changes after the <c>git stage</c> command was done or your <c>git stage</c> command did not work properly. - </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - The <c>git diff</c> command will only show the changes that have yet to be staged. - </p> - </hint> + </task> </exercise> </exercises> - - <conclusion> - <p> - The <c>git diff --staged</c> command will show you the differences between the staged changes and the most recent commit. - Try this command now. - </p> - - <p> - Note that git also has a <c>git add</c> command that is equivalent to <c>git stage</c>. - So, you can add files to the stage using either <c>git stage</c> or <c>git add</c>. - These activities will use <c>git stage</c> because it seems more descriptive of what is happening. - However, you are likely to see <c>git add</c> used in other resources, so it is worth knowing that they are equivalent. - </p> - </conclusion> </section> diff --git a/source/ch-upstreaming-changes/sec-switching-branches.ptx b/source/ch-upstreaming-changes/sec-switching-branches.ptx index 151aa2a..7054a95 100644 --- a/source/ch-upstreaming-changes/sec-switching-branches.ptx +++ b/source/ch-upstreaming-changes/sec-switching-branches.ptx @@ -8,21 +8,6 @@ In the previous section you learned how to create a branch. In this section you will learn more about why branching is important and how to switch between existing branches. </p> - - <p> - Figure <xref ref="fig-switch-to-feature-branch" /> illustrates this idea by showing what what will happen when you switch to your feature branch and your Local Files have not been modified since the last commit on the main branch (drawn in green). - </p> - - <p> - <figure xml:id="fig-switch-to-feature-branch"> - <caption> Switch to Feature Branch. </caption> - <image source="images/ch-upstreaming-changes/switch-to-feature-branch.png" width="75%"> - <description> - Cloud image of origin, upstream, and local branches (including new feature branch). - </description> - </image> - </figure> - </p> </introduction> <exercises> @@ -30,7 +15,7 @@ <exercise xml:id="ex-switching-branches" label="ex-switching-branches"> <introduction> <p> - As you saw in <xref ref="topic-creating-a-feature-branch"/>, the <c>git branch <name></c> command creates a branch (among other uses), but it does not change your active branch. + As you saw in the previous section, the <c>git branch</c> command creates a branch (among other uses), but it does not change your active branch. The <c>git switch <name></c> command switches (i.e. changes) the active branch. </p> @@ -40,279 +25,98 @@ <task xml:id="ex-switching-branches-a" label="ex-switching-branches-a"> <statement> <p> - Type <c>git switch <name></c> to change your active branch to the new feature branch that you created in the previous section. - What output is produced? + What command will change your active branch to the new feature branch that you created in the previous section? </p> </statement> + <response /> + </task> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - Switched to branch '<name>' - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - Switched to branch 'main' - </p> - </statement> - - <feedback> - <p> - You were on <c>main</c> prior to switching branches. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - error: Your local changes to the following files would be overwritten by checkout: ... - </p> - - <p> - Aborting - </p> - </statement> + <task xml:id="ex-switching-branches-b" label="ex-switching-branches-b"> + <statement> + <p> + Use the <c>git status</c> command again now. + What part of the output confirms that your feature branch is now the active branch? + </p> + <response /> + </statement> + </task> + </exercise> - <feedback> - <p> - You should not have made any changes so far. - </p> - </feedback> - </choice> + <p> + Figure <xref ref="fig-switch-to-feature-branch" /> illustrates this idea by showing that you have switched to your feature branch and that your Local Files have not been modified since the last commit on the main branch (drawn in green). + </p> + <p> + <figure xml:id="fig-switch-to-feature-branch"> + <caption> Switch to Feature Branch. </caption> + <image source="images/ch-upstreaming-changes/switch-to-feature-branch.png" width="75%"> + <description> + Cloud image of origin, upstream, and local branches (including new feature branch). + </description> + </image> + </figure> + </p> - <choice> - <statement> - <p> - fatal: invlalid reference: <name> - </p> - </statement> + <exercise xml:id="ex-switching-branches-git-branch" label="ex-switching-branches-git-branch"> + <introduction> + <p> + You can also switch branches using the <c>git branch</c> command. + </p> + </introduction> - <feedback> - <p> - You probably typed the branch name incorrectly. - Run <c>git branch</c> again to see the name of the branch you created. - </p> - </feedback> - </choice> - </choices> - <hint> + <task xml:id="ex-switching-branches-git-branch-a" label="ex-switching-branches-git-branch-a"> + <statement> <p> - Make sure you don't include < > in your <c>git switch <name></c> command. + Issue the <c>git branch</c> command now. You should see a list of branches. How can you tell which branch is the active branch? </p> - </hint> + </statement> + <response /> </task> - <task xml:id="ex-switching-branches-b" label="ex-switching-branches-b"> + <task xml:id="ex-switching-branches-git-branch-b" label="ex-switching-branches-git-branch-b"> <statement> <p> - Which of the following commands could be used to confirm that your feature branch is now the active branch? + <c>git branch <name></c> will make <em>name</em> the active branch. Enter a <c>git branch</c> command that will make <c>main</c> the active branch. What command did you enter? </p> </statement> + <response /> + </task> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>git branch</c> - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - <c>git status</c> - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git log</c> - </p> - </statement> - - <feedback> - <p> - <c>git log</c> will show the commit history, it will not show the active branch - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git branch <name></c> - </p> - </statement> - - <feedback> - <p> - When <c>git branch</c> ends with a <c>name</c> it creates a new branch, it does not show what is active. - </p> - </feedback> - </choice> - </choices> - - <hint> + <task xml:id="ex-switching-branches-git-branch-c" label="ex-switching-branches-git-branch-c"> + <statement> <p> - There are two commands that will provide information about the active branch. + How do you know that <c>main</c> is the active branch? </p> - </hint> + </statement> + <response /> </task> + - - <task xml:id="ex-switching-branches-c" label="ex-switching-branches-c"> + <task xml:id="ex-switching-branches-git-branch-d" label="ex-switching-branches-git-branch-d"> <statement> <p> - Which of the following commands could be used to make <c>main</c> the active branch? + In the next section you will be making changes to your Local Files. It is essential that you are on your feature branch <em>before</em> making any changes. + </p> + <p> + Enter a <c>git branch</c> command that will make your feature branch the active branch. What command did you enter? </p> </statement> + <response /> + </task> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - <c>git switch main</c> - </p> - </statement> - - <feedback> - <p> - Correct! - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git branch main</c> - </p> - </statement> - - <feedback> - <p> - This will try to create a new branch named <c>main</c>. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git branch</c> - </p> - </statement> - - <feedback> - <p> - <c>git branch</c> will show all the branches - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git status</c> - </p> - </statement> - - <feedback> - <p> - <c>git status</c> will show the active branch and information about changes - </p> - </feedback> - </choice> - </choices> - - <hint> + <task xml:id="ex-switching-branches-git-branch-e" label="ex-switching-branches-git-branch-e"> + <statement> <p> - Refer back to how you made your feature branch the active branch. + How do you know that your feature branch is the active branch? </p> - </hint> + </statement> + <response /> </task> - </exercise> - - <p> - Type the command from <xref ref="ex-switching-branches-c" /> and verify that <c>main</c> is the active branch. - </p> - <exercise xml:id="ex-switching-branches-git-branch" label="ex-switching-branches-git-branch"> - <statement> - <p> - Assuming you are on the main branch, drag the steps that will make your feature branch the active branch and verify you are on your feature branch. - Some steps may not be used. - </p> - </statement> - <blocks> <block correct="no"> - <p> - <c>git switch</c> - </p> - </block> <block order="1"> - - <p> - <c>git switch <name></c> - </p> - </block> <block correct="no"> - - <p> - <c>git branch <name></c> - </p> - </block> <block order="2"> - - <p> - <c>git branch</c> - </p> - </block> <block correct="no"> - - <p> - <c>git switch main</c> - </p> - </block> </blocks> - - <hint> - <p> - Think about how you make a branch active and then verify it. - </p> - </hint> </exercise> </exercises> - - <conclusion> - <p> - Use the commands from <xref ref="ex-switching-branches-git-branch"/> to make your feature branch the active branch and verify your active branch. - </p> - </conclusion> </section> diff --git a/source/docinfo.ptx b/source/docinfo.ptx index ba40b81..ed6c2af 100644 --- a/source/docinfo.ptx +++ b/source/docinfo.ptx @@ -5,9 +5,9 @@ <!-- settings. --> <docinfo xmlns:xi="http://www.w3.org/2001/XInclude"> <!-- A unique name for the book in a catalog; for example, see https://pretextbook.org/catalog.html and https://runestone.academy/ns/books/index. It contains a simple lowercase string with no dashes or other special characters. See https://pretextbook.org/doc/guide/html/sec-publishing-to-runestone-academy.html for more information. --> - <document-id>gitkit</document-id> + <document-id>gitkitlinux</document-id> <!-- A brief description for the book in a catalog; see the links above. The @shelf is used only when publishing to Runestone; see https://runestone.academy/ns/books/index for a list of valid values. You must copy these @shelf names exactly, including capitalization. --> - <blurb shelf="Misc"> A hands-on introduction to Open Source collaboration using a git/gitHub forking workflow. </blurb> + <blurb shelf="Misc"> A hands-on introduction to Open Source collaboration using a git/gitHub forking workflow in a Linux desktop environment. </blurb> <!-- The next three lines are likely for mature projects only: --> diff --git a/source/frontmatter.ptx b/source/frontmatter.ptx index cedda3d..a3a60ad 100644 --- a/source/frontmatter.ptx +++ b/source/frontmatter.ptx @@ -5,10 +5,6 @@ <frontmatter xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="frontmatter"> <titlepage> - <titlepage-items></titlepage-items> - </titlepage> - - <bibinfo> <author> <personname>Grant Braught</personname> <institution>Dickinson College</institution> @@ -36,18 +32,7 @@ <date> <today /> </date> - - <website> - <url href="https://gitlab.com/hfossedu/kits">HFOSS Kits</url> - </website> - - <copyright> - <year>2024<ndash /><today /></year> - <holder>HFOSS Kits</holder> - <shortlicense> This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit <url href="http://creativecommons.org/licenses/by-sa/4.0/" visual="creativecommons.org/licenses/by-sa/4.0"> CreativeCommons.org</url> - </shortlicense> - </copyright> - </bibinfo> + </titlepage> <preface> <title>Overview @@ -116,7 +101,17 @@ - + + + HFOSS Kits + + + + 2024 + HFOSS Kits + This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit CreativeCommons.org + + \ No newline at end of file diff --git a/source/main.ptx b/source/main.ptx index f51eebd..f650f89 100644 --- a/source/main.ptx +++ b/source/main.ptx @@ -5,7 +5,7 @@ - GitKit (2nd ed.) + GitKit (Linux Desktop Edition) Learn git and GitHub in Context @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/source/shared-images/DevEnv-Kitty-Ready.png b/source/shared-images/DevEnv-Kitty-Ready.png deleted file mode 100644 index 63e8f63..0000000 Binary files a/source/shared-images/DevEnv-Kitty-Ready.png and /dev/null differ diff --git a/source/shared-images/placeholder.tmp b/source/shared-images/placeholder.tmp new file mode 100644 index 0000000..ddcd0ec --- /dev/null +++ b/source/shared-images/placeholder.tmp @@ -0,0 +1 @@ +Can be removed when any image is added. \ No newline at end of file