diff --git a/.devcontainer.json b/.devcontainer.json index 732ab66..7da7a9c 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -15,9 +15,9 @@ "name": "PreTeXt-Codespaces", // This Docker image includes some LaTeX support, but is still not to large. Note that if you keep your codespace running, it will use up your GitHub free storage quota. Additional options are listed below. - "image": "oscarlevin/pretext:small", + // "image": "oscarlevin/pretext:small", // If you need to generate more complicated assets (such as sageplots) or use additional fonts when building to PDF, comment out the above line and uncomment the following line. - // "image": "oscarlevin/pretext:full", + "image": "oscarlevin/pretext:full", // If you only intend to build for web and don't have any latex-image generated assets, you can use a smaller image: // "image": "oscarlevin/pretext:lite", diff --git a/.github/workflows/pretext-cli.yml b/.github/workflows/pretext-cli.yml index 22b8a3c..2be6660 100644 --- a/.github/workflows/pretext-cli.yml +++ b/.github/workflows/pretext-cli.yml @@ -24,8 +24,21 @@ jobs: - name: install deps run: pip install -r requirements.txt + - name: install local ptx files + run: pretext --version + - name: build deploy targets - run: pretext build --deploys + run: | + version="$(pretext --version)" + major="$(echo $version | cut -d '.' -f 1)" + minor="$(echo $version | cut -d '.' -f 2)" + if [ "$major" -ge 2 -a "$minor" -ge 5 ]; then + echo "PreTeXt version is 2.5 or greater; using new build command" + pretext build --deploys + else + echo "PreTeXt version is less than 2.5, using old build command" + pretext build + fi - name: stage deployment run: pretext deploy --stage-only diff --git a/.gitkit-cspell.txt b/.gitkit-cspell.txt index 3e826b8..840d6ba 100644 --- a/.gitkit-cspell.txt +++ b/.gitkit-cspell.txt @@ -1,4 +1,5 @@ automations +devenv farmdata foss gitkit @@ -8,6 +9,7 @@ halign HFOSSedu inclusivity kitclient +nbsp opensource POGIL Runestone diff --git a/README.md b/README.md index 7729e19..3c71d5c 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ 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 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. +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) ## Licensing @@ -301,76 +299,19 @@ 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. -#### Adding Version Specific Content +#### Text Versions -There are 10 versions of the text that can be built: +There are 3 versions of the text that can be built: -- `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. +- `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. ##### 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 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. +pretext build web +pretext view web +``` \ No newline at end of file diff --git a/materials/images/GitKit-Text-Soure-Images.pptx b/materials/images/GitKit-Text-Soure-Images.pptx index 54728fd..cfd38e2 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 f6e8aab..e3099ca 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 a930d8c..3f2fabc 100644 --- a/project.ptx +++ b/project.ptx @@ -2,27 +2,10 @@ - - + + - - - - - - - - - - - - - - - + diff --git a/publication/publication-student-linux.ptx b/publication/publication-example.ptx similarity index 97% rename from publication/publication-student-linux.ptx rename to publication/publication-example.ptx index fe0593b..913a4e4 100644 --- a/publication/publication-student-linux.ptx +++ b/publication/publication-example.ptx @@ -21,7 +21,7 @@ - + @@ -34,7 +34,6 @@ - @@ -61,7 +60,7 @@ - + @@ -70,7 +69,7 @@ - + diff --git a/publication/publication-instructor-linux.ptx b/publication/publication-instructor-linux.ptx deleted file mode 100644 index f07770e..0000000 --- a/publication/publication-instructor-linux.ptx +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/publication/publication-instructor-vscode.ptx b/publication/publication-instructor-vscode.ptx deleted file mode 100644 index 4b85f3e..0000000 --- a/publication/publication-instructor-vscode.ptx +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/publication/publication-linux.ptx b/publication/publication-linux.ptx deleted file mode 100644 index 6e00d3c..0000000 --- a/publication/publication-linux.ptx +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/publication/publication-runestone-vscode.ptx b/publication/publication-runestone-vscode.ptx deleted file mode 100644 index 7ff25c8..0000000 --- a/publication/publication-runestone-vscode.ptx +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/publication/publication-runestone-linux.ptx b/publication/publication-runestone.ptx similarity index 96% rename from publication/publication-runestone-linux.ptx rename to publication/publication-runestone.ptx index f8600a2..ee1f54c 100644 --- a/publication/publication-runestone-linux.ptx +++ b/publication/publication-runestone.ptx @@ -34,7 +34,6 @@ - @@ -89,12 +88,8 @@ diff --git a/publication/publication-student-vscode.ptx b/publication/publication-student-vscode.ptx deleted file mode 100644 index e2c843d..0000000 --- a/publication/publication-student-vscode.ptx +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/publication/publication-vscode.ptx b/publication/publication-vscode.ptx deleted file mode 100644 index d6aaf27..0000000 --- a/publication/publication-vscode.ptx +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/publication/publication.ptx b/publication/publication.ptx index 913a4e4..2168e70 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,12 +104,8 @@ 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 9622b73..616af94 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 new file mode 100644 index 0000000..f63c3f7 Binary files /dev/null and b/source/ch-communities-and-collaboration/images/DevEnv-Blank-Ready.png 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 new file mode 100644 index 0000000..8ab2171 Binary files /dev/null and b/source/ch-communities-and-collaboration/images/DevEnv-Request-PAT.png differ diff --git a/source/ch-communities-and-collaboration/sec-basic-foss-workflow.ptx b/source/ch-communities-and-collaboration/sec-basic-foss-workflow.ptx index c6a1c45..a394745 100644 --- a/source/ch-communities-and-collaboration/sec-basic-foss-workflow.ptx +++ b/source/ch-communities-and-collaboration/sec-basic-foss-workflow.ptx @@ -30,7 +30,9 @@ <introduction> - The exercises in this section will help to familiarize you with the terminology and the process of this basic FOSS workflow. + <p> + The exercises in this section will help to familiarize you with the terminology and the process of this basic FOSS workflow. + </p> </introduction> <exercise 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 173309f..f357986 100644 --- a/source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx +++ b/source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx @@ -1,520 +1,721 @@ <?xml version="1.0" encoding="UTF-8"?> -<section - xml:id="topic-cloning-your-origin" - xmlns:xi="http://www.w3.org/2001/XInclude" - > +<section xml:id="topic-cloning-your-origin" xmlns:xi="http://www.w3.org/2001/XInclude" > <title>Cloning Your Origin -

- 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. +

+ 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.

-

- - 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.

+ -

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

-

- 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 . When you did that, a clone of your origin was automatically created for you in your development environment. + + + 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.

- - - + + <exercise xml:id="ex-find-clone-url-a" label="ex-find-clone-url-a"> + <statement> + <p> + Visit the GitHub page for your origin repository. + </p> + </statement> - <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> - 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> - </task> - <task - 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> - </task> - <task - 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: + <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> - <image source="images/ch-communities-and-collaboration/gitHubCloneURL.png" - width="50%"> - <description> - The GitHub dialog showing the clone URL. - </description> - </image> + <exercise xml:id="ex-find-clone-url-b" label="ex-find-clone-url-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> - 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> - </task> + <exercise xml:id="ex-find-clone-url-c" label="ex-find-clone-url-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" - component="linux-kit-client"> + <exercise xml:id="ex-clone-url" label="ex-clone-url"> <statement> <p> - Copy and paste the clone URL that you will use to clone your origin as your answer to this exercise. + 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> + <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>. + <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> - <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> + + <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" label="ex-clone-origin"> + <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> + <p> + <var width="65" /> + </p> + </statement> + <setup> + <var> + <condition string="^git clone https://github\.com/(?!(FarmData2|DickinsonCollege)).+/.+\.git$"> + <feedback> <p> - Use the following command in the Terminal to clone your origin repository into your development environment: + Thank you. </p> + </feedback> + </condition> + <condition string="^git clone https://github\.com/(DickinsonCollege|FarmData2)/.+\.git"> + <feedback> <p> - <c>git clone <clone URL></c> + It looks like you might be trying to clone the upstream repository instead of your origin. </p> + </feedback> + </condition> + <condition string=".*"> + <feedback> <p> - Be sure to replace <c><clone URL></c> with the clone URL you found in <xref ref="ex-clone-url-linux" />. + Be sure to replace the URL with the clone URL you found in <xref ref="ex-clone-url" />. The clone URL should have the format <c>https://github.com/yourGitHubUsername/theRepoName.git</c>. </p> - </statement> - </task> - <task - xml:id="ex-clone-origin-linux-b" - label="ex-clone-origin-linux-b"> - <statement> - Copy and paste the output from your command in <xref ref="ex-clone-origin-linux-a" /> as your answer here. - </statement> - <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 /> + </feedback> + </condition> + </var> + </setup> +</exercise> +<exercise xml:id="ex-clone-origin-a" label="ex-clone-origin-a"> + <p> + Execute your command from <xref ref="ex-clone-origin" /> in your terminal. + </p> +</exercise> + +<exercise xml:id="ex-clone-origin-b" label="ex-clone-origin-b"> + <statement> + <p> + Which of the following appear in the output from entering the command from <xref ref="ex-clone-origin-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 for a line in the output that begins with "Cloning into". + Look at the output in your terminal. </p> </hint> - </task> - <task - 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> - </task> - </exercise> +</exercise> - <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> +<exercise xml:id="ex-clone-origin-c" label="ex-clone-origin-c"> + <statement> + <p> + Which line of output from entering the command from <xref ref="ex-clone-origin-a" /> indicates the directory into which the repository was cloned? + </p> + </statement> - <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> - <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> - What does the "IMPORTANT" line ask you to do? - </p> - </statement> <choices randomize="yes"> <choice correct="yes"> <statement> - <p> - Close the terminal and open a new one. - </p> + Cloning into + </statement> + </choice> + + <choice correct="no"> + <statement> + remote: Enumerating objects + </statement> + </choice> + + <choice correct="no"> + <statement> + remote: Counting objects </statement> </choice> - <choice> + + <choice correct="no"> <statement> - <p> - Take the Kit-tty for a walk. - </p> + remote: Total </statement> - <feedback> - <p> - I'm sure the Kit-tty would like that, but its not the correct answer. - </p> - </feedback> </choice> - <choice> + + <choice correct="no"> <statement> - <p> - Use the <c>git clone</c> command. - </p> + Receiving objects </statement> </choice> - <choice> + + <choice correct="no"> <statement> - <p> - Delete some unnecessary files. - </p> + Resolving deltas </statement> </choice> </choices> - </task> - <task - xml:id="ex-close-terminal-linux-b" - label="ex-close-terminal-linux-b"> + + <hint> + <p> + Look for a line in the output that begins with "Cloning into". + </p> + </hint> +</exercise> + +<exercise xml:id="ex-clone-origin-d" label="ex-clone-origin-d"> + <statement> + <p> + Use the <c>ls</c> command to confirm that the directory you identified in <xref ref="ex-clone-origin-c" /> now exists. + </p> + + <p> + If it it does not, check the output in <xref ref="ex-clone-origin-b" /> for error messages and try <xref ref="ex-clone-origin-a" /> again. + </p> + </statement> +</exercise> +</exercises> +</subsection> + +<subsection xml:id="topic-explore-clone"> + <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-a" label="ex-explore-clone-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-c" /> for the name of the directory. + </p> + </statement> +</exercise> + + <exercise xml:id="ex-explore-clone-b" label="ex-explore-clone-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> + + <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"> <statement> <p> - If you haven't already, close the Terminal you are currently using and open a new one. + <c>.</c> </p> + </statement> + </choice> + + <choice correct="yes"> + <statement> <p> - 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. + <c>..</c> </p> </statement> - </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"> + <choice correct="yes"> <statement> <p> - Use the <c>cd</c> command in the Terminal to change into the directory containing your clone of the GitKit FarmData2 repository. + <c>.git</c> </p> </statement> - <hint> + </choice> + + <choice> + <statement> <p> - See <xref ref="ex-clone-origin-linux-c" /> for the name of the directory. + <c>README.md</c> </p> - </hint> - </task> - <task - xml:id="ex-explore-clone-linux-b" - label="ex-explore-clone-linux-b"> + </statement> + </choice> + + <choice> <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. + <c>.kit</c> </p> + </statement> + </choice> + <choice> + <statement> <p> - Compare these files and directories to those in your origin repository on GitHub. Are there any differences? If so describe them here. + <c>.vscode</c> </p> </statement> - <response /> - </task> - </exercise> + </choice> + </choices> +</exercise> - <!-- 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> +</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> </statement> - <response /> - </exercise> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + <c>git remote -v</c> + </p> + </statement> + </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"> + <choice> <statement> <p> - Use the following command to ask Git to display a list of the remote repositories (i.e. those on GitHub) that it knows about: + <c>git remote</c> </p> + </statement> + </choice> + + <choice> + <statement> <p> - <c>git remote -v</c> + <c>git remote -url</c> </p> + </statement> + </choice> + + <choice> + <statement> <p> - Copy and paste the output of the <c>git remote -v</c> command here. + <c>git url</c> </p> </statement> - <response /> - </task> + </choice> + </choices> + + <hint> + <p> + You are asking <c>git remote</c> to give you more information. + </p> + </hint> + </exercise> - <task - xml:id="ex-check-remotes-b" - label="ex-check-remotes-b"> + <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"> <statement> <p> - Examine the output in <xref ref="ex-check-remotes-a" />. How can you tell from that output that your clone knows about your origin? + The "origin" lines have a URL with your GitHub username in them. </p> </statement> - <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"> + <choice> <statement> <p> - 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" />? + There are lines that say "origin". </p> </statement> - <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> - <task - xml:id="ex-check-remotes-d" - label="ex-check-remotes-d"> - <statement> + <choice> + <statement> <p> - Which step of the basic FOSS workflow requires that your clone know the location of your origin repository? + The "origin" lines have a URL that points to GitHub. </p> </statement> - <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> + </choice> - </exercise> + <choice> + <statement> + <p> + It is not possible to tell from the output. + </p> + </statement> + </choice> + </choices> + + <hint> + <p> + Look closely at the "origin" URLs. + </p> + </hint> + </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> + + + <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> + <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> + <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> + <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 fork of the GitKit FarmData2 upstream repository 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 your clone of the GitKit FarmData2 repository. + </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 folder containing your clone of the <c>GitKit FarmData2</c> 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" label="ex-kit-tty"> + <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. + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + A terminal. + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + A teletypewriter. + </p> + </statement> + </choice> + + <choice> + <statement> + <p> + A pet kitten. + </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> +<!--- + + +--> </section> diff --git a/source/ch-communities-and-collaboration/sec-development-environment.ptx b/source/ch-communities-and-collaboration/sec-development-environment.ptx index 41f1270..5992e6d 100644 --- a/source/ch-communities-and-collaboration/sec-development-environment.ptx +++ b/source/ch-communities-and-collaboration/sec-development-environment.ptx @@ -9,609 +9,564 @@ <introduction xml:id="topic-dev-env-intro"> <p> - 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. + 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. </p> <p> - 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>. + 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>. </p> <p> - 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. + 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. </p> </introduction> - <subsection> - <title>Starting the Development Environment + + Creating the Development Environment

- In this section you will learn how to start, configure, stop, and restart your 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.

- - - <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-kit-client" - label="ex-create-kit-client" - component="linux-kit-client"> + xml:id="ex-create-devenv" + label="ex-create-devenv"> <introduction> <p> - The following tasks will guide you through the process of starting and configuring your development environment. + The following tasks will guide you through the process of creating the development environment. </p> </introduction> <task - xml:id="ex-create-kit-client-linux-a" - label="ex-create-kit-client-linux-a"> + xml:id="ex-github-login" + label="ex-github-login"> <statement> <p> - 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. + Ensure that you are logged into the GitHub account that you listed in <xref ref="ex-github-account-url" />. </p> </statement> </task> + <task - xml:id="ex-create-kit-client-linux-b" - label="ex-create-kit-client-linux-b"> + xml:id="ex-create-codespace" + label="ex-create-codespace"> <statement> <p> - 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> + 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>. </p> </statement> </task> - <task - xml:id="ex-create-kit-client-linux-c" - label="ex-create-kit-client-linux-c"> + + <task + xml:id="ex-create-codespace-button" + label="ex-create-codespace-button"> <statement> <p> - 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> + Click the "Create new codespace" button on the page that appears. </p> </statement> </task> + <task - xml:id="ex-create-kit-client-linux-d" - label="ex-create-kit-client-linux-d"> + xml:id="ex-paste-pat-prompt" + label="ex-paste-pat-prompt"> <statement> <p> - Click the link in your output that is similar to the one that is shown above. + 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> </p> </statement> </task> + <task - xml:id="ex-create-kit-client-linux-e" - label="ex-create-kit-client-linux-e"> + xml:id="ex-paste-pat" + label="ex-paste-pat"> <statement> <p> - Click the "Connect" button that appears in your browser. + 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. </p> - <p> - 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" />. + If you have lost or did not save your PAT, revisit <xref ref="topic-github-pat" /> and create a new one. </p> + </statement> + </task> + <task + xml:id="ex-devenv-ready" + label="ex-devenv-ready"> + <statement> <p> - <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> + 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. </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-configure-kit-client-linux" - label="ex-configure-kit-client-linux" - component="linux-kit-client"> + xml:id="ex-stopping-devenv" + label="ex-stopping-devenv"> <introduction> <p> - There are a few additional things that you can to to make working in your development environment more convenient. + Use the following steps to practice stopping the development environment. </p> </introduction> - <task - xml:id="ex-configure-kit-client-linux-a" - label="ex-configure-kit-client-linux-a"> + <task + xml:id="ex-stopping-devenv-a" + label="ex-stopping-devenv-a"> <statement> <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> + Click on the word "Codespaces" in the bottom left of the browser window. + </p> </statement> </task> - <task - xml:id="ex-configure-kit-client-linux-b" - label="ex-configure-kit-client-linux-b"> + <task + xml:id="ex-stopping-devenv-b" + label="ex-stopping-devenv-b"> <statement> <p> - 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> - <p> - 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. + Select "Stop Current Codespace" from the menu that appears in the top center of the browser window. </p> + </statement> + </task> + <task + xml:id="ex-stopping-devenv-c" + label="ex-stopping-devenv-c"> + <statement> <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". + Close the browser tab containing the development environment. </p> </statement> </task> </exercise> + </exercises> + </subsection> - <!-- The VSCode KitClient Instructions --> + <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. +

+
+ + <exercise - xml:id="ex-create-kit-client-vscode" - label="ex-create-kit-client-vscode" - component="vscode-kit-client"> + xml:id="ex-restarting-devenv" + label="ex-restarting-devenv"> <introduction> <p> - The following tasks will guide you through the process of starting and configuring your development environment. + Use the following steps to restart the development environment. </p> </introduction> - - <task - xml:id="ex-create-kit-client-vscode-a" - label="ex-create-kit-client-vscode-a"> + <task + xml:id="ex-restart-devenv-link" + label="ex-restart-devenv-link"> <statement> <p> - Click this link to - <url href="https://gitpod.io/workspaces" visual="https://gitpod.io/workspaces">Launch KitClient</url> in GitPod. + 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> </statement> </task> - <task - xml:id="ex-create-kit-client-vscode-b" - label="ex-create-kit-client-vscode-b"> + xml:id="ex-resume-codespace" + label="ex-resume-codespace"> <statement> <p> - Paste the URL of your GitKit FarmData2 repository from <xref ref="ex-fork-url" /> into the text box and press "Enter". + Click the "Resume this codespace" button. </p> - </statement> - </task> - - <task - xml:id="ex-create-kit-client-vscode-c" - label="ex-create-kit-client-vscode-c"> - <statement> <p> - 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> + Do not click the "Create a new one" button because a new development environment will not contain any of your prior work. </p> </statement> </task> - <task - xml:id="ex-create-kit-client-vscode-d" - label="ex-create-kit-client-vscode-d"> + xml:id="ex-wait-for-codespace" + label="ex-wait-for-codespace"> <statement> - <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> + 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> - <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> - <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> + <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> </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> - <title>Configuring the Git Client + + 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 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. + 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.

- <!-- Linux KitClient --> <exercise - xml:id="ex-open-terminal-linux" - label="ex-open-terminal-linux" - component="linux-kit-client"> + xml:id="ex-git-version" + label="ex-git-version"> <introduction> <p> - You will interact with Git using its command line interface via a <code>Terminal</code>. Use the following steps to open a Terminal. + The Git CLI is accessed by using the <c>git</c> command in the terminal. </p> </introduction> <task - xml:id="ex-open-terminal-a-linux" - label="ex-open-terminal-a-linux"> + xml:id="ex-git-version-a" + label="ex-git-version-a"> <statement> <p> - Click the "Terminal" icon at the bottom of the development environment window to open a new Terminal. + Using the <c>git</c> command without any additional arguments displays information about how to use <c>git</c>. </p> - </statement> - </task> - <task - xml:id="ex-open-terminal-b-linux" - label="ex-open-terminal-b-linux"> - <statement> <p> - Enter your name at the prompt and press enter. This will customize the Terminal prompt for you. + Enter the command <c>git</c> into the terminal in the development environment and press enter. </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-a" - label="ex-git-version-a"> - <statement> - <p> - Enter the command <c>git</c> into the Terminal. - </p> - </statement> - </task> <task xml:id="ex-git-version-b" label="ex-git-version-b"> <statement> <p> - Give a <c>git</c> command that will cause ,<c>git</c> to display its version. + 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." </p> - <response /> </statement> - <hint> - <p> - Use the output from <xref ref="ex-git-version-a" /> to determine what flag to pass to <c>git</c>. - </p> - </hint> - </task> - <task - xml:id="ex-git-version-c" - label="ex-git-version-c"> + <choices randomize="yes"> + <choice correct="yes"> <statement> <p> - What version of the <c>git</c> command line client is installed in your development environment? + <c>git status</c> </p> - <response /> </statement> - <hint> + <feedback> <p> - Use the command that you identified in <xref ref="ex-git-version-b" /> to determine the <c>git</c> version. + The <c>git status</c> command causes <c>git</c> to display the status of the working tree. </p> - </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"> + </feedback> + </choice> + <choice> <statement> <p> - Use the following command to set the name that Git will associate with your changes: - </p> - <p> - <c>git config --global user.name "<name>"</c> - </p> - <p> - Replace <c>"<name>"</c> with the name you wish to use and be sure not to include the < and >. + <c>git tree</c> </p> </statement> - </task> - <task - xml:id="ex-configure-git-b" - label="ex-configure-git-b"> - <statement> + <feedback> <p> - Use the following command to set the e-mail that Git will associate with your changes: + Check the output of the <c>git</c> command. </p> + </feedback> + </choice> + <choice> + <statement> <p> - <c>git config --global user.email "<e-mail>"</c> + <c>git working-tree</c> </p> + </statement> + <feedback> <p> - Replace <c>"<e-mail>"</c> with the name you wish to use and be sure not to include the < and >. + Check the output of the <c>git</c> command. </p> - </statement> - </task> - <task - xml:id="ex-configure-git-c" - label="ex-configure-git-c"> + </feedback> + </choice> + <choice> <statement> <p> - Use the following command to display Git's global configuration including the two new settings you just added: + <c>git show</c> </p> + </statement> + <feedback> <p> - <c>git config --global --list</c> + Check the output of the <c>git</c> command. </p> + </feedback> + </choice> + </choices> + <hint> <p> - Give the output of this command as your answer for this task. + Check the output of the <c>git</c> command for the command that will "Show the working tree status." </p> - </statement> - <response /> + </hint> </task> </exercise> </exercises> </subsection> - <subsection> - <title>Adjusting some GitPod Settings + + Configuring the Git Client

- There are a few GitPod settings that you can change that will make working with your development environment more convenient. + 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.

+ - + <title/> + <exercise - xml:id="ex-gitpod-settings" - label="ex-gitpod-settings"> - <introduction> + xml:id="ex-git-config-name" + label="ex-git-config-name"> + <statement> <p> - Use the following steps to adjust your GitPod settings. + The <c>git config --global user.name "<name>"</c> command sets the name that Git will associate with your changes. </p> - </introduction> - <task - xml:id="ex-gitpod-settings-a" - label="ex-gitpod-settings-a"> + <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> + + <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> + <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. + </p> + </statement> + <choices randomize="yes"> + <choice correct="yes"> <statement> <p> - Open your GitPod workspaces in a browser by visiting <url href="https://gitpod.io/workspaces" />. + <c>user.name</c> </p> </statement> - </task> - <task - xml:id="ex-gitpod-settings-b" - label="ex-gitpod-settings-b"> - <statement> + <feedback> <p> - 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. + <c>user.name</c> should be set to the name you used above. </p> - </statement> - </task> - <task - xml:id="ex-gitpod-settings-c" - label="ex-gitpod-settings-c"> + </feedback> + </choice> + <choice correct="yes"> <statement> <p> - 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. + <c>user.email</c> </p> </statement> - </task> - <task - xml:id="ex-gitpod-settings-d" - label="ex-gitpod-settings-d"> - <statement> + <feedback> <p> - Open your GitPod preferences in a browser by visiting <url href="https://gitpod.io/user/preferences" />. + <c>user.email</c> should be set to the email you used above. </p> - </statement> - </task> - <task - xml:id="ex-gitpod-settings-e" - label="ex-gitpod-settings-e"> + </feedback> + </choice> + <choice correct="yes"> <statement> <p> - 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" />. + <c>core.editor</c> </p> </statement> - </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> + <feedback> <p> - Open your GitPod workspaces in a browser by visiting <url href="https://gitpod.io/workspaces" /> + <c>core.editor</c> should be set to the nano editor. </p> - </statement> - </task> - <task - xml:id="ex-stopping-dev-env-b" - label="ex-stopping-dev-env-b"> + </feedback> + </choice> + <choice> <statement> <p> - Choose "Stop" from the "⋮" (three vertical dots) menu to the right of the "GitKit Dev Env" workspace. + <c>git.user</c> </p> </statement> - </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> + <feedback> <p> - Open your GitPod workspaces in a browser by visiting <url href="https://gitpod.io/workspaces" /> + <c>git.user</c> is not a setting. </p> - </statement> - </task> - <task - xml:id="ex-restarting-dev-env-b" - label="ex-restarting-dev-env-b"> + </feedback> + </choice> + <choice> <statement> <p> - Click the name of your "GitKit Dev Env" workspace or choose "Open" from the "⋮" (three vertical dots) menu to the right of its name. + <c>gitkit.class</c> </p> </statement> - </task> - <task - xml:id="ex-restarting-dev-env-c" - label="ex-restarting-dev-env-c" - component="linux-kit-client"> - <statement> + <feedback> <p> - Wait for the text similar to that in <xref ref="ex-create-kit-client-linux-c" /> to appear and click the link. + <c>gitkit.class</c> is not a setting. </p> - </statement> - </task> + </feedback> + </choice> + </choices> </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 eecf95c..2f5d522 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/.+/.+"> + <condition string="^https://github\.com/(?!(openmrs/openmrs-distro-referenceapplication|apache/fineract|sahana/eden|oppia/oppia)).*$"> <feedback> <p> Thank you. @@ -104,63 +104,105 @@ </var> </setup> <hint> - 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" - component="linux-kit-client"> - <statement> - <p> - Clone your origin (i.e. your fork) for the project you selected into your development environment. - </p> <p> - Copy and paste the Git commands that you used and their output here. + Make sure you are giving the URL for your fork, not the project's upstream URL. Review <xref ref="topic-forking-the-upstream" /> for information on how to fork a repository on GitHub. </p> - </statement> - <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> + xml:id="ex-extra-practice-clone" + label="ex-extra-practice-clone"> + <statement> <p> - Briefly describe how you created the the development environment, and thus cloned your origin, for the project you have chosen. + Pick and order the commands to change to your home directory, clone your fork of the project you chose and check its remotes. </p> </statement> - <response /> + <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> <hint> - Review <xref ref="topic-development-environment" /> for information about how to create a new GitPod workspace (i.e. development environment). + <p> + Review <xref ref="topic-cloning-your-origin" /> for information about how to clone your origin repository. + </p> </hint> </exercise> <exercise xml:id="ex-extra-practice-remotes" label="ex-extra-practice-remotes"> - <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> + <statement> + <p> + In your terminal enter the commands from <xref ref="ex-extra-practice-clone" />. + </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> </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 f62dfe1..e7bd846 100644 --- a/source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx +++ b/source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx @@ -51,27 +51,34 @@ <setup> <var> - <condition string="^https://github.com/((?!(FarmData2/FarmData2|DickinsonCollege/FarmData2)).)*$"> + <condition string="^https://github\.com/(?!(yourClass|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2)).*$"> <feedback> <p> Thank you. </p> </feedback> </condition> - <condition string="^https://github.com/DickinsonCollege/FarmData2"> + <condition string="^https://github\.com/DickinsonCollege/FarmData2"> <feedback> <p> Looks like you might be trying to use the real FarmData2 upstream. Be sure to use the URL that your instructor has given you. </p> </feedback> </condition> - <condition string="^https://github.com/FarmData2/FarmData2"> + <condition string="^https://github\.com/FarmData2/FarmData2"> <feedback> <p> Looks like you might be trying to use the real FarmData2 upstream. Be sure to use the URL that your instructor has given you. </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> @@ -82,7 +89,12 @@ </var> </setup> <hint> - Check the course materials from your instructor. It should provide the URL of the GitKit FarmData2 repository that was created for your course. + <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> </hint> </exercise> @@ -123,7 +135,7 @@ > <statement> <p> - 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. + 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. </p> </statement> </task> @@ -144,27 +156,34 @@ <setup> <var> - <condition string="^https://github.com/((?!(FarmData2/FarmData2|DickinsonCollege/FarmData2)).)*$"> + <condition string="^https://github\.com/(?!(yourGitHub|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2)).*$"> <feedback> <p> Thank you. </p> </feedback> </condition> - <condition string="^https://github.com/DickinsonCollege/FarmData2"> + <condition string="^https://github\.com/DickinsonCollege/FarmData2"> <feedback> <p> Looks like you might be giving the URL of the real FarmData2 upstream. Be sure to give the URL of the fork you created in your GitHub space. </p> </feedback> </condition> - <condition string="^https://github.com/FarmData2/FarmData2"> + <condition string="^https://github\.com/FarmData2/FarmData2"> <feedback> <p> Looks like you might be trying to use the real FarmData2 upstream. Be sure to give the URL of the fork you created in your GitHub space. </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> @@ -175,7 +194,9 @@ </var> </setup> <hint> - 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. + </p> </hint> </exercise> @@ -193,14 +214,38 @@ 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 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. + 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? </p> - </statement> - <response /> + </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> <hint> - 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. + </p> </hint> </task> @@ -251,24 +296,65 @@ </choice> </choices> <hint> - 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. + </p> </hint> </task> - +<!-- <task xml:id="ex-upstream-ref-from-origin-c" label="ex-upstream-ref-from-origin-c" > <statement> <p> - Explain in a few sentences why your origin repository keeps track of the location of the upstream repository from which it was forked. + Why does your origin repository keep track of the location of the upstream repository from which it was forked? </p> </statement> - <response /> + <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> <hint> - Be sure to state which operation in the basic FOSS workflow uses this information and the function performed by that operation. + <p> + Think about which steps of the basic FOSS workflow need access back to the main project. + </p> </hint> </task> +--> </exercise> <exercise @@ -279,10 +365,47 @@ When you forked the upstream repository, GitHub made a copy of that repository into your GitHub space. </p> <p> - 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? + 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? </p> </statement> - <response /> + <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> </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 01640a0..b3495bb 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 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. + 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.

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 56628d1..c2b9a65 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 <clone URL> + git 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 deleted file mode 100644 index 335196e..0000000 --- a/source/ch-communities-and-collaboration/sec-github-account.ptx +++ /dev/null @@ -1,60 +0,0 @@ - - -
- 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 new file mode 100644 index 0000000..56c19ff --- /dev/null +++ b/source/ch-communities-and-collaboration/sec-github-set-up.ptx @@ -0,0 +1,192 @@ +<?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/(?!(yourUsername)).+$"> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> + <condition string="https://github\.com/yourUsername"> + <feedback> + <p> + Looks like you are using the example given. Be sure to give the URL of your actual GitHub profile. + </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 ebbdb5a..5a2629b 100644 --- a/source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx +++ b/source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx @@ -1,24 +1,19 @@ <?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. @@ -28,420 +23,538 @@

+ Exploring the Issue Tracker + - - <exercise - xml:id="ex-find-the-issue-tracker" - label="ex-find-the-issue-tracker" - > - <introduction> + <title /> + <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> - The tasks in this exercise will help you to find the issue tracker for the GitKit FarmData2 repository that you will be using. + 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> - </introduction> + </statement> + </task> - <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> - - <exercise - xml:id="ex-explore-the-issue-tracker" - label="ex-explore-the-issue-tracker" - > - <introduction> + <task xml:id="ex-find-the-issue-tracker-b" label="ex-find-the-issue-tracker-b"> + <statement> <p> - Use the issue tracker in the GitKit FarmData2 repository to complete the following tasks. + 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> - </introduction> + </statement> + </task> + </exercise> - <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> + <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-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> + <p> Be sure you are looking at issue #10. - </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. - </hint> - </task> + </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> - <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> - Be sure you are looking at issue #11. - </hint> - </task> - - <task - xml:id="ex-explore-the-issue-tracker-d" - label="ex-explore-the-issue-tracker-d" - > - <statement> - <p> - Which of the following indicate an order by which the issues can be sorted? - </p> - </statement> - <choices randomize="yes"> - <choice correct="yes"> - <statement> - Newest - </statement> - </choice> - <choice correct="yes"> - <statement> - Oldest - </statement> - </choice> - <choice correct="yes"> - <statement> - Recently updated - </statement> - </choice> - <choice correct="yes"> - <statement> - Most commented - </statement> - </choice> - <choice correct="no"> - <statement> - Most difficult - </statement> - </choice> - <choice correct="no"> - <statement> - Highest priority - </statement> - </choice> - </choices> - <hint> - Find the "Sort" drop-down in the issue tracker and see what "Sort by" options there are. - </hint> - </task> - - <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> + <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> - <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. -

-

- The following exercises will guide you through the process of claiming an issue to work on in the GitKit FarmData2 issue tracker. -

-
- - + <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> - <exercise - xml:id="ex-identifying-assigned-issues" - label="ex-identifying-assigned-issues" - > + <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> + 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> - Examine the GitKit FarmData2 issue tracker. - How can you tell which issue have already been assigned? + 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> - The avatar of the assigned user appears to the right of the issue title. + <statement> + ONBOARDING.md + </statement> + </choice> + + <choice correct="no"> + <statement> + INSTALL.md </statement> </choice> + <choice correct="no"> - <statement> - The issue no longer appears in the issue tracker. + <statement> + CONTRIBUTING.md </statement> </choice> + <choice correct="no"> - <statement> - The username of assigned user appears next to the issue title. + <statement> + LICENSE.md + </statement> + </choice> + </choices> + + <hint> + <p> + Be sure you are looking at issue #11. + </p> + </hint> + </task> + + <task xml:id="ex-explore-the-issue-tracker-d" label="ex-explore-the-issue-tracker-d" > + <statement> + <p> + Which of the following indicate an order by which the issues can be sorted? + </p> + </statement> + + + <choices randomize="yes"> + <choice correct="yes"> + <statement> + Newest + </statement> + </choice> + + <choice correct="yes"> + <statement> + Oldest </statement> </choice> + + <choice correct="yes"> + <statement> + Recently updated + </statement> + </choice> + + <choice correct="yes"> + <statement> + Most commented + </statement> + </choice> + <choice correct="no"> - <statement> - The issue is moved to a separate list of assigned issues. + <statement> + Most difficult </statement> </choice> + <choice correct="no"> - <statement> - The issue tracker does not show any indication that an issue has been assigned. + <statement> + Highest priority </statement> </choice> </choices> <hint> - Look for some lines for issues that look different than the others and hover your mouse over the different parts. - </hint> - </exercise> + <p> + Find the sort drop-down (which will be headed either "Newest" or "Oldest" depending on how it was last set) in the issue tracker and see what sort by options are available. + </p> + </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> + </subsection> + + <subsection> + <title>Claiming an Issue + +

- 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: -

- -

- I would like to work on this please! + 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.

- 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 . + The following exercises will guide you through the process of claiming an issue to work on in the GitKit FarmData2 issue tracker.

+
- - -

- Use the GitKit FarmData2 issue tracker to complete the following tasks. -

-
- - + + + <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> - <p> - Choose an unassigned issue with a "Round 1" tag. - </p> - </statement> - <hint> - See <xref ref="ex-identifying-assigned-issues" /> for information about identifying assigned and unassigned issues. - </hint> - </task> + The avatar of the assigned user appears to the right of the issue title. + </statement> + </choice> - <task - xml:id="ex-claim-an-issue-b" - label="ex-claim-an-issue-b"> + <choice correct="no"> <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> - <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"> + The issue no longer appears in the issue tracker. + </statement> + </choice> + + <choice correct="no"> <statement> - <p> - Reload the issue tracker and check that you received a response and that the issue has been assigned to you. - </p> + The username of assigned user appears next to the issue title. </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> + </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> - <exercise - xml:id="ex-round1-issue-url" - label="ex-round1-issue-url"> + <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"> <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> + Choose an unassigned issue with a "Round 1" tag. + </p> + </statement> + + <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> - <var width="60" /> + 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> - <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> + + <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> + + + <task xml:id="ex-claim-an-issue-c" label="ex-claim-an-issue-c"> + <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? + Reload the issue tracker and check that you received a response and that the issue has been assigned to you. </p> </statement> - <response /> + <hint> - Think about this from both the individual developer's perspective and from the overall project's perspective. + <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> - </exercise> - </exercises> + </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/(?!(my-class|FarmData2/FarmData2|DickinsonCollege/FarmData2)).+/issues/[0-9]+$"> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> + <condition string="https://github\.com/my-class/GitKit-FarmData2/issues/2"> + <feedback> + <p> + Looks like you are trying to use the example above. Be sure to use the URL for your actual issue. + </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"> + <statement> + <p> + To prevent wasting effort by having two developers work on the same issue. + </p> + </statement> + <feedback> + <p> + Assigning issues can help prevent people from duplicating work. + </p> + </feedback> + </choice> + <choice> + <statement> + <p> + Allow a developer to "hold on" to an issue, even if they are not currently working on it. + </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> + <p> + To plan in advance who will be working each issue. + </p> + </statement> + <feedback> + <p> + Assigning issues could work like creating a ToDo list for core project contributors. + </p> + </feedback> + </choice> + </choices> + <hint> + <p> + Think about this from both the individual developer's perspective and from the overall project's perspective. + </p> + </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 ce23b58..da11ef3 100644 --- a/source/ch-instructor-guide/ch-instructor-guide.ptx +++ b/source/ch-instructor-guide/ch-instructor-guide.ptx @@ -7,28 +7,23 @@ <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/vscode-kitclient.png b/source/ch-instructor-guide/images/codespace-kitclient.png similarity index 100% rename from source/ch-instructor-guide/images/vscode-kitclient.png rename to source/ch-instructor-guide/images/codespace-kitclient.png diff --git a/source/ch-instructor-guide/images/deployer-done.png b/source/ch-instructor-guide/images/deployer-done.png new file mode 100644 index 0000000..176817b Binary files /dev/null and b/source/ch-instructor-guide/images/deployer-done.png differ diff --git a/source/ch-instructor-guide/images/deployer-kitscript.png b/source/ch-instructor-guide/images/deployer-kitscript.png new file mode 100644 index 0000000..9b72963 Binary files /dev/null and b/source/ch-instructor-guide/images/deployer-kitscript.png differ diff --git a/source/ch-instructor-guide/images/linux-kitclient.png b/source/ch-instructor-guide/images/linux-kitclient.png deleted file mode 100644 index 5b33921..0000000 Binary files a/source/ch-instructor-guide/images/linux-kitclient.png and /dev/null differ diff --git a/source/ch-instructor-guide/sec-instructor-communities.ptx b/source/ch-instructor-guide/sec-instructor-communities.ptx index ca6ba5e..1dce890 100644 --- a/source/ch-instructor-guide/sec-instructor-communities.ptx +++ b/source/ch-instructor-guide/sec-instructor-communities.ptx @@ -24,7 +24,7 @@ </li> <li> <p> - Fork the upstream `GitKit-FarmData2` repository into their own GitHub space. + Fork the upstream of the GitKit FarmData2 repository into their own GitHub space. </p> </li> <li> @@ -34,7 +34,7 @@ </li> <li> <p> - Clone their fork (i.e. their origin) of the `GitKit-FarmData2` repository. + Clone their fork (i.e. their origin) of the GitKit FarmData2 repository. </p> </li> </ol> @@ -146,7 +146,7 @@ The slides conclude with a short introduction to the idea of an issue tracker and its role in a project. The use of the issue tracker tends to be fairly intuitive and the hands-on activities walk students through some of the details. The hands-on activity has each student claim an issue that is labeled as "Round 1." Note that they claim the issue in this activity, but do not fix it until the next activity. Each of these issues asks them to fix a typo that appears in one of the Markdown (<c>.md</c>) files in the root directory of the project. </p> <p> - If time permits, a live demo looking at the issue tracker in the upstream GitKit-FarmData2 repository, pointing out the "Round 1" label and how to tell if an issue has been assigned. Note that several of the issues will have been pre-assigned to whomever deployed the kit. + If time permits, a live demo looking at the issue tracker in the upstream GitKit FarmData2 repository, pointing out the "Round 1" label and how to tell if an issue has been assigned. Note that several of the issues will have been pre-assigned to whomever deployed the kit. </p> </li> </ul> @@ -174,35 +174,32 @@ <ul> <li> <em> - <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> + <xref ref="ex-clone-url" /> </p> </em> <p> - 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. + 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. </p> </li> <li> <em> <p> - <xref ref="ex-check-remotes" /> + <xref ref="ex-clone-origin" /> </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. + 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. </p> </li> <li> <em> <p> - <xref ref="ex-identifying-assigned-issues" /> + <xref ref="ex-check-remotes-b" /> </p> </em> <p> - 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. + 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> @@ -222,7 +219,7 @@ </p> </em> <p> - Some students will attempt to clone the project that they select while they are inside the GitKit-FarmData2 repository that they already cloned. If they do attempt this the Kit-tty should intervene, prevent the action and respond with a helpful message. + Some students will attempt to clone the project that they select while they are inside the directory containing their local GitKit FarmData2 repository. If they do attempt this the Kit-tty should intervene, prevent the action and respond with a helpful message. </p> </li> </ul> diff --git a/source/ch-instructor-guide/sec-instructor-intro.ptx b/source/ch-instructor-guide/sec-instructor-intro.ptx index dcda72a..af23a3f 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 help with GitKit, you can <url href="https://discord.gg/83Sb4csCeT">chat with us on Discord.</url> + For questions or assistance with GitKit, you can <url href="https://discord.gg/83Sb4csCeT">chat with us on Discord.</url> </p> </introduction> @@ -28,26 +28,18 @@ <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/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> - . + <url href="https://runestone.academy/ns/books/published/gitkit/the-gitkit-book.html?mode=browsing">GitKit</url> text. </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 component="linux-kit-client">gitkitlinux</term> - <term component="vscode-kit-client">gitkitvscode</term> + <term>gitkit</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 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. + 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. </p> </li> <li> @@ -57,10 +49,10 @@ </li> <li> <p> - 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. + Click to <url href="https://codespaces.new/HFOSSedu/GitKit-Deployer-Codespaces?quickstart=1">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. + 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. </p> </li> <li> @@ -70,7 +62,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> @@ -111,7 +103,7 @@ </li> <li> <p> - 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. + Read <xref ref="topic-gitkit-development-environments" text="type-global-title" /> to learn about the development environment that students use with the GitKit. </p> </li> <li> @@ -122,7 +114,7 @@ </li> <li> <p> - 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. + 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. </p> </li> <li> @@ -132,7 +124,7 @@ </li> <li> <p> - Follow the steps in <xref ref="topic-gitkit-deploy" text="type-global-title" /> to deploy the GitKit for use in your course. + 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. </p> </li> <li> @@ -142,7 +134,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 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, feature requests or bugs. </p> </li> </ol> @@ -154,7 +146,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. 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. + 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.

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

  • - 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. + Students complete the hands-on activities contained in each chapters of this text as 2-3 hours of homework or during assigned lab periods.

  • - 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. + 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:

    • - 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: + Limited Coverage: The first two GitKit topics form a cohesive unit and can be completed without continuing onto the final two topics.

    • @@ -188,12 +180,12 @@
    • - 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. + 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.

    • - 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.

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

      - 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. + The content of the GitKit is broken into the chapters below.

      • @@ -235,7 +227,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.

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

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

        - 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 ). + 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 ).

        - 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 ). + 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. + + +

        - +

        - 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. - . + 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.

        The Kit-tty Virtual Assistant

        - 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. + 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.

        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).

        • @@ -401,7 +352,7 @@
          • - 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!" + 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!"

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

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

          @@ -429,7 +380,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, 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. + 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.

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

        • Create a Runestone course using the - 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) - . + GitKit text.

        • 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 - gitkitlinux - gitkitvscode - base course into your course. + gitkit 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.

          - 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. + 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 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. + 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.

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

            - 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. + 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.

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

          • @@ -589,7 +533,29 @@
          • - Click this link to Deploy the GitKit FarmData2 repository . + 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. + + +

          • @@ -603,7 +569,7 @@
          • - 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. + The GitHub username or the name of a GitHub organization to which you have write permission as the location to deploy the upstream repository.

          • @@ -616,18 +582,26 @@
          • - 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 to the following that shows the URL of your deployed GitKit FarmData2 repository. + 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. + + +

            -

            -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.

            @@ -642,7 +616,7 @@ https://github.com/someLocation/GitKit-FarmData2
          • - 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. + 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.

          • @@ -653,6 +627,7 @@ https://github.com/someLocation/GitKit-FarmData2 Instructor Materials +

            The following links provide easy access to the chapters with the hands-on exercises, the presentation slides for each chapter and a set of instructor notes for each chapter. The Instructor Notes for each chapter include Slide Notes, a To-Do List, and Exercise Notes. The Slide Notes give an overview of the slides and then slide-by-slide information for the instructor. The To-Do List enumerates any tasks that the instructor should be sure to do before the class meeting. The Exercise Notes provide some helpful comments on specific hands-on exercises. @@ -722,6 +697,7 @@ https://github.com/someLocation/GitKit-FarmData2

          +

          @@ -733,7 +709,7 @@ https://github.com/someLocation/GitKit-FarmData2

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

          @@ -741,7 +717,7 @@ https://github.com/someLocation/GitKit-FarmData2

          - Active work on the deployer and the KitClients takes place in the Kits section of the HFOSSedu GitLab Organization. + 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.

    \ 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 2fc641f..1cd61ae 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 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. + 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.

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

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

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

    - 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. + 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.

  • - Slide 24-25 + 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

    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. @@ -187,37 +195,30 @@

  • - - + -

    - 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. + 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.

  • - +

    - 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. + 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.

    -
  • -
  • - -

    - . -

    -

    - 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. + 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.

  • - . + .

    diff --git a/source/ch-instructor-guide/sec-instructor-synchronization.ptx b/source/ch-instructor-guide/sec-instructor-synchronization.ptx index 6c83aed..68ed505 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, who's 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, whose PR's cannot be merged automatically or are missing the "Closes" or "Fixes" lines.

  • @@ -193,15 +193,12 @@
  • -

    - -

    -

    - +

    +

    - It is a good idea to check here that the student's upstream remote points to the correct GitKit-FarmData2 repository. The Kit-tty should have caught this error and directed students on the correct way to set the upstream remote. However, some students have still managed to set their upstream to point to their origin or to the live FarmData2 repository. + It is a good idea to check here that the student's upstream remote points to the correct GitKit FarmData2 repository. The Kit-tty should have caught this error and directed students on the correct way to set the upstream remote. However, some students have still managed to set their upstream to point to their origin or to the live FarmData2 repository.

  • @@ -217,7 +214,7 @@
  • - - . + - .

    diff --git a/source/ch-instructor-guide/sec-instructor-upstreaming.ptx b/source/ch-instructor-guide/sec-instructor-upstreaming.ptx index 7747b42..10efffe 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 . + 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 .

    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 chapters 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 locations provide the students with instructions for resolving the issues at the point where they arise.

  • @@ -155,16 +155,6 @@ 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 3185d92..4bbf864 100644 --- a/source/ch-merge-conflicts/ch-merge-conflicts.ptx +++ b/source/ch-merge-conflicts/ch-merge-conflicts.ptx @@ -8,13 +8,14 @@

    - 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. + 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.

    + diff --git a/source/ch-merge-conflicts/images/basic-merge-tool-options.png b/source/ch-merge-conflicts/images/basic-merge-tool-options.png new file mode 100644 index 0000000..9610331 Binary files /dev/null and b/source/ch-merge-conflicts/images/basic-merge-tool-options.png differ diff --git a/source/ch-merge-conflicts/images/conflicting-upstream-changes.png b/source/ch-merge-conflicts/images/conflicting-upstream-changes.png index d0e7bf2..3ed481c 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 new file mode 100644 index 0000000..048ed15 Binary files /dev/null and b/source/ch-merge-conflicts/images/github-pr-conflict.png 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 new file mode 100644 index 0000000..a9d3c6c Binary files /dev/null and b/source/ch-merge-conflicts/images/github-pr-no-conflict.png differ diff --git a/source/ch-merge-conflicts/images/mergetool-settings.png b/source/ch-merge-conflicts/images/mergetool-settings.png deleted file mode 100644 index 466b22b..0000000 Binary files a/source/ch-merge-conflicts/images/mergetool-settings.png and /dev/null 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 deleted file mode 100644 index 8b59fb0..0000000 Binary files a/source/ch-merge-conflicts/images/mergetool-window-new-settings.jpg and /dev/null differ diff --git a/source/ch-merge-conflicts/images/mergetool-window.jpg b/source/ch-merge-conflicts/images/mergetool-window.jpg deleted file mode 100644 index 6f2401a..0000000 Binary files a/source/ch-merge-conflicts/images/mergetool-window.jpg and /dev/null differ diff --git a/source/ch-merge-conflicts/images/placeholder.txt b/source/ch-merge-conflicts/images/placeholder.txt deleted file mode 100644 index 4ecebfd..0000000 --- a/source/ch-merge-conflicts/images/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -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 new file mode 100644 index 0000000..945675e Binary files /dev/null and b/source/ch-merge-conflicts/images/synching-with-upstream-with-conflict.png differ diff --git a/source/ch-merge-conflicts/images/vscode-launch-mergetool.png b/source/ch-merge-conflicts/images/vscode-launch-mergetool.png deleted file mode 100644 index e9f415f..0000000 Binary files a/source/ch-merge-conflicts/images/vscode-launch-mergetool.png and /dev/null differ diff --git a/source/ch-merge-conflicts/sec-appendix-a.ptx b/source/ch-merge-conflicts/sec-appendix-a.ptx index 2d5020c..2bdfd73 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~1
    • +
    • git reset --hard HEAD~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 new file mode 100644 index 0000000..99f3471 --- /dev/null +++ b/source/ch-merge-conflicts/sec-confirming-the-merge-conflict.ptx @@ -0,0 +1,329 @@ + + +

    + 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 3048cef..fdd4119 100644 --- a/source/ch-merge-conflicts/sec-extra-practice.ptx +++ b/source/ch-merge-conflicts/sec-extra-practice.ptx @@ -12,103 +12,371 @@ <exercises> <title /> - <exercise xml:id="ex-extra-practice-merging-fetch-repo" label="ex-extra-practice-merging-fetch-repo"> + + <exercise + xml:id="ex-restarting-kitclient-for-extra-practice" label="ex-restarting-kitclient-for-extra-practice"> <statement> <p> - 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> + 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>. </p> <p> - 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" />). + 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: </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> - <choices> - <choice correct="yes"> - <statement> - <p> - I have fetched the branch - </p> - </statement> - </choice> + </exercise> + - <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 + 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> + Ensure that you are in the directory for your GitKit FarmData2 repository. Then 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> </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> - 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. + 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. </p> </statement> - <response /> + <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> </exercise> - <exercise xml:id="ex-extra-practice-merging-resolve-conflicts" label="ex-extra-practice-merging-resolve-conflicts"> - <statement> + <exercise + xml:id="ex-extra-practice-do-merge" + label="ex-extra-practice-do-merge"> + <introduction> <p> - 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. + Merging the <c>main</c> branch into the <c>merge-conflict-practice</c> branch will create some conflicts for you to resolve. </p> - </statement> - <choices> - <choice correct="yes"> - <statement> - <p> - I have resolved the conflicts - </p> - </statement> - </choice> + </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> - <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> + <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> + <statement> + <p> + 1 + </p> + </statement> + <feedback> + <p> + Correct. + </p> + </feedback> + </choice> + <choice correct="yes"> + <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> </exercise> - <exercise xml:id="ex-extra-practice-merging-save-commit" label="ex-extra-practice-merging-save-commit"> + <exercise xml:id="ex-extra-practice-resolving-conflicts" label="ex-extra-practice-resolving-conflicts"> <statement> <p> - 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. + Choose and order the steps below to describe the sequence of things that you will do to resolve the merge conflicts that were created. </p> </statement> - <response /> + <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> </exercise> - <exercise xml:id="ex-extra-practice-merging-push-pr" label="ex-extra-practice-merging-push-pr"> + <exercise xml:id="ex-extra-practice-pr-link" label="ex-extra-practice-pr-link"> <statement> <p> - 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. + 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" /> </p> </statement> - <response /> + <setup> + <var> + <condition string="^https://github\.com/(?!(FarmData2|DickinsonCollege/FarmData2)).+/pull/[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 for your course. It should have the format <c>https://github.com/yourCourse/repoName/pulls/xx</c>, where <c>xx</c> is a number. + </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> </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 7837ddf..037db17 100644 --- a/source/ch-merge-conflicts/sec-git-command-summary.ptx +++ b/source/ch-merge-conflicts/sec-git-command-summary.ptx @@ -15,30 +15,61 @@ <exercises> <title /> <exercise xml:id="ex-git-commands-summary-merging" label="ex-git-commands-summary-merging"> - <statement> + <introduction> <p> Match the tasks on the right with the appropriate git command listed on the left. The <...> notation indicates parameters that are needed to customize each use. </p> - </statement> - <matches> - <match> - <premise><c>git merge <target> </c></premise> - <response>Merge changes from source branches into a target branch</response> - </match> - <match> - <premise><c>git merge --abort </c></premise> - <response>Undo a merge that failed due to conflicts</response> - </match> - <match> - <premise><c>git mergetool </c></premise> - <response>Launch the configured graphical merge tool</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> + </introduction> + <task xml:id="ex-git-commands-summary-merging-pt1" label="ex-git-commands-summary-merging-pt1"> + <statement></statement> + <matches> + <match> + <premise><c>git switch <branch> </c></premise> + <response>Change the active 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> + </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> + </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> + </task> + + <task xml:id="ex-git-commands-summary-merging-pt2" label="ex-git-commands-summary-merging-pt2"> + <statement></statement> + <matches> + <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> + <hint> + <p> + Note that the tasks listed are in approximately the same order as they appear in the sections of this chapter. + </p> + </hint> + </task> </exercise> + </exercises> </section> 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 7d0d980..d361908 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,147 +8,378 @@ <introduction> <p> - 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> + 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. </p> </introduction> - <exercises> - <title /> + <subsection + xml:id="topic-branch-vocabulary" + label="topic-branch-vocabulary"> + <title>Branch Vocabulary + +

    + shows the merge example from the class slides. +

    - - -

    - If you are going to merge the changes from the main branch into your feature branch, which branches will be the source branches? Which branch will be the target branch? -

    -
    - - - Source Branches - main - - - Target Branch - feature branch - - -
    - - - -

    - The git merge <branch name> command will attempt to merge the changes in the active branch with the changes in <branch name> (i.e. the source branches) into a merge commit in the currently active branch (i.e. the target branch). -

    -
    - +

    +

    + Merging the main branch into a feature branch. + + + Illustration of the main branch being merged into a feature branch. + + +
    +

    + +

    + When two branches are merged the branch containing the changes to be merged is called the source branch, and the branch into which the changes are merged is called the target branch. +

    +

    + When the changes in the source and target branches have been successfully merged a merge commit containing the merged changes is added to the target branch. +

    +
    + + + <exercise + xml:id="ex-name-source-target-branches" label="ex-name-source-target-branches"> <statement> <p> - 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. + Match the branch names to the appropriate term below. </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> - What were the commands you used? And their output? You can copy your work into the provided textbox. + Read the introduction to this section. </p> - </statement> - <response /> - </task> - <task xml:id="ex-merge-main-branch-b" label="ex-merge-main-branch-b"> + </hint> + </exercise> + <exercise + xml:id="ex-merge-commit" + label="ex-merge-commit"> <statement> <p> - 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. + 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? </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> - What were the commands you used? And their output? You can copy your work into the provided textbox. + Read the introduction to this section and examine <xref ref="fig-merge-main-into-feature" />. </p> - </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"> + </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> <p> - In which file is the conflict located? + 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. </p> </statement> - <response /> - </task> - <task xml:id="ex-merge-conflict-file-b" label="ex-merge-conflict-file-b"> + <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"> <statement> <p> - Use the <c>cat</c> command to display the file containing the conflict. + Now that your feature branch is the active branch, give a command that will merge the <c>main</c> branch into your feature branch. </p> <p> - 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. + <var width="55" /> </p> </statement> - <response /> - </task> + <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> + The command you want is in <xref ref="ex-merge-main-into-had-pig" />. + </p> + </feedback> + </condition> + </var> + </setup> + <hint> + <p> + Review what you did in <xref ref="ex-merge-main-into-had-pig" />. + </p> + </hint> </exercise> - <exercise xml:id="ex-identify-ancestor-main-feature" label="ex-identify-ancestor-main-feature"> + <exercise + xml:id="ex-merge-main-into-feature" + label="ex-merge-main-into-feature"> <introduction> <p> - Answer the following questions by copying the appropriate portion of the output that you gave in <xref ref="ex-merge-conflict-file-b" />. + Now let's try to merge the changes in the <c>main</c> branch into your feature branch. </p> </introduction> - <task xml:id="ex-identify-ancestor-main-feature-a" label="ex-identify-ancestor-main-feature-a"> + <task> <statement> <p> - What is the part of the output that is the Best Common Ancestor? + Run your <c>merge</c> command from <xref ref="ex-merge-main-into-feature-cmd" /> in the terminal. </p> </statement> - <response /> </task> - <task xml:id="ex-identify-ancestor-main-feature-b" label="ex-identify-ancestor-main-feature-b"> + <task> <statement> <p> - 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? + Which of the following statements best describes what happened when you ran your <c>merge</c> command? </p> </statement> - <response /> + <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> </task> - <task xml:id="ex-identify-ancestor-main-feature-c" label="ex-identify-ancestor-main-feature-c"> + <task> <statement> <p> - What is the part of the output that shows your changes? + Which of the following things also happened when you ran your <c>merge</c> command? </p> </statement> - <response /> + <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> </task> - </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> + </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 d43a3dc..7ec6f02 100644 --- a/source/ch-merge-conflicts/sec-resolving-a-merge-conflict.ptx +++ b/source/ch-merge-conflicts/sec-resolving-a-merge-conflict.ptx @@ -15,218 +15,581 @@ <caption> Resolving a Merge Conflict </caption> <image source="images/ch-merge-conflicts/resolving-merge-conflict.png" width="75%"> <description> - Cloud image of the changes merged into the upstream that conflict with a local branch + Image illustrating 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 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. + 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. </p> </introduction> - <exercises> - <title /> + <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. +

    +
    - - -

    - Ensure that you are on your feature branch. Then issue the command to merge the main branch into your feature branch (like you did in ). The merge should once again fail because of the conflict. Use the cat command to confirm that the raw merge conflict information now appears in the conflicted file again. -

    -
    -
    -

    - As you have seen when a merge fails git 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 mergetool. -

    + + - <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> + <exercise xml:id="ex-raw-merge-information" label="ex-raw-merge-information"> + <introduction> <p> - Issue the <c>git mergetool</c> command. + 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. </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> - 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" />. + Match the option you would choose to perform each of the indicated operations. </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> - <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> + Compare the terms used in the merge tool options to the information displayed in the first and last lines of the merge conflict information. </p> - </statement> - </task> - <task xml:id="ex-launch-mergetool-vscode-a" label="ex-launch-mergetool-vscode-a" component="vscode-kit-client"> + </hint> + </exercise> + + <exercise + xml:id="ex-accept-current-change" + label="ex-accept-current-change"> <statement> <p> - 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. + Click the option that will accept the changes in your feature branch. </p> <p> - <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> + Choose the description below that best describes What happens? </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> - 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" />. + Click "Accept Current Change" and check the editor contents. </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> - <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> + Run the <c>git status</c> command in the terminal and use its output to answer the following questions. </p> - </statement> - </task> - <task xml:id="ex-launch-mergetool-b" label="ex-launch-mergetool-b"> + </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> <p> - 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> - 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" />. + 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. </p> <p> - <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> + Choose and order the commands that you would use to commit your changes to your local repository. Note: Not all commands will be used. </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> - 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" />. + See <xref ref="topic-staging-changes" /> and <xref ref="topic-committing-to-your-local-repository" /> for a review. </p> + </hint> + </exercise> + + <exercise + xml:id="ex-stage-merged-changes" + label="ex-stage-merged-changes"> + <statement> <p> - <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> + 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. </p> - </statement> - </task> - <task xml:id="ex-launch-mergetool-c" label="ex-launch-mergetool-c"> - <statement correct="yes"> <p> - Do you have your merge tool window showing four panes and their content? + What does <c>git status</c> tell you to do to conclude the merge? </p> </statement> - <feedback> + <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> <p> - Do not make changes until you have your merge tool set up. + Run the <c>git status</c> command and read the output carefully. </p> - </feedback> - </task> - <task xml:id="ex-launch-mergetool-d" label="ex-launch-mergetool-d"> + </hint> + </exercise> + + <exercise + xml:id="ex-commit-merged-changes" + label="ex-commit-merged-changes"> <statement> <p> - Using your answer to <xref ref="ex-launch-mergetool-c" />, compare the Result pane to the Best Common Ancestor. How are they different? Why? + 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. </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> - 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. + What does <c>git status</c> tell you that indicates that your changes have been committed? </p> </statement> - <response /> - </task> - <task xml:id="ex-saving-merge-resolution-b" label="ex-saving-merge-resolution-b"> - <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> <p> - Briefly explain why the output you see in <xref ref="ex-saving-merge-resolution-a" /> makes sense based on what you have done. + Run the <c>git status</c> command and read the output carefully. </p> - </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> + </hint> + </exercise> + + </exercises> + </subsection> </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 fb7f41d..ec1d0f1 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,183 +8,149 @@ <introduction> <p> - <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. + 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. </p> <p> - <figure xml:id="fig-conflicting-upstream-changes" > - <caption> Conflicting Upstream Changes. </caption> - <image source="images/ch-merge-conflicts/conflicting-upstream-changes.png" width="75%"> + 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%"> <description> - Cloud image of the changes merged into the upstream that conflict with a local branch + 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. </description> </image> </figure> </p> + <p> - 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. + 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. </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> - <task> + <exercise + xml:id="ex-restarting-kitclient-for-synching-with-conflicts" label="ex-restarting-kitclient-for-synching-with-conflicts"> <statement> <p> - 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? + 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: </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> - <choices> - <choice correct="yes"> - <statement> - <p> - Dark Blue - </p> - </statement> - </choice> + </exercise> - <choice> + <exercise + xml:id="ex-synch-main-local-upstream" + label="ex-synch-main-local-upstream"> + + <task + xml:id="ex-synch-main-local-upstream-cmds" + label="ex-synch-main-local-upstream-cmds"> <statement> <p> - Lime Green + 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. </p> </statement> - </choice> - - <choice correct="yes"> - <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> <p> - Brown + 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>. </p> - </statement> - </choice> + </hint> + </task> - <choice> + <task + xml:id="ex-synch-main-local-upstream-do-it" + label="ex-synch-main-local-upstream-do-it"> <statement> <p> - Green + Run the commands that you identified in <xref ref="ex-synch-main-local-upstream-cmds" /> in the terminal. </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> - </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> - <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"> + <task + xml:id="ex-confirm-origin-synch" + label="ex-confirm-origin-synch"> <statement> <p> - What are the commands you used? + Let's, confirm that your origin <c>main</c> branch is now synchronized with the upstream <c>main</c> branch. </p> - </statement> - <response /> - </task> - <task xml:id="ex-synch-main-local-upstream-b" label="ex-synch-main-local-upstream-b"> - <statement> <p> - 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> + Visit your origin repository and ensure that the <c>main</c> branch is active. </p> <p> - 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. + 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. </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 1890d90..373dae8 100644 --- a/source/ch-merge-conflicts/sec-understanding-merge-conflicts.ptx +++ b/source/ch-merge-conflicts/sec-understanding-merge-conflicts.ptx @@ -5,378 +5,831 @@ <introduction> <p> - The exercises in this section provide practice in identifying merge conflicts and their resolutions. + The exercises in this section provide practice in identifying merge conflicts and resolving them. </p> </introduction> - <exercises> - <title /> - - <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"> - + <subsection xml:id="topic-merge-example-1"> + <title>Merge Example 1

    - 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. + Consider . This figure shows a feature branch (in the left panel) that is to be merged into the current main branch (in the right panel). The center panel shows the best common ancestor from which both the feature branch and main branch have diverged. +

    +

    + The current main 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. +

    +

    +

    + Example merge conflicts with Best Common Ancestor. + + + Three panels of code (feature branch, best common ancestor, main branch) + + +

    - - -

    - Study the program in the main 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. -

    -
    - -
    + + - <task xml:id="ex-merge-conflicts-practice-1-b" label="ex-merge-conflicts-practice-1-b"> + <exercise xml:id="ex-merge-conflict-1-computation" label="ex-merge-conflict-1-computation"> <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. Use the example in the slides as a guide for highlighting. + 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. </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> - Merge conflicts occur when both source branches change the same line. - </p> - </hint> - </task> + <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> - - <task xml:id="ex-merge-conflicts-practice-1-c" label="ex-merge-conflicts-practice-1-c"> - <statement> + <exercise xml:id="ex-conflict-type" label="ex-ex-conflict-type"> + <introduction> <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. + 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>. </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> - Merge conflicts occur when both source branches change the same line. - </p> - </hint> - </task> + </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-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> + <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> - <task xml:id="ex-merge-conflicts-practice-1-e" label="ex-merge-conflicts-practice-1-e"> - <statement> + <exercise + xml:id="ex-merge-conflict-1" + label="ex-merge-conflict-1"> + <introduction> <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. + 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" />. </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> + </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> + + <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> - <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> + <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 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> - <exercise xml:id="ex-merge-conflicts-practice-2" label="ex-merge-conflicts-practice-2"> + <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> + + <subsection xml:id="topic-merge-example-2"> + <title>Merge Example 2

    - 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. + 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) + + +

    - - -

    - 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. -

    -
    - -
    - - -

    - Highlight (by clicking, or by circling) all of the lines that are non-conflicting changes in the feature branch or the main branch as shown in . Use the example in the slides as a guide for highlighting. -

    -
    - - - - Feature Branch - Best Common Ancestor - main Branch - - - r=15 - r=15 - r=15 - - - pi = 3.1415927 - pi = 3.14 - pi = 3.14 - - - rsq = r**2 - rsq = r*2 - rsq = r*2 - - - a = pi*rsq - a = pi*rsq - area = pi*(rsq/2)**2 - - - print a - print a - print area - - - - -

    - Merge conflicts occur when the feature, main, and common ancestor branches are all different. -

    -
    -
    + + - <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> + <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. Note: 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-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> + <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-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> + <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-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> + <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-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-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 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> + + <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> - + <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 47bca8a..54a063d 100644 --- a/source/ch-merge-conflicts/sec-updating-your-pull-request.ptx +++ b/source/ch-merge-conflicts/sec-updating-your-pull-request.ptx @@ -8,44 +8,252 @@ <introduction> <p> - 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. + 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. </p> </introduction> <exercises> <title /> - <exercise xml:id="ex-push-merge-resolution" label="ex-push-merge-resolution"> - <statement> - <p> - Push your modified feature branch to your <c>origin</c>. Give the command you used and its output here. - </p> - </statement> - <response /> - </exercise> - <exercise xml:id="ex-pull-request-upstream" label="ex-pull-resquest-upstream"> + <exercise + xml:id="ex-push-merge-resolution-cmd" + label="ex-push-merge-resolution-cmd"> <statement> <p> - Now visit the upstream repo and find your pull request. You should see that it can now be merged automatically. + Give the command that will push your modified feature branch to your <c>origin</c>. + </p> + <p> + <var width="55" /> </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=".*"> + <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> - 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. + <xref ref="topic-pushing-a-branch-to-your-origin" /> introduced the command for pushing a feature branch to your origin. </p> + </hint> + </exercise> + + <exercise + xml:id="ex-push-merge-resolution" + label="ex-push-merge-resolution"> + <introduction> <p> - !!Give a screenshot from your pull request showing that it can now be merged automatically. + </p> - </statement> - <response /> + </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> </exercise> - <exercise xml:id="ex-pull-request-url" label="ex-pull-request-url"> - <statement> + + <exercise + xml:id="ex-pull-request-upstream" + label="ex-pull-request-upstream"> + <introduction> <p> - Give the URL of your pull request. + 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! </p> - </statement> - <response /> + </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> </exercise> - </exercises> - </section> diff --git a/source/ch-staying-synchronized/ch-staying-synchronized.ptx b/source/ch-staying-synchronized/ch-staying-synchronized.ptx index 837e4a5..f7dd609 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 focused on how to keep your local and origin repositories synchronized with the project’s upstream repo. + This topic focuses 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,9 +14,8 @@ <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 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. + 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). </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 new file mode 100644 index 0000000..9f8573b Binary files /dev/null and b/source/ch-staying-synchronized/images/changes-merged-into-upstream-pull.png differ diff --git a/source/ch-staying-synchronized/sec-appendix-a.ptx b/source/ch-staying-synchronized/sec-appendix-a.ptx index 1649a08..b857532 100644 --- a/source/ch-staying-synchronized/sec-appendix-a.ptx +++ b/source/ch-staying-synchronized/sec-appendix-a.ptx @@ -16,7 +16,7 @@ </p> <p> - Ensure that you are in the <em>GitKit-FarmData2</em> directory then use the following commands: + Ensure that you are in the directory for your local clone of your <em>GitKit FarmData2</em> repository then use the following commands: <ol> <li> <c>git switch main</c> 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 9b609cb..4cfa854 100644 --- a/source/ch-staying-synchronized/sec-deleting-a-feature-branch.ptx +++ b/source/ch-staying-synchronized/sec-deleting-a-feature-branch.ptx @@ -10,252 +10,433 @@ 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 of the feature branch. + Cloud image showing that the feature branch was deleted. </description> </image> </figure> </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. + 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. </p> </introduction> - <exercises> - <title /> - <exercise xml:id="ex-deleting-feature-branch" label="ex-deleting-feature-branch"> + <subsection xml:id="topic-delete-local-feature-branch" label="topic-delete-local-feature-branch"> + <title>Deleting a Feature Branch from your Local Repo +

    - The first step is to delete the feature branch from your local repository. - This exercise will walk you through that process. + 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.

    + + - <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> + <exercise xml:id="ex-deleting-feature-branch" label="ex-deleting-feature-branch"> - - <choices randomize="yes"> - <choice> + <task xml:id="ex-deleting-feature-branch-step-order" label="ex-deleting-feature-branch-step-order" > <statement> <p> - <c>git switch</c> + 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. </p> - </statement> - <feedback> <p> - The <c>git switch</c> command is used to change the active branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - <c>git pull</c> + 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. </p> </statement> - <feedback> + <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> <p> - The <c>git pull</c> command is used to pull changes from a remote repository to your local repository. + You will need two commands, the first one to make the <c>main</c> branch active and the second to list the local branches. </p> - </feedback> - </choice> + </hint> + </task> - <choice> + <task xml:id="ex-deleting-feature-branch-a" label="ex-deleting-feature-branch-a"> <statement> <p> - <c>git commit</c> - </p> - </statement> - <feedback> - <p> - The <c>git commit</c> command is used to commit staged changes to the repository. + Run the commands you identified in <xref ref="ex-deleting-feature-branch-step-order" /> in the terminal. </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> <p> - <c>git branch</c> + How can you tell from the output provided that your <c>main</c> branch is currently active? </p> </statement> - <feedback> + <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> <p> - Correct! The <c>git branch</c> command is used to display all of branches in your local repository. + The output should clearly indicate that <c>main</c> is the active branch in several ways. </p> - </feedback> - </choice> - </choices> - - <hint> - <p> - Refer back to the section on switching branches <xref ref="topic-switching-branches"/> - </p> - </hint> - </task> - - - <task xml:id="ex-deleting-feature-branch-b" label="ex-deleting-feature-branch-b"> - <statement> - <p> - From the output provided by <xref ref="ex-deleting-feature-branch-a"/> how do you know which is the active branch? - </p> - </statement> + </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 + +

    + 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. +

    +
    - - - -

    - It has an * next to it. -

    -
    -
    - - + + + + + +

    + 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. +

    +
    +
    +
    +
    +
    + + +

    - It appears in green. + Run your command from in the Terminal and examine the output.

    -
    -
    - - -

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

    -
    - - - + + + +

    + [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 italics. + Examine the output of your git push command.

    -
    -
    + + - +

    - It is not possible to tell the active branch based upon the output provided. + 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.

    -
    -
    - - -

    - 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 84d21d0..07ddf2f 100644 --- a/source/ch-staying-synchronized/sec-git-command-summary.ptx +++ b/source/ch-staying-synchronized/sec-git-command-summary.ptx @@ -12,30 +12,72 @@ - <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> + <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> </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 14a961c..487cd4e 100644 --- a/source/ch-staying-synchronized/sec-lets-do-it-again.ptx +++ b/source/ch-staying-synchronized/sec-lets-do-it-again.ptx @@ -7,307 +7,112 @@ <p> You’ve learned a lot about Git and GitHub. But, to become proficient with these tools takes a lot of repetition and practice. - 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! + 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! </p> </introduction> - <exercises> - <title /> - <subsection> - <title>Claiming Another Issue - + + Process of Fixing an Issue

    - The issue tracker in the upstream FarmData2 repository being used for these tasks. + 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.

    - - + + + <exercise xml:id="ex-fixing-issue-ordering" label="ex-fixing-issue-ordering"> <statement> <p> - 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? + 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. </p> </statement> - - - <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> - + <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> <hint> <p> - ADD HINT HERE + Think about the full process that you worked through from claiming your Round1 issue through making a pull request for your changes. </p> </hint> - </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> + </exercise> + </exercises> </subsection> - <subsection> - <title>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. -

    -
    - + + Claim a Round2 Issue +

    - Create a new feature branch + Now it is time to find a new issue to work on.

    -
    + -

    - Switch to the feature branch -

    -
    - -

    - 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"> <statement> <p> - 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. + Go to the issue tracker in the <em>upstream FarmData2 repository</em> that you are using for your course. </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> - 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> - 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 doesn't provide enough information. - What is issue 37? - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - adding-link - </p> - </statement> - - <feedback> - <p> - This branch name is too generic. - </p> - </feedback> - </choice> - - <choice correct="yes"> - <statement> - <p> - adding-nsf-link-acknowledgement - </p> - </statement> - - <feedback> - <p> - Correct! This branch name describes the work to be done in the branch. - </p> - </feedback> - </choice> - - <choice> - <statement> - <p> - nsf-acknowledgement - </p> - </statement> - - <feedback> - <p> - This branch name doesn't specify what is being done with regard to the NSF acknowledgement. - </p> - </feedback> - </choice> - </choices> - - <hint> <p> - Refer back to the section on creating branches <xref ref="topic-creating-a-feature-branch"/> for information on branch names. + Use the "Labels" dropdown in the issue tracker to filter for issues labeled with the “Round2” tag. </p> - </hint> - </task> - - - <task xml:id="ex-fixing-issue-process-c" label="ex-fixing-issue-process-c"> - <statement> <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? + How many issues have the Round2 tag? </p> </statement> - - - <choices randomize="yes"> + <choices> <choice correct="yes"> <statement> <p> - Added the URL for GNOME to the acknowledgements section of the REAMDE file. + 4 </p> </statement> - <feedback> <p> - Correct! This commit message briefly but completing describes the change made. + Correct. </p> </feedback> </choice> @@ -315,143 +120,475 @@ <choice> <statement> <p> - Added URL. + 6 </p> </statement> - <feedback> <p> - This commit message doesn't provide enough information about the URL added. + Be sure you have selected the "Round2" label. </p> </feedback> </choice> - <choice> <statement> <p> - Updated README. + 35 </p> </statement> - <feedback> <p> - This commit message doesn't provide enough information about what has been changed in the README file. + Be sure you have selected the "Round2" label. </p> </feedback> </choice> - <choice> <statement> <p> - Fixed typo. + 39 </p> </statement> - <feedback> <p> - This commit message is too generic and does not describe the change for this issue. + Be sure you have selected the "Round2" label. </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. + Make sure you have the Round2 tag selected in the "Labels" dropdown. The "Labels" dropdown is between the "Author" and "Projects" dropdowns. </p> </hint> - </task> - </exercise> + </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"> + <exercise xml:id="ex-claim-issue-b" label="ex-claim-issue-b"> <statement> <p> - The number of your PR + 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> - </statement> - <response /> - </task> - - <task xml:id="ex-pull-request-info-b" label="ex-pull-request-info-b"> - <statement> <p> - Full URL of your PR + 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 as it was in Round1. + Try to spread out across the issues so that multiple people have commented that they are working on each one. </p> - </statement> - <response /> - </task> - - - <task xml:id="ex-pull-request-info-c" label="ex-pull-request-info-c"> - <statement> <p> - Base Repository URL + Give the number of the issue you chose. </p> - </statement> - <response /> - </task> - - <task xml:id="ex-pull-request-info-d" label="ex-pull-request-info-d"> - <statement> <p> - Head Repository URL + <var width="10" /> </p> </statement> - <response /> - </task> + <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> + <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 a 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> - <task xml:id="ex-pull-request-info-e" label="ex-pull-request-info-e"> + <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"> <statement> <p> - Base Branch + Make a pull request for your feature branch to the upstream repository for your course. </p> - </statement> - <response /> - </task> - - - <task xml:id="ex-pull-request-info-f" label="ex-pull-request-info-f"> - <statement> <p> - Compare Branch + Enter the full URL of your PR below. </p> - </statement> - <response /> - </task> - - <task xml:id="ex-pull-request-info-g" label="ex-pull-request-info-g"> - <statement> <p> - The line number of the README.md file that you changed. - Hint: use the diff you saw in the prior chapter. + <var width="65" /> </p> </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> + <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> + <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. + </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> </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 d796778..fe742bc 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,27 +4,191 @@ <title>Overview of Synchronizing with the Upstream Repository - 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 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. +

    Now, recall that upstream main should be the starting point for all new work. - So, before you can work on something new, you’ll want to make your main branches look like the upstream main (i.e. + So, before you can work on something new, you'll need to ensure that your main branches look like the upstream main (i.e. you will synchronize them with the upstream). This is a two-step process. - 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. + 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.

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

    - + + + + <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 3da4645..795c2ce 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,194 +4,226 @@ <title>Pulling the Upstream <c>main</c> Branch - - <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> + <title /> + <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 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? + 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> - </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> - 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"> + </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"> <statement> <p> - If your active branch in not the <c>main</c> branch change the active branch now. - What command changes the active branch to main? + 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>. </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> - <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"/> + 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. </p> - </hint> - </task> - - - <task xml:id="ex-active-branch-c" label="ex-active-branch-c"> - <statement> <p> - The command + <var width="45" /> </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"> + <statement> <p> - <c>git pull --ff-only <remote repo name> <branch></c> + Run the command from <xref ref="ex-git-pull-cmd"/> in the terminal and examine the output. </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. + 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. </p> - </statement> - </task> - - - <task xml:id="ex-active-branch-d" label="ex-active-branch-d"> - <statement> <p> - 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? + Which of the following appear in the output of the <c>git pull</c> command? </p> </statement> - - <choices randomized="yes"> <choice correct="yes"> <statement> @@ -200,7 +232,6 @@ </p> </statement> </choice> - <choice correct="yes"> <statement> <p> @@ -208,7 +239,6 @@ </p> </statement> </choice> - <choice correct="yes"> <statement> <p> @@ -216,7 +246,6 @@ </p> </statement> </choice> - <choice correct="yes"> <statement> <p> @@ -224,7 +253,6 @@ </p> </statement> </choice> - <choice> <statement> <p> @@ -233,13 +261,11 @@ </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> - </task> - </exercise> + </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 ce8885f..5a6109f 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,106 +4,120 @@ <title>Pushing <c>main</c> to Your Origin - - <exercise xml:id="ex-synching-main-to-origin" label="ex-synching-main-to-origin"> + <title /> <introduction> <p> - 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. + 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. </p> </introduction> - - <task xml:id="ex-synching-main-to-origin-a" label="ex-synching-main-to-origin-a"> + <exercise 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> - <c> git push <remote repo name> <branch> </c> + 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. </p> - <p> - 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. + <var width="45" /> </p> </statement> - </task> - - - <task xml:id="ex-synching-main-to-origin-b" label="ex-synching-main-to-origin-b"> - <statement> + <setup> <var> <condition string="^git push origin main$"> + <feedback> <p> - 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. + Thank you. </p> + </feedback> + </condition> <condition string=".*"> + <feedback> <p> - 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? + 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> - </statement> - - - <choices randomize="yes"> - <choice correct="yes"> - <statement> - <p> - The URL of your origin on GitHub. - </p> - </statement> - </choice> + </feedback> + </condition> </var> </setup> + </exercise> - <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> + <exercise xml:id="ex-synching-main-to-origin-b" label="ex-synching-main-to-origin-b"> + <introduction> <p> - Only look at the last two lines, the one that starts with "To" and the one that starts with a SHA code. + 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. </p> - </hint> - </task> - </exercise> + </introduction> - <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> + <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. + </p> + <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. + </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> + </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 2f317cc..7e43d3b 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,243 +7,385 @@ <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 an upstream maintainer and demonstrated how the changes contained in pull requests are merged. + 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. </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> - - <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> - - - <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> - 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> - </statement> - </task> - + <title /> <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" />. + <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 showing some changes merged into the upstream <c>main</c> branch. + </description> + </image> + </figure> + </p> - <task xml:id="ex-origin-main-behind-main-b" label="ex-origin-main-behind-main-b"> - <statement> + <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> 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> <p> - Briefly explain what has happened that caused your origin’s <c>main</c> branch to get <em>behind</em> the upstream <c>main</c>. + 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. </p> - </statement> - <response /> - </task> - </exercise> + </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> </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 3f75901..116e16e 100644 --- a/source/ch-staying-synchronized/sec-verifying-the-upstream-remote.ptx +++ b/source/ch-staying-synchronized/sec-verifying-the-upstream-remote.ptx @@ -1,285 +1,410 @@ <?xml version="1.0" encoding="UTF-8"?> <section xml:id="topic-verifying-the-upstream-remote" xmlns:xi="http://www.w3.org/2001/XInclude" > - <title component="linux-kit-client">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. - + 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"> + <introduction > + <p> + Before you will be able to pull changes from the upstream your local repository will need to know where to find the upstream repository. + In earlier figures (e.g. <xref ref="fig-changes-merged-into-upstream" />), 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 does not know the location of the upstream repository. + </p> <p> - Restart your KitClient based on the instructions in <xref ref="topic-restarting-dev-env"/> + In <xref ref="fig-synching-with-upstream" /> a dotted orange line was added pointing from your local repository to the upstream. Git needs to have this information so that it can pull changes from the upstream into your local repository. In this section, you will see that the <term>upstream remote</term> provides this information. </p> - </exercise> + </introduction>git - <exercise xml:id="ex-setting-upstream" label="ex-setting-upstream"> - <introduction component="vscode-kit-client"> - 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. - </introduction> - <introduction component="linux-kit-client"> - 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. - </introduction> + <subsection xml:id="topic-restarting-dev_environment-synch"> + <title>Restarting the Development Environment + +

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

    +
    - - + + + <exercise xml:id="ex-restarting-kitclient-for-synching" label="ex-restarting-kitclient-for-synching"> <p> - 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. + 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> </p> - </statement> - </task> + </exercise> + </exercises> + </subsection> - <task xml:id="ex-setting-upstream-b-linux" label="ex-setting-upstream-b-linux" component="linux-kit-client"> - <statement> - <p> - How is the origin remote indicated in <xref ref="ex-setting-upstream-a" /> represented in <xref ref="fig-changes-merged-into-upstream" />? - </p> - </statement> + <subsection xml:id="topic-understanding-remotes"> + <title>Understanding Remotes + +

    + 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. You should see two lines labeled origin (fetch and push), and two lines labeled upstream (also fetch and push). + </p> + </introduction> + + <task xml:id="ex-checking-the-origin-remote" label="ex-checking-the-origin-remote"> <statement> <p> - It is labeled as "origin". + Where does the URL associated with the origin remote point? </p> </statement> - - <feedback> + <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> <p> - Correct! The diagram shows your origin remote on the top left side with the label "origin". + 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. </p> - </feedback> - </choice> + </hint> + </task> - <choice> + <task xml:id="ex-checking-the-upstream-remote" label="ex-checking-the-upstream-remote"> <statement> <p> - It is labeled as "upstream". + Where does the URL associated with the upstream remote point? </p> </statement> - </choice> - - <choice> - <statement> - <p> - It is labeled as "local". - </p> - </statement> - </choice> - - <choice> - <statement> + <choices randomize="yes"> + <choice correct="yes"> + <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> + <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> <p> - It is labeled as "feature branch". + 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. </p> - </statement> - </choice> - </choices> - - <hint> - <p> - 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> - Confirm that <c>upstream</c> points to the upstream project on GitHub. - How did you confirm it? - </p> - </statement> - <response /> - </task> + </hint> + </task> + </exercise> + + <exercise xml:id="ex-remotes-in-figure" label="ex-remotes-in-figure"> + <introduction> + <p> + The remotes you just examined with <c>git remote -v</c> are also represented in <xref ref="fig-synching-with-upstream" />. + </p> + </introduction> + + <task xml:id="ex-origin-in-figure" label="ex-origin-in-figure"> + <statement> + <p> + How is the origin Git remote associated with your local repository represented in the figure? + </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 on the right that points from your local repository to the upstream. + </p> + </statement> + <feedback> + <p> + The arrow on the right represents a Git remote associated with your local repository, but it is not the origin. + </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> + <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 origin Git remote will be associated with your local repo and will indicate where the origin repository is located. + </p> + </hint> + </task> + + <task xml:id="ex-upstream-in-figure" label="ex-upstream-in-figure"> + <statement> + <p> + How is the upstream Git remote represented associated with your local repo represented in the figure? + </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 a git remote associated with your local repository, but it is not the upstream. + </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> + <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> + </task> + </exercise> + </exercises> + </subsection> + + <subsection xml:id="topic-setting-the-upstream" label="topic-setting-the-upstream"> + <title>Adding an Upstream Remote + + +

    + As you saw in your local repository contains an upstream remote that points to the upstream being used for your course. This upstream was set automatically by the development environment when you opened your local repository. +

    +

    + Not all development environments are able to automatically set the upstream remote when you open your local repository. The exercises in this section will walk you through how you can manually set the upstream remote if you need to. +

    +
    - + + + +

    - 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 upstream FarmData2 repo that you are using for this course and give its URL here. - Hint: You can find the upstream 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 .git. + The git remote command you used to display the Git remotes is also used to add new Git remotes.

    -
    - -
    - - - -

    - The git remote command can also be used to add a new remote to your local repo. - The format for this command is: + The format for this command is: git remote add <name> <URL>

    -

    - git remote add <remote repo name> <remote repo URL> + Give a command that will create a new Git remote named upstream that points to the GitKit FarmData2 upstream repository that you are using for this course.

    -

    - Use the above command to create a remote named upstream that points to the FarmData2 upstream repository that you are using for this exercise. +

    -
    - - - - -

    - Use the git remote -v command to confirm that the new upstream remote has been added. -

    -
    -
    - - - - -

    - 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 ? -

    -
    - - - - - -

    - It is labeled as "origin". -

    -
    -
    - - - -

    - It is labeled as "upstream". -

    -
    - - -

    - Correct! The diagram shows your upstream remote on the top right side with the label "upstream". -

    -
    -
    - - - -

    - It is labeled as "local". -

    -
    -
    - - - -

    - It is labeled as "feature branch". -

    -
    -
    -
    - + + + + +

    + Looks good! But just to be sure, double check that the URL you used agrees with the one you gave in . +

    +
    +
    + + +

    + Double check the format of your command and the URL that you are using. +

    +
    +
    +
    +

    - When you issued the git remote -v command pay attention to the name given to second set of fetch and pull URLs. + The URL of the upstream for your class was given by your instructor and should be in .

    -
    - - - - -

    - 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 ? -

    -
    +
    + +
    +

    + Note that if you are using a development environment that does not automatically set the upstream remote for you, you will still only need to set it once. Once the upstream remote is set for a repository you will be able to pull from the upstream repo as often as is necessary. +

    +

    + It is also worth mention that there is nothing particularly special about the names of the remotes. The names origin and upstream are used by convention by most developers. However, you could name your remotes anything you like and they would still work. +

    - - - -

    - It is labeled as "origin". -

    -
    -
    - - - -

    - It is labeled as "upstream". -

    -
    - - -

    - Correct! The diagram shows your upstream remote on the top right side with the label "upstream". -

    -
    -
    - - - -

    - It is labeled as "local". -

    -
    -
    - - - -

    - It is labeled as "feature branch". -

    -
    -
    -
    - - -

    - When you issued the git remote -v command pay attention to the name given to second set of fetch and pull URLs. -

    -
    -
    -
    + - - 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. - -
    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 6c60936..764bc0d 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,6 +59,13 @@ Fix typo

    + + +

    + 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. +

    +
    @@ -83,33 +90,194 @@ Extend harvest logs

    + + +

    + Commit messages should be as specific as possible regarding the changes made. + Which of the messages provides information about what is added and where? +

    +
    - +

    The git commit -m "<message>" command commits all of the staged files to the currently active branch with the specified commit message. - Use the git commit command to commit your staged changes to your local repository with a meaningful commit message.

    -
    +

    + Write a git commit command for the change you made in the space below. + Be sure to include a meaningful message. +

    - - +

    + +

    +
    + + + + +

    + Thank you. + Your command is in the proper format, please make sure the commit message is meaningful. +

    +
    +
    + +

    - Provide the command you entered. + Try using a longer commit message to be more descriptive.

    - - -
    + + + + +

    + Try using a more concise commit message. +

    +
    +
    + + +

    + Double check the format of your command. +

    +
    +
    + + +
    + + + +

    + Use the git commit command you wrote in to commit your staged changes to your local repository with a meaningful commit message. +

    + +

    + Look at the output produced. +

    +
    + + + + + +

    + It shows the name of the file changed in the square brackets [ ]. +

    +
    + + +

    + The first part of the first line is not the file name, take another look at the output. +

    +
    +
    + + + +

    + It shows the name of the feature branch that contains the change in the square brackets [ ]. +

    +
    + + +

    + The first part of the first line is the feature branch name. +

    +
    +
    + + + +

    + It shows the SHA code of the commit in the square brackets [ ]. +

    +
    + + +

    + The second part of the first line is the SHA code of the commit. +

    +
    +
    + + + +

    + It shows the commit message. +

    +
    + + +

    + The last part of the first line is the commit message. +

    +
    +
    + + + +

    + It shows the number of files changed. +

    +
    + + +

    + The first part of the second line is the number of files changed. +

    +
    +
    + + + +

    + It shows the number of lines inserted. +

    +
    + + +

    + The second part of the second line is the number of lines inserted. +

    +
    +
    + + + +

    + It shows every line that was inserted and/or deleted. +

    +
    + + +

    + The output should not show the individual line changes, rather a summary of the changes. +

    +
    +
    +
    + + +

    + There should be two lines of output. + The first will provide 3 different pieces of information. + The second provides what additional information? +

    +
    +
    +

    Now use the git status command again. - Compare your output to the output in . + Compare your output to the output in . What two changes have occurred that reflect that your changes have been staged?

    @@ -148,16 +316,59 @@ + +

    + You have staged and committed all modified files. +

    +
    -

    How do you know your changes have been committed?

    - + + + + +

    + The git commit message showed a new SHA. +

    +
    +
    + + + +

    + The git status command does not show the files you modified for your change. +

    +
    +
    + + + +

    + The git status command shows your modified files in green. +

    +
    +
    + + + +

    + The git commit message says "no changes added to commit". +

    +
    +
    +
    + + +

    + There should be no modified files that are still staged and the git commit should have showed you the number of lines changed. +

    +
    @@ -165,12 +376,49 @@

    Use the git log command to show the 3 most recent commits to your branch. - How is this output different from what you observed in Question #1? Briefly explain why? 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. + Refer back to your output from .

    - + + + + + +

    + The top commit shown is your latest commit. +

    +
    + +
    + + + +

    + The bottom commit shown is your latest commit. +

    +
    +
    + + + +

    + Your commit is not shown. +

    +
    + + +

    + Feedback 3 +

    +
    +
    +
    + + +

    + The log shows the latest commits first. +

    +
    @@ -190,6 +438,12 @@ git status

    + + +

    + git status shows what files have been changed and staged. +

    +
    @@ -198,6 +452,12 @@ git stage main

    + + +

    + git stage main is not a proper command. +

    +
    @@ -206,6 +466,12 @@ git branch main

    + + +

    + git branch main would try to create a new branch named main. +

    +
    @@ -214,27 +480,110 @@ git switch main

    + + +

    + Correct! +

    +
    + + +

    + To change the active branch you need to switch to it. +

    +
    - +

    The output of the git log command now shows the information about the commit you made.

    + + +

    + What branch are you on, the main branch or your feature branch? In which branch did you make your changes? +

    +

    - Briefly explain how you know. + The commit is not shown in the git log output because:

    - + + + + + +

    + You are on the main branch and the commit is on the feature branch. +

    +
    + + +

    + Correct! +

    +
    +
    + + + +

    + You are on the feature branch and the commit is on the main branch. +

    +
    + + +

    + You should be on the main branch. +

    +
    +
    + + + +

    + The git status command should be used to show the commits. +

    +
    + + +

    + The git status command is used to see what files have been changed and staged. +

    +
    +
    + + + +

    + It only shows the first commit made, not every commit. +

    +
    + + +

    + The git log command will show multiple commits with the most recent appearing first. +

    +
    +
    +
    + + +

    + Commits are specific to branches. + You must be on the proper branch to see a commit. +

    +
    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 f616fb0..28fac78 100644 --- a/source/ch-upstreaming-changes/sec-creating-a-feature-branch.ptx +++ b/source/ch-upstreaming-changes/sec-creating-a-feature-branch.ptx @@ -8,23 +8,41 @@ 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 .

    + +

    + illustrates this process. The feature branch that you will create is shown in orange. +

    + +

    +

    + Create Feature Branch. + + + Cloud image of origin, upstream, and local branches. + + +
    +

    - <exercise xml:id="ex-git-status-command" label="ex-git-status-command"> + <exercise xml:id="ex-creating-a-branch" label="ex-creating-a-branch"> <introduction> <p> - 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. + 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. </p> </introduction> - <task xml:id="ex-git-status-command-a" label="ex-git-status-command-a"> + <task xml:id="ex-creating-a-branch-a" label="ex-creating-a-branch-a"> <statement> <p> - What part of the output tells you which branch is currently active in your repository? + If you want to create a new feature branch named <em>fixTypoInName</em>, which command should you use? </p> </statement> @@ -33,13 +51,13 @@ <choice correct="yes"> <statement> <p> - The branch name is displayed in the first line after "On branch". + <c>git branch fixTypoInName</c> </p> </statement> <feedback> <p> - Correct! The first line specifies the current branch. + Correct! </p> </feedback> </choice> @@ -47,14 +65,13 @@ <choice> <statement> <p> - The branch name is displayed at the end of the second line. - It is "origin/main". + <c>git branch <fixTypoInName></c> </p> </statement> <feedback> <p> - The second line specifies the origin branch not the active branch. + The command should not contain < >. </p> </feedback> </choice> @@ -62,13 +79,13 @@ <choice> <statement> <p> - The branch name is not displayed in the output from this git command. + <c>branch fixTypoInName</c> </p> </statement> <feedback> <p> - Look again, the active branch is listed. + The command is missing <c>git</c>. </p> </feedback> </choice> @@ -76,14 +93,13 @@ <choice> <statement> <p> - The branch name is displayed at the end of the last line. - It is "working tree". + <c>git fixTypoInName</c> </p> </statement> <feedback> <p> - The last line indicates if there are changes to commit. + The command is missing <c>branch</c>. </p> </feedback> </choice> @@ -91,104 +107,252 @@ <hint> <p> - Look at the first line of the output from the <c>git status</c> command. + Look back at the format of the command in the previous description. </p> </hint> </task> - <task xml:id="ex-git-status-command-b" label="ex-git-status-command-b"> + <task xml:id="ex-creating-a-branch-b" label="ex-creating-a-branch-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”? + 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? </p> </statement> - <response /> - </task> - <task xml:id="ex-git-status-command-c" label="ex-git-status-command-c"> - <statement> + <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> <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.” Hint: when would you have something to commit? This is the opposite of that! + Look back at the format of the command and make sure you type it correctly. </p> - </statement> - <response /> + </hint> </task> </exercise> - <exercise xml:id="ex-creating-a-branch" label="ex-creating-a-branch"> + <exercise xml:id="ex-checking-a-branch" label="ex-checking-a-branch"> <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. + The <c>git branch</c> command without the branch name lists all branches. </p> </introduction> - <task xml:id="ex-creating-a-branch-a" label="ex-creating-a-branch-a"> + <task xml:id="ex-checking-a-branch-a" label="ex-checking-a-branch-a"> <statement> <p> - <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> + Type <c>git branch</c> and look at the output produced. + Which of the following do you see listed? </p> </statement> - <response /> - </task> - <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> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + <c>main</c> + </p> + </statement> - <feedback> - <p> - <c>git branch <name></c> only creates the branch. - </p> - </feedback> + <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> + + <feedback> + <p> + The branch name should not have < >. + </p> + </feedback> + </choice> + </choices> <hint> <p> - After you create a branch what needs to be done to make it active? + 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"/>. </p> </hint> </task> - <task xml:id="ex-creating-a-branch-c" label="ex-creating-a-branch-c"> + + <task xml:id="ex-checking-a-branch-b" label="ex-checking-a-branch-b"> <statement> <p> - How can you tell from the output in <xref ref="ex-creating-a-branch-b" /> if it switched you to the new branch? + By looking at the output provided by <c>git branch</c> how can you tell which is the active branch? </p> </statement> - <response /> + + + <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> </task> </exercise> <p> - <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> + Refer back to <xref ref="fig-create-feature-branch"/> to see the process you just completed. </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 9dbc983..a4e48dc 100644 --- a/source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx +++ b/source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx @@ -87,43 +87,13 @@ 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” 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. + The terms “Base Repository” and “Head Repository” 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. - 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. + 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> @@ -148,7 +118,7 @@ Match the right hand column with either base branch or compare branch to indicate which is “pulled from” or “merged into”. </p> </statement> - <!-- part of this original question has been omitted regarding the names of the branches --> <matches> <match> + <matches> <match> <premise> <c>base branch</c></premise> <response>merged into</response> </match> <match> <premise> @@ -156,7 +126,7 @@ <hint> <p> The base is where you want your changes merged into. - The head is where your changes are being pulled from. + The compare is where your changes are being pulled from. </p> </hint> </task> @@ -209,7 +179,7 @@ </p> <p> - The #123 part of the line should automatically become a link to the ticket. + The #123 part of the line should automatically become a link to the issue. If it does not, check to be sure you have entered the information exactly as shown above. </p> </statement> @@ -219,7 +189,7 @@ <task xml:id="ex-pull-request-finish-d" label="ex-pull-request-finish-d"> <statement> <p> - Check that status of your PR and confirm that it can be merged automatically. + Check the 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> @@ -264,12 +234,33 @@ <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/[1-9][0-9]*$'> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> <condition string=".*"> + + <feedback> + <p> + Double check the URL of your pull request to ensure that it is in the upstream for your course and is correct. + </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"> - <introduction> + <statement> <p> On your pull request page there will be “Files Changed” tab: </p> @@ -289,13 +280,8 @@ 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> - Briefly describe how the diff indicates the changes that you made. + Which of the following describes how the diff indicates the changes that you made? </p> </statement> @@ -309,6 +295,12 @@ 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> @@ -317,6 +309,12 @@ 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> @@ -325,6 +323,12 @@ 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> @@ -333,9 +337,21 @@ 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> - </task> - </exercise> - </exercises> -</section> + + <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> diff --git a/source/ch-upstreaming-changes/sec-editing-local-files.ptx b/source/ch-upstreaming-changes/sec-editing-local-files.ptx index 5024c9f..0fe5a8d 100644 --- a/source/ch-upstreaming-changes/sec-editing-local-files.ptx +++ b/source/ch-upstreaming-changes/sec-editing-local-files.ptx @@ -7,6 +7,7 @@ <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> @@ -19,42 +20,80 @@ </p> <p> - Provide a link to the issue that you claimed in the issue tracker. + Provide the URL to the issue that you claimed in the issue tracker. </p> <p> <var width="55" /> </p> </statement> - <!-- THIS NEEDS TO BE UPDATED WITH FEEDBACK AND A REGULAR EXPRESSION TO MAKE SURE THE STUDENT IS IN THE ISSUE TRACKER --> + <setup> <var> <condition string="^https://github\.com/(?!(FarmData2/FarmData2|DickinsonCollege/FarmData2)).+/issues/([4-9]|[12][0-9]|3[0-5])$"> + <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 that you have been assigned. + </p> + </feedback> + </condition> </var> </setup> </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> - <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> - + <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-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> + <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> </exercise> <p> @@ -80,20 +119,24 @@ </p> <p> - 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. + 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-a" label="ex-verify-changes-a"> + <task xml:id="ex-verify-changes-new-a" label="ex-verify-changes-new-a"> <statement> - <!-- <p> - 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. + Paste the output of the <c>git status</c> command below. </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> @@ -125,7 +168,7 @@ <feedback> <p> - Correct! The file you changes has been modified but not staged yet. + Correct! The file you changed has been modified but not staged yet. </p> </feedback> </choice> @@ -170,7 +213,7 @@ <task xml:id="ex-verify-changes-b" label="ex-verify-changes-b"> <statement> <p> - How many files are added to the commit? + How many files will be committed? </p> </statement> @@ -199,7 +242,7 @@ <feedback> <p> - Unless you already issued the <c>git add</c> command you shouldn't have any files ready to be committed. + Unless you already issued the <c>git stage</c> command you shouldn't have any files ready to be committed. </p> </feedback> </choice> @@ -242,89 +285,84 @@ </exercise> <exercise xml:id="ex-verify-changes-with-diff" label="ex-verify-changes-with-diff"> - <introduction> + <statement> <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 as compared to the version in the most recent commit in the active branch. + 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. Run the <c>git diff</c> command now. </p> - </introduction> - - - <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> + <p> + How is the change that you made indicated in the output from <c>git diff</c>? + </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> + <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> </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 5297f7b..8d77db2 100644 --- a/source/ch-upstreaming-changes/sec-exploring-your-local-repository.ptx +++ b/source/ch-upstreaming-changes/sec-exploring-your-local-repository.ptx @@ -5,71 +5,189 @@ <introduction> <p> - Like in the previous chapter, you will be working within the KitClient for this exercise. + 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> </p> </introduction> - <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 on your computer. Your local files at this point are a copy that reflects the current state of the upstream main branch. - </p> + <subsection xml:id="subsec-restarting-development-environment"> + <title>Restarting the Development Environment -

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

    + +

    +

    +
    -

    -

    - Fork, Clone and Local Files. - + + + <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%"> <description> - Cloud image of fork, clone, and local files. + The GitKit Development Environment. + The development environment is ready when you see the "Kit development environment is ready for use" message. </description> </image> - </figure> - </p> + </p> + </exercise> + </exercises> +</subsection> - <exercises> - <title/> - <exercise xml:id="ex-restarting-kitclient" label="ex-restarting-kitclient"> + +<subsection xml:id="subsec-git-log-command"> + <title><c>git log</c> + +

    - Restart your KitClient based on the instructions in . + The git log 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, git log 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.

    - +
    -

    - The git log 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, git log 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. -

    + + + <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> - <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> + <choices randomize="yes"> + <choice> + <statement> + <p> + <c>git log</c> + </p> + </statement> - <p> - Use the output from the <c>git log</c> 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. - </p> - </introduction> + <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 the directory containing your cloned GitKit FarmData2 repository (use the <c>cd</c> command if necessary). + 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> + + <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> + Paste the output of the <c>git log</c> command you typed in the space below. + </p> + </statement> + <response/> + </task> + </exercise> + </exercises> +</subsection> + + +<subsection xml:id="subsec-understanding-git-log-output"> + <title>Reviewing the <c>git log</c> Output + + +

    + 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> @@ -138,11 +256,13 @@ <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> @@ -150,6 +270,7 @@ </p> </statement> + <choices randomize="yes"> <choice> <statement> @@ -202,7 +323,7 @@ <feedback> <p> - There is a more recent commit. + There is a more recent commit. </p> </feedback> </choice> @@ -215,6 +336,7 @@ </hint> </task> + <task xml:id="ex-understanding-project-history-c" label="ex-understanding-project-history-c"> <statement> <p> @@ -222,6 +344,7 @@ </p> </statement> + <choices randomize="yes"> <choice correct="yes"> <statement> @@ -287,13 +410,15 @@ </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 shes-dev? + What is the purpose of the most recent commit by Elad Sheskin (username: shes-dev)? </p> </statement> + <choices randomize="yes"> <choice correct="yes"> <statement> @@ -371,8 +496,255 @@ 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 30e8a76..f374308 100644 --- a/source/ch-upstreaming-changes/sec-git-command-summary.ptx +++ b/source/ch-upstreaming-changes/sec-git-command-summary.ptx @@ -22,21 +22,39 @@ <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 switch <branch> </c></premise> <response>Change the active branch</response> </match> <match> + <c>git branch</c></premise> <response>Lists all branches.</response> </match> <match> <premise> - <c>git status </c></premise> <response>Check the current state of your local repo.</response> </match> <match> + <c>git switch <branch></c></premise> <response>Change the active branch</response> </match> <match> <premise> - <c>git status <file name> </c></premise> <response>Display the changes that you made to a file.</response> </match> <match> + <c>git status</c></premise> <response>Check the current state of your local repo.</response> </match> <match> <premise> - <c>git stage <file name> </c></premise> <response>Stage changed files to be committed to the repo.</response> </match> <match> + <c>git diff</c></premise> <response>Displays unstaged changes.</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 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> <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 repo name> <branch> </c></premise> <response>Push a feature branch to your origin.</response> </match> </matches> + <c>git push <remote> <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 4d2e46c..c1e5214 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,13 +31,15 @@ <exercise xml:id="ex-list-branches" label="ex-list-branches"> <statement> <p> - The <c>git branch -l</c> (lower case L, not one) command lists all of the branches that exist in your local repository. + The <c>git branch</c> 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> @@ -45,6 +47,7 @@ 1 - <c>main</c> </p> </statement> + <feedback> <p> Look again, you should see more than just the <c>main</c> branch. @@ -55,12 +58,13 @@ <choice> <statement> <p> - 1 - <c>feature branch</c> + 1 - <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> </p> </statement> + <feedback> <p> - Look again, you should see more than just the <c>feature</c> branch. + Look again, you should see more than just the <em>feature branch</em>. </p> </feedback> </choice> @@ -68,12 +72,13 @@ <choice correct="yes"> <statement> <p> - 2 - <c>main</c> and <c>feature branch</c> + 2 - <c>main</c> and <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> </p> </statement> + <feedback> <p> - Correct! Your local repository will have both the <c>main</c> branch and your <c>feature</c> branch. + Correct! Your local repository will have both the <c>main</c> branch and your <em>feature branch</em>. </p> </feedback> </choice> @@ -84,9 +89,10 @@ 3 or more with differing branch names </p> </statement> + <feedback> <p> - If you have more than 2 branches perhaps you created a feature branch multiple times by accident. + If you have more than 2 branches perhaps you created a <em>feature branch</em> multiple times by accident. </p> </feedback> </choice> @@ -114,6 +120,7 @@ </p> </statement> + <choices> <choice correct="yes"> <statement> @@ -121,56 +128,62 @@ 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 - <c>feature branch</c> + 1 - <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> </p> </statement> + <feedback> <p> - Look again, your <c>feature</c> branch should not be listed in GitHub as it is only in your local repository. + Look again, your <em>feature branch</em> 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 <c>feature branch</c> + 2 - <c>main</c> and <em>feature branch</em> that you created in <xref ref="ex-creating-a-branch-b"/> </p> </statement> + <feedback> <p> - Look again, your <c>feature</c> branch should not be listed in GitHub as it is only in your local repository. + Look again, your <em>feature branch</em> 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 should 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 appear on GitHub. </p> </hint> </task> @@ -182,129 +195,247 @@ 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> - <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> + <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> - <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> + Correct! + </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> + You created a branch in the origin repository but it does not appear in your local repository. + </p> + </statement> - <p> - When doing so be sure to: - <ul> - <li> + <feedback> <p> - Choose “repo” for the “scopes and permissions.” + Your branch is in your local repository, not the origin repository. </p> - </li> + </feedback> + </choice> - <li> + <choice> + <statement> <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. + Someone else created a branch in the origin repository. </p> - </li> - </ul> - </p> + </statement> - <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> + <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> + + <choice> + <statement> + <p> + Someone else created a branch in their local repository and it appears in the origin repository. + </p> + </statement> + + <feedback> + <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. + </p> + </feedback> + </choice> + </choices> + + <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> </exercise> <p> <term>Pushing your Feature Branch: </term> </p> - <exercise xml:id="ex-push-branch-linux" label="ex-push-branch-linux" component="linux-kit-client"> - <introduction> + <exercise xml:id="ex-push-branch" label="ex-push-branch"> + <statement> <p> - 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. + The <c>git push <remote> <branch></c> command will push the specified branch of your local repository to the specified remote repository (i.e. on GitHub). </p> <p> - Use a command that will push your <em>feature branch</em> from your local repository to your <em>origin repository</em> on GitHub. + 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. </p> <p> - 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> + 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. </p> - </introduction> - </exercise> + </statement> - <exercise xml:id="ex-push-error-linux" label="ex-push-error-linux" component="linux-kit-client"> - <introduction> + + <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> + + <hint> <p> - 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. + 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. </p> - </introduction> + </hint> </exercise> - <exercise xml:id="ex-push-branch-vscode" label="ex-push-branch-vscode" component="vscode-kit-client"> - <introduction> + <exercise xml:id="ex-push-error" label="ex-push-error"> + <statement> <p> - 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). + Visit your origin repository on GitHub and check that the branch was pushed. + You may have to reload the page. </p> - <p> - Use a command that will push your <em>feature branch</em> from your local repo to your <em>origin repo</em> on GitHub. + How can you tell your branch was pushed? </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> - <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> + <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> + + <feedback> + <p> + Pushing a branch will not create a pull request. + </p> + </feedback> + </choice> + </choices> + + <hint> <p> - 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. + There are multiple ways you can tell that your branch has been pushed by looking at the <em>origin repository</em> on GitHub. </p> - </introduction> + </hint> </exercise> </exercises> </section> diff --git a/source/ch-upstreaming-changes/sec-staging-changes.ptx b/source/ch-upstreaming-changes/sec-staging-changes.ptx index e01aaf9..7da3d71 100644 --- a/source/ch-upstreaming-changes/sec-staging-changes.ptx +++ b/source/ch-upstreaming-changes/sec-staging-changes.ptx @@ -28,48 +28,72 @@ <title/> <introduction> <p> - The exercises in this section will walk you through staging the changes you made to your <em>Local Files</em>. + 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. </p> </introduction> <exercise xml:id="ex-staging-changes" label="ex-staging-changes"> - <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. + <statement> + <p> + Write a <c>git stage <file></c> command to stage the file that you edited. </p> - </introduction> - - - <task xml:id="ex-staging-changes-a" label="ex-staging-changes-a"> - <statement> + <p> + Enter the command you wrote below. + </p> <p> - Provide the command you entered. + <var width="55" /> </p> - </statement> - <response /> - </task> - + </statement> + <setup> + <var> + <condition string="^git stage (CONTRIBUTING.md|INSTALL.md|ONBOARDING.md|README.md)$"> + <feedback> + <p> + Thank you. + </p> + </feedback> + </condition> + <condition string="^git stage (?!(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> + <condition string=".*"> + <feedback> + <p> + Check the format of your <c>git stage</c> command. + </p> + </feedback> + </condition> + </var> + </setup> + <hint> + <p> + Check your issue again to see which file you should have edited. + </p> + </hint> + </exercise> - <task xml:id="ex-staging-changes-b" label="ex-staging-changes-b"> + <exercise xml:id="ex-staging-changes-b" label="ex-staging-changes-b"> <statement> <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. - Provide the <c>git add</c> command that would be equivalent to your answer in <xref ref="ex-staging-changes-a" />. + Now run the <c>git status</c> command again. + Paste the output of the <c>git status</c> command below. </p> </statement> <response /> - </task> - + </exercise> - <task xml:id="ex-staging-changes-c" label="ex-staging-changes-c"> + <exercise xml:id="ex-staging-changes-c" label="ex-staging-changes-c"> <statement> <p> - 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" />. + Compare your output in <xref ref="ex-staging-changes-b" /> to the output in <xref ref="ex-verify-changes-new-a" />. </p> <p> @@ -88,7 +112,7 @@ <feedback> <p> - Correct! After issuing the <c>git stage</c> (or <c>git add</c>) command the file will be staged. + Correct! After issuing the <c>git stage</c> command the file will be staged. </p> </feedback> </choice> @@ -102,7 +126,7 @@ <feedback> <p> - Once you have issued the <c>git stage</c> command it show that the file is ready to be committed. + Did you change more than 1 file by accident? Verify that you only changed the file specified in your issue. </p> </feedback> </choice> @@ -138,13 +162,12 @@ <hint> <p> - Staged means a file has been modified and added to the commit. + Staged means a file has been modified and will be added to the commit. </p> </hint> - </task> - + </exercise> - <task xml:id="ex-staging-changes-d" label="ex-staging-changes-d"> + <exercise xml:id="ex-staging-changes-d" label="ex-staging-changes-d"> <statement> <p> How many files are listed as ready to be committed? @@ -212,10 +235,98 @@ <hint> <p> - Staged means a file has been modified and added to the commit. + Staged means a file has been modified and will be added to the commit. </p> </hint> - </task> + </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> </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 7054a95..151aa2a 100644 --- a/source/ch-upstreaming-changes/sec-switching-branches.ptx +++ b/source/ch-upstreaming-changes/sec-switching-branches.ptx @@ -8,6 +8,21 @@ 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> @@ -15,7 +30,7 @@ <exercise xml:id="ex-switching-branches" label="ex-switching-branches"> <introduction> <p> - 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. + 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. The <c>git switch <name></c> command switches (i.e. changes) the active branch. </p> @@ -25,98 +40,279 @@ <task xml:id="ex-switching-branches-a" label="ex-switching-branches-a"> <statement> <p> - What command will change your active branch to the new feature branch that you created in the previous section? + 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? </p> </statement> - <response /> - </task> - <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> + <choices randomize="yes"> + <choice correct="yes"> + <statement> + <p> + Switched to branch '<name>' + </p> + </statement> - <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> + <feedback> + <p> + Correct! + </p> + </feedback> + </choice> - <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> + <choice> + <statement> + <p> + Switched to branch 'main' + </p> + </statement> + <feedback> + <p> + You were on <c>main</c> prior to switching branches. + </p> + </feedback> + </choice> - <task xml:id="ex-switching-branches-git-branch-a" label="ex-switching-branches-git-branch-a"> - <statement> + <choice> + <statement> + <p> + error: Your local changes to the following files would be overwritten by checkout: ... + </p> + + <p> + Aborting + </p> + </statement> + + <feedback> + <p> + You should not have made any changes so far. + </p> + </feedback> + </choice> + + <choice> + <statement> + <p> + fatal: invlalid reference: <name> + </p> + </statement> + + <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> <p> - 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? + Make sure you don't include < > in your <c>git switch <name></c> command. </p> - </statement> - <response /> + </hint> </task> - <task xml:id="ex-switching-branches-git-branch-b" label="ex-switching-branches-git-branch-b"> + <task xml:id="ex-switching-branches-b" label="ex-switching-branches-b"> <statement> <p> - <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? + Which of the following commands could be used to confirm that your feature branch is now the active branch? </p> </statement> - <response /> - </task> - <task xml:id="ex-switching-branches-git-branch-c" label="ex-switching-branches-git-branch-c"> - <statement> + <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> <p> - How do you know that <c>main</c> is the active branch? + There are two commands that will provide information about the active branch. </p> - </statement> - <response /> + </hint> </task> - - <task xml:id="ex-switching-branches-git-branch-d" label="ex-switching-branches-git-branch-d"> + + <task xml:id="ex-switching-branches-c" label="ex-switching-branches-c"> <statement> <p> - 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? + Which of the following commands could be used to make <c>main</c> the active branch? </p> </statement> - <response /> - </task> - <task xml:id="ex-switching-branches-git-branch-e" label="ex-switching-branches-git-branch-e"> - <statement> + <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> <p> - How do you know that your feature branch is the active branch? + Refer back to how you made your feature branch the active branch. </p> - </statement> - <response /> + </hint> </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 ed6c2af..ba40b81 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>gitkitlinux</document-id> + <document-id>gitkit</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 in a Linux desktop environment. </blurb> + <blurb shelf="Misc"> A hands-on introduction to Open Source collaboration using a git/gitHub forking workflow. </blurb> <!-- The next three lines are likely for mature projects only: --> diff --git a/source/frontmatter.ptx b/source/frontmatter.ptx index a3a60ad..cedda3d 100644 --- a/source/frontmatter.ptx +++ b/source/frontmatter.ptx @@ -5,6 +5,10 @@ <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> @@ -32,7 +36,18 @@ <date> <today /> </date> - </titlepage> + + <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> <preface> <title>Overview @@ -101,17 +116,7 @@ - - - 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 f650f89..f51eebd 100644 --- a/source/main.ptx +++ b/source/main.ptx @@ -5,7 +5,7 @@ - GitKit (Linux Desktop Edition) + GitKit (2nd ed.) 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 new file mode 100644 index 0000000..63e8f63 Binary files /dev/null and b/source/shared-images/DevEnv-Kitty-Ready.png differ diff --git a/source/shared-images/placeholder.tmp b/source/shared-images/placeholder.tmp deleted file mode 100644 index ddcd0ec..0000000 --- a/source/shared-images/placeholder.tmp +++ /dev/null @@ -1 +0,0 @@ -Can be removed when any image is added. \ No newline at end of file