{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The Typical Pull Request Workflow on GitHub\n", "\n", "This reading contains the code used in the instructional videos from [**The Typical Pull Request Workflow on GitHub**Opens in a new tab](https://www.coursera.org/learn/introduction-git-github/lecture/8mpDb/the-typical-pull-request-workflow-on-github)\n", "\n", "## Introduction\n", "\n", "This follow-along reading is organized to match the content in the video that follows. It contains the same code shown in the next video. These code blocks will provide you with the opportunity to see how the code is written and can be used as a reference as you work through the course. \n", "\n", "You can follow along in the reading as the instructor discusses the code or review the code after watching the video.\n", "\n", "```bash\n", "git clone https://github.com/redquinoa/rearrange.git\n", "```\n", "\n", "**Code output:** \n", "\n", "Cloning into 'rearrange'...\n", "\n", "remote: Enumerating objects: 9, done.\n", "\n", "remote: Counting objects: 100% (9/9), done.\n", "\n", "remote: Compressing objects: 100% (7/7), done.\n", "\n", "remote: Total 9 (delta 1), reused 9 (delta 1), pack-reused 0\n", "\n", "Unpacking objects: 100% (9/9), done.\n", "\n", "```bash\n", "cd rearrange\n", "\n", "ls \\-l\n", "```\n", "\n", "**Code output:** \n", "\n", "total 20\n", "\n", "\\-rw-rw-r-- 1 user user 11357 Jan 7 09:42 LICENSE\n", "\n", "\\-rw-rw-r-- 1 user user   211 Jan 7 09:42 rearrange.py\n", "\n", "\\-rw-rw-r-- 1 user user   762 Jan 7 09:42 rearrange\\_test.py\n", "\n", "```bash\n", "git log\n", "```\n", "\n", "**Code output:** \n", "\n", "commit 367a127672c40a163a6f05ad930f2b0b857dc961  (HEAD -> master, origin/master, origin/HEAD)\n", "\n", "Author: Blue Kale \n", "\n", "Date:   Mon Jul 29 21:21:53 2019 +0200\n", "\n", "    Add tests for the rearrange module\n", "\n", "commit c89805e52a1afa143c503f946cc5ead0fdd20255\n", "\n", "Author: Blue Kale \n", "\n", "Date:   Mon Jul 29 21:20:57 2019 +0200\n", "\n", "    Add the rearrange module\n", "\n", "commit f4ddbc7a0ca3ac83a7e9ce7030e774b58e5dda42\n", "\n", "Author: Blue Kale <53440916+blue-kale@users.noreply.github.com>\n", "\n", "Date:   Mon Jul 29 16:07:42 2019 -0300\n", "\n", "    Initial commit\n", "\n", "```bash\n", "git checkout \\-b add\\-readme\n", "```\n", "\n", "**Code output:** \n", "\n", "Switched to a new branch 'add-readme'\n", "\n", "```bash\n", "git atom README.md \n", "\n", "Rearrange\n", "\n", "\\=========\n", "\n", "This module is used for rearranging names. \n", "```\n", "\n", "```bash\n", "git add README.md\n", "\n", "git commit \\-m 'Add a simple README.md file'\n", "```\n", "\n", "**Code output:** \n", "\n", "\\[master 736d754\\] Add a simple README.md file\n", "\n", " 1 file changed, 4 insertions(+)\n", "\n", " create mode 100644 README.md\n", "\n", "```bash\n", "git push \\-u origin add\\-readme\n", "```\n", "\n", "**Code output:** \n", "\n", "Username for 'https://github.com': redquinoa\n", "\n", "Password for 'https://redquinoa@github.com': \n", "\n", "Enumerating objects: 4, done.\n", "\n", "Counting objects: 100% (4/4), done.\n", "\n", "Delta compression using up to 4 threads\n", "\n", "Compressing objects: 100% (3/3), done.\n", "\n", "Writing objects: 100% (3/3), 400 bytes | 400.00 KiB/s, done.\n", "\n", "Total 3 (delta 0), reused 0 (delta 0)\n", "\n", "remote: \n", "\n", "remote: Create a pull request for 'add-readme' on GitHub by visiting:\n", "\n", "remote:      https://github.com/redquinoa/rearrange/pull/new/add-readme\n", "\n", "remote: \n", "\n", "To https://github.com/redquinoa/rearrange.git\n", "\n", " \\* \\[new branch\\]      add-readme -> add-readme\n", "\n", "Branch 'add-readme' set up to track remote branch 'add-readme' from 'origin'." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Updating an Existing Pull Request\n", "\n", "This reading contains the code used in the instructional videos from [**Updating an Existing Pull Request**Opens in a new tab](https://www.coursera.org/learn/introduction-git-github/lecture/aRZ95/updating-an-existing-pull-request)\n", "\n", "## Introduction\n", "\n", "This follow-along reading is organized to match the content in the video that follows. It contains the same code shown in the next video. These code blocks will provide you with the opportunity to see how the code is written and can be used as a reference as you work through the course. \n", "\n", "You can follow along in the reading as the instructor discusses the code or review the code after watching the video.\n", "\n", "```bash\n", "atom README.md\n", "\n", "Rearrange\n", "\n", "\\=========\n", "\n", "This module is used for rearranging names. \n", "\n", "Turns \"LastName,FirstName\" into \"Firstname LastName\"\n", "\n", "# Example\n", "\n", "Calling \\`rearrange\\_name(\"Turing, Alan\")\\` will return \\`\"Alan Turing\"\\`\n", "```\n", "\n", "```bash\n", "git commit \\-a \\-m 'Add more information to the README'\n", "```\n", "\n", "**Code output:** \n", "\n", "\\[add-readme 01231b0\\] Add more information to the README\n", "\n", " 1 file changed, 5 insertions(+)\n", "\n", "```bash\n", "git push\n", "```\n", "\n", "**Code output:** \n", "\n", "Username for 'https://github.com': redquinoa\n", "\n", "Password for 'https://redquinoa@github.com': redquinoa\n", "\n", "Enumerating objects: 5, done.\n", "\n", "Counting objects: 100% (5/5), done.\n", "\n", "Delta compression using up to 4 threads\n", "\n", "Compressing objects: 100% (3/3), done.\n", "\n", "Writing objects: 100% (3/3), 407 bytes | 407.00 KiB/s, done.\n", "\n", "Total 3 (delta 1), reused 0 (delta 0)\n", "\n", "remote: Resolving deltas: 100% (1/1), completed with 1 local object.\n", "\n", "To https://github.com/redquinoa/rearrange.git\n", "\n", "   736d754..01231b0  add-readme -> add-readme" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Squashing Changes\n", "\n", "This reading contains the code used in the instructional videos from [**Squashing Changes**Opens in a new tab](https://www.coursera.org/learn/introduction-git-github/lecture/6ODVl/squashing-changes)\n", "\n", "## Introduction\n", "\n", "This follow-along reading is organized to match the content in the video that follows. It contains the same code shown in the next video. These code blocks will provide you with the opportunity to see how the code is written and can be used as a reference as you work through the course. \n", "\n", "You can follow along in the reading as the instructor discusses the code or review the code after watching the video.\n", "\n", "```bash\n", "git rebase \\-i master\n", "```\n", "\n", "```bash\n", "pick 736d754 Add a simple README file\n", "\n", "pick 01231b0 Add more information to the README\n", "\n", "(...)\n", "```\n", "\n", "```bash\n", "pick 736d754 Add a simple README file\n", "\n", "squash 01231b0 Add more information to the README\n", "\n", "(...)\n", "```\n", "\n", "```bash\n", "# This is a combination of 2 commits. \n", "\n", "# This is the 1st commit message:\n", "\n", "Add a simple README file\n", "\n", "# This is the commit message #2:\n", "\n", "Add more information to the README\n", "\n", "(...)\n", "```\n", "\n", "```bash\n", "# This is a combination of 2 commits. \n", "\n", "# This is the 1st commit message:\n", "\n", "Add a simple README file including an example use case\n", "\n", "# This is the commit message #2:\n", "\n", "Add more information to the README\n", "\n", "(...)\n", "```\n", "\n", "**Code output:** \n", "\n", "git rebase -i master\n", "\n", "\\[detached HEAD ae779e4\\] Add a simple README.md file including an example use case\n", "\n", " Date: Tue Jan 7 09:47:17 2020 -0800\n", "\n", " 1 file changed, 9 insertions(+)\n", "\n", " create mode 100644 README.md\n", "\n", "Successfully rebased and updated refs/heads/add-readme.\n", "\n", "```bash\n", "git show\n", "```\n", "\n", "**Code output:**\n", "\n", "commit ae779e430288b082a19062ed087c547e1051a981 (HEAD -> add-readme)\n", "\n", "Author: My name \n", "\n", "Date:   Tue Jan 7 09:47:17 2020 -0800\n", "\n", "    Add a simple README file including an example use case\n", "\n", "diff --git a/README.md b/README.md\n", "\n", "new file mode 100644\n", "\n", "index 0000000..5761a46\n", "\n", "\\--- /dev/null\n", "\n", "+++ b/README.md\n", "\n", "@@ -0,0 +1,9 @@\n", "\n", "+Rearrange\n", "\n", "+=========\n", "\n", "+\n", "\n", "+This module is used for rearranging names.\n", "\n", "+Turns \"LastName, FirstName\" into \"FirstName LastName\"\n", "\n", "+\n", "\n", "+# Example\n", "\n", "+\n", "\n", "+Calling \\`rearrange\\_name(\"Turing, Alan\")\\` will return \\`\"Alan Turing\"\\`\n", "\n", "```bash\n", "git status\n", "```\n", "\n", "**Code output:**\n", "\n", "On branch add-readme\n", "\n", "Your branch and 'origin/add-readme' have diverged,\n", "\n", "and have 1 and 2 different commits each, respectively.\n", "\n", "  (use \"git pull\" to merge the remote branch into yours)\n", "\n", "nothing to commit, working tree clean\n", "\n", "```bash\n", "git log \\--graph \\--oneline \\--all \\-4\n", "```\n", "\n", "**Code output:**\n", "\n", "\\* ae779e4 (HEAD -> add-readme) Add a simple README.md file including an example use case\n", "\n", "| \\* 01231b0 (origin/add-readme) Add more information to the README\n", "\n", "| \\* 736d754 Add a simple README.md file\n", "\n", "|/  \n", "\n", "\\* 367a127 (origin/master, origin/HEAD, master) Add tests for the rearrange module\n", "\n", "```bash\n", "git push\n", "```\n", "\n", "**Code output:**\n", "\n", "Username for 'https://github.com': redquinoa\n", "\n", "Password for 'https://redquinoa@github.com': redquinoa\n", "\n", "To https://github.com/redquinoa/rearrange.git\n", "\n", " ! \\[rejected\\]        add-readme -> add-readme (non-fast-forward)\n", "\n", "error: failed to push some refs to 'https://github.com/redquinoa/rearrange.git'\n", "\n", "hint: Updates were rejected because the tip of your current branch is behind\n", "\n", "hint: its remote counterpart. Integrate the remote changes (e.g.\n", "\n", "hint: 'git pull ...') before pushing again.\n", "\n", "hint: See the 'Note about fast-forwards' in 'git push --help' for details.\n", "\n", "```bash\n", "git push \\-f\n", "```\n", "\n", "**Code output:**\n", "\n", "Enumerating objects: 4, done.\n", "\n", "Counting objects: 100% (4/4), done.\n", "\n", "Delta compression using up to 4 threads\n", "\n", "Compressing objects: 100% (3/3), done.\n", "\n", "Writing objects: 100% (3/3), 510 bytes | 510.00 KiB/s, done.\n", "\n", "Total 3 (delta 0), reused 0 (delta 0)\n", "\n", "To https://github.com/redquinoa/rearrange.git\n", "\n", " + 01231b0...ae779e4 add-readme -> add-readme (forced update)\n", "\n", "```bash\n", "git log \\--graph \\--oneline \\--all \\-4\n", "```\n", "\n", "**Code output:**\n", "\n", "\\* ae779e4 (HEAD -> add-readme, origin/add-readme) Add a simple README.md file including an example use case\n", "\n", "\\* 367a127 (origin/master, origin/HEAD, master) Add tests for the rearrange module\n", "\n", "\\* c89805e Add the rearrange module\n", "\n", "\\* f4ddbc7 Initial commit" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Study guide: Git forks and pull requests\n", "\n", "GitHub is an open-source platform for collaboration and knowledge sharing, allowing users to explore code created by others. This study guide will provide you with pointers on effectively using the platform to make pull requests in the Git environment.\n", "\n", "## Pull requests\n", "\n", "Pull requests allow you to inform fellow contributors about changes that have been made to a branch in Git. When pulling requests, you can discuss and evaluate proposed changes before implementing changes to the primary branch.\n", "\n", "You can eventually merge changes back into the main repository (or repo) by creating a pull request. However, it is important to note that before any changes are made to the original code, GitHub creates a fork (or a copy of the project), which allows changes to be committed to the fork copy even if changes cannot be pushed to the other repo. Anyone can suggest changes through the inline comment in pull requests, but the owner only has rights to review and approve changes before merging them. To create a pull request:\n", "\n", "- Make changes to the file.\n", "- Change the proposal and complete a description of the change.\n", "- Click the Proposed File Change button to create a commit in the forked repo to send the change to the owner.\n", "- Enter comments about the change. If more context is needed about the change, use the text box.\n", "- Click Pull Request.\n", "\n", "When creating multiple commits, a number next to the pull request serves as the identifier for accessing the pull requests in the future. This is important because it allows project maintainers to follow up with questions or comments.  \n", "\n", "For more information on creating pull requests, click the following link: [Creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)\n", "\n", "## Pull request merges\n", "\n", "![](https://d3c33hcgiwev3.cloudfront.net/imageAssetProxy.v1/C4nl1oqQSTu0dZT1j4L98Q_8d0d6fd1b8dc43d2b79ee99e6fd7f5f1_2xl_S7thfUImmrOHv7kbUeYXKDckZ7BSdT8i0PFVVSNhAkIZMmWCrgU7NiIU00sjWjUEXdTuRDaEQa6W7f-W0v1NICHE_LJG8C_HIEk6BCwIPnjA_yXRxCyAxJFIt9B-8r5tvsMYnAvQZ3Dlx7rvCARDCLIpeiDZKWXrA8jqmn-BejbtUSrIGVQvQMD8hqB1-E_hAFZQlhTL1KKlcEUgfAVj4Ujg7zTa8e8srA?expiry=1741564800000&hmac=ghGRJikSZyhA-dmlf7NKTb6NCmq5BSzkMa4zxMiTWMI)\n", "\n", "You can merge pull requests by retaining the commits. Below is a list of pull request merge options that you can use when merging pull requests.\n", "\n", "**Merge commits.** All commits from the feature branch are added to the base branch in a merge commit using the -- no–ff option. \n", "\n", "**Squash and merge commits.** Multiple commits of a pull request are squashed, or combined into a single commit, using the fast-forward option. It is recommended that when merging two branches, pull requests are squashed and merged to prevent the likelihood of conflicts due to redundancy.\n", "\n", "**Merge message for a squash merge.** GitHub generates a default commit message, which you can edit. This message may include the pull request title, pull request description, or information about the commits.\n", "\n", "**Rebase and merge commits.** All commits from the topic branch are added onto the base branch individually without a merge commit. \n", "\n", "**Indirect merges.** GitHub can merge a pull request automatically if the head branch is directly or indirectly merged into the base branch externally.\n", "\n", "## Key takeaways\n", "\n", "Pull requests are a crucial tool you can use for efficiently capturing, implementing, and receiving approvals for changes. These capabilities are made possible through collaboration. Practicing pull requests can help you hone your skills and contribute to a project." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# How to Use Code Reviews in GitHub" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# More Information on Code Reviews" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Tracking Issues" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Integrating git and GitHub" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# GitHub Project Management Tools" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Additional Tools" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Glossary terms from module 4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Exemplar: Push local commits to GitHub" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# IT skills in action" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Tailor your resume" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Create a resume and add your new skills" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Add your job experience to your resume" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Writing a Cover Letter" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Course 3 glossary" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }