update module3.ipynb
This commit is contained in:
parent
f3386d3016
commit
1518f5a0bf
226
module3.ipynb
226
module3.ipynb
@ -1249,7 +1249,231 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Pushing Remote Branches"
|
||||
"# Pushing Remote Branches\n",
|
||||
"\n",
|
||||
"This reading contains the code used in the instructional videos from [**Pushing remote branches**<svg aria-labelledby=\"cds-react-aria3604314262-:r669:-title\" fill=\"none\" focusable=\"false\" height=\"16\" role=\"img\" viewBox=\"0 0 20 20\" width=\"16\" class=\"css-8blerm\" id=\"cds-react-aria3604314262-:r669:\"><title id=\"cds-react-aria3604314262-:r669:-title\">Opens in a new tab</title></svg>](https://www.coursera.org/learn/introduction-git-github/lecture/3AAD8/pushing-remote-branches)\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 checkout \\-b refactor\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"Switched to a new branch 'refactor'\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"atom all\\_checks.py\n",
|
||||
"\n",
|
||||
"(...)\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
"\n",
|
||||
" if check\\_reboot():\n",
|
||||
"\n",
|
||||
" print(\"Pending Reboot.\")\n",
|
||||
"\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
" if check\\_disk\\_full(disk=\"/\", min\\_gb=2, min\\_percent=10):\n",
|
||||
"\n",
|
||||
" print(\"Disk full.\")\n",
|
||||
"\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"(...)\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"(...)\n",
|
||||
"\n",
|
||||
"def check\\_root\\_full():\n",
|
||||
"\n",
|
||||
" \"\"\"Returns True if the root partition is full, False otherwise.\"\"\"\n",
|
||||
"\n",
|
||||
" return check\\_disk\\_full(disk=\"/\", min\\_gb=2, min\\_percent=10)\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
"\n",
|
||||
" if check\\_reboot():\n",
|
||||
"\n",
|
||||
" print(\"Pending Reboot.\")\n",
|
||||
"\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
" if check\\_root\\_full():\n",
|
||||
"\n",
|
||||
" print(\"Root partition full.\")\n",
|
||||
"\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
"(...)\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"./all\\_checks.py \n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"Everything ok.\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git commit \\-a \\-m 'Create wrapper function for check\\_disk\\_full'\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"\\[refactor e914aee\\] Create wrapper function for check\\_disk\\_full\n",
|
||||
"\n",
|
||||
" 1 file changed, 8 insertions(+), 2 deletions(-)\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"(...)\n",
|
||||
"\n",
|
||||
"def check\\_root\\_full():\n",
|
||||
"\n",
|
||||
" \"\"\"Returns True if the root partition is full, False otherwise.\"\"\"\n",
|
||||
"\n",
|
||||
" return check\\_disk\\_full(disk=\"/\", min\\_gb=2, min\\_percent=10)\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
"\n",
|
||||
" checks = \\[\n",
|
||||
"\n",
|
||||
" (check\\_reboot, \"Pending Reboot.\"),\n",
|
||||
"\n",
|
||||
" (check\\_root\\_full, \"Root partition full\"),\n",
|
||||
"\n",
|
||||
" \\]\n",
|
||||
"\n",
|
||||
" for check, msg in checks:\n",
|
||||
"\n",
|
||||
" if check():\n",
|
||||
"\n",
|
||||
" print(msg)\n",
|
||||
"\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
" print(\"Everything ok.\")\n",
|
||||
"\n",
|
||||
" sys.exit(0)\n",
|
||||
"\n",
|
||||
"(...)\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"./all\\_checks.py \n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"Everything ok.\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git commit \\-a \\-m 'Iterate over a list of checks and messages to avoid code duplication'\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"\\[refactor 75bdd43\\] Iterate over a list of checks and messages to avoid code duplication\n",
|
||||
"\n",
|
||||
" 1 file changed, 8 insertions(+), 6 deletions(-)\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"(...) \n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
"\n",
|
||||
" checks = \\[\n",
|
||||
"\n",
|
||||
" (check\\_reboot, \"Pending Reboot.\"),\n",
|
||||
"\n",
|
||||
" (check\\_root\\_full, \"Root partition full\"),\n",
|
||||
"\n",
|
||||
" \\]\n",
|
||||
"\n",
|
||||
"everything\\_ok = True\n",
|
||||
"\n",
|
||||
" for check, msg in checks:\n",
|
||||
"\n",
|
||||
" if check():\n",
|
||||
"\n",
|
||||
" print(msg)\n",
|
||||
"\n",
|
||||
" everything\\_ok = False\n",
|
||||
"\n",
|
||||
" if not everything\\_ok:\n",
|
||||
"\n",
|
||||
" sys.exit(1)\n",
|
||||
"\n",
|
||||
" print(\"Everything ok.\")\n",
|
||||
"\n",
|
||||
" sys.exit(0)\n",
|
||||
"\n",
|
||||
"(...)\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"./all\\_checks.py \n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"Everything ok.\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git commit \\-a \\-m 'Allow printing more than one error message'\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"\\[refactor cbee3f7\\] Allow printing more than one error message\n",
|
||||
"\n",
|
||||
" 1 file changed, 7 insertions(+), 1 deletion(-)\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git push \\-u origin refactor\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: 11, done.\n",
|
||||
"\n",
|
||||
"Counting objects: 100% (11/11), done.\n",
|
||||
"\n",
|
||||
"Delta compression using up to 4 threads\n",
|
||||
"\n",
|
||||
"Compressing objects: 100% (9/9), done.\n",
|
||||
"\n",
|
||||
"Writing objects: 100% (9/9), 1.34 KiB | 1.34MiB/s, done.\n",
|
||||
"\n",
|
||||
"Total 9 (delta 3), reused 0 (delta 0)\n",
|
||||
"\n",
|
||||
"remote: Resolving deltas: 100% (3/3), completed with 1 local object.\n",
|
||||
"\n",
|
||||
"remote: \n",
|
||||
"\n",
|
||||
"remote: Create a pull request for 'refactor' on GitHub by visiting:\n",
|
||||
"\n",
|
||||
"remote: https://github.com/redquinoa/health-checks/pull/new/refactor\n",
|
||||
"\n",
|
||||
"remote: \n",
|
||||
"\n",
|
||||
"To https://github.com/redquinoa/health-checks.git\n",
|
||||
"\n",
|
||||
" \\* \\[new branch\\] refactor -> refactor\n",
|
||||
"\n",
|
||||
"Branch 'refactor' set up to track remote branch 'refactor' from 'origin'."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user