update module3.ipynb
This commit is contained in:
parent
31bc91aa27
commit
c02d7f449f
130
module3.ipynb
130
module3.ipynb
@ -398,7 +398,135 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Updating the Local Repository"
|
||||
"# Updating the Local Repository\n",
|
||||
"\n",
|
||||
"This reading contains the code used in the instructional videos from [**Updating the Local Repository**<svg aria-labelledby=\"cds-react-aria3604314262-:r4m2:-title\" fill=\"none\" focusable=\"false\" height=\"16\" role=\"img\" viewBox=\"0 0 20 20\" width=\"16\" class=\"css-8blerm\" id=\"cds-react-aria3604314262-:r4m2:\"><title id=\"cds-react-aria3604314262-:r4m2:-title\">Opens in a new tab</title></svg>](https://www.coursera.org/learn/introduction-git-github/lecture/UjnyI/updating-the-local-repository)\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 pull\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"remote: Enumerating objects: 8, done.\n",
|
||||
"\n",
|
||||
"remote: Counting objects: 100% (8/8), done.\n",
|
||||
"\n",
|
||||
"remote: Compressing objects: 100% (5/5), done.\n",
|
||||
"\n",
|
||||
"Unpacking objects: 100% (6/6), done.\n",
|
||||
"\n",
|
||||
"remote: Total 6 (delta 1), reused 6 (delta 1), pack-reused 0\n",
|
||||
"\n",
|
||||
"From https://github.com/redquinoa/health-checks\n",
|
||||
"\n",
|
||||
" 807cb50..b62dc2e master -> origin/master\n",
|
||||
"\n",
|
||||
" \\* \\[new branch\\] experimental -> origin/experimental\n",
|
||||
"\n",
|
||||
"Updating 807cb50..b62dc2e\n",
|
||||
"\n",
|
||||
"Fast-forward\n",
|
||||
"\n",
|
||||
" all\\_checks.py | 15 +++++++++++++++\n",
|
||||
"\n",
|
||||
" 1 file changed, 15 insertions(+)\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git \\-log \\-p \\-1\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"commit 922d65950b5325109525a24b71d8df8a46412d04 (HEAD -> master, origin/master, origin/HEAD)\n",
|
||||
"\n",
|
||||
"Author: Blue Kale <bluekale@example.com>\n",
|
||||
"\n",
|
||||
"Date: Mon Jan 6 14:42:44 2020 -0800\n",
|
||||
"\n",
|
||||
" Add disk full check to all\\_checks.py\n",
|
||||
"\n",
|
||||
"diff --git a/all\\_checks.py b/all\\_checks.py\n",
|
||||
"\n",
|
||||
"index fdc4476..e46cdae 100755\n",
|
||||
"\n",
|
||||
"\\--- a/all\\_checks.py\n",
|
||||
"\n",
|
||||
"+++ b/all\\_checks.py\n",
|
||||
"\n",
|
||||
"@@ -1,16 +1,31 @@\n",
|
||||
"\n",
|
||||
" #!/usr/bin/env python3\n",
|
||||
"\n",
|
||||
" import os\n",
|
||||
"\n",
|
||||
"+import shutil\n",
|
||||
"\n",
|
||||
" import sys\n",
|
||||
"\n",
|
||||
"(...)\n",
|
||||
"\n",
|
||||
"def(check\\_reboot): \n",
|
||||
"\n",
|
||||
"\"\"\" Returns True if the computer has a pending reboot.\"\"\"\n",
|
||||
"\n",
|
||||
"Return os.path.exists(“/run/reboot-required”)\n",
|
||||
"\n",
|
||||
"+def check\\_disk\\_full(disk, mmin\\_absolute, min\\_percent):\n",
|
||||
"\n",
|
||||
"\\+ \"\"\"Returns True if there isn’t enough disk space, False otherwise.\"\"\"\n",
|
||||
"\n",
|
||||
"\\+ du = shutil.disk\\_usage(disk)\n",
|
||||
"\n",
|
||||
"\\+ # Calculate the percentage of free space\n",
|
||||
"\n",
|
||||
"\\+ percent\\_free = 100 \\* du.free / du.total\n",
|
||||
"\n",
|
||||
"\\+ # Calculate how many free gigabytes\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git remote show origin\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"\\* remote origin\n",
|
||||
"\n",
|
||||
" Fetch URL: https://github.com/redquinoa/health-checks.git\n",
|
||||
"\n",
|
||||
" Push URL: https://github.com/redquinoa/health-checks.git\n",
|
||||
"\n",
|
||||
" HEAD branch: master\n",
|
||||
"\n",
|
||||
" Remote branches:\n",
|
||||
"\n",
|
||||
" experimental tracked\n",
|
||||
"\n",
|
||||
" master tracked\n",
|
||||
"\n",
|
||||
" Local branch configured for 'git pull':\n",
|
||||
"\n",
|
||||
" master merges with remote master\n",
|
||||
"\n",
|
||||
" Local ref configured for 'git push':\n",
|
||||
"\n",
|
||||
" master pushes to master (up to date)\n",
|
||||
"\n",
|
||||
"```bash\n",
|
||||
"git checkout experimental \n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"**Code output:** \n",
|
||||
"\n",
|
||||
"Branch 'experimental' set up to track remote branch 'experimental' from 'origin'.\n",
|
||||
"\n",
|
||||
"Switched to a new branch 'experimental'"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user