From f31df72cb61cff8a924d839837af744d33de4daa Mon Sep 17 00:00:00 2001 From: the-woose Date: Thu, 6 Mar 2025 12:41:25 +0300 Subject: [PATCH] update module2.ipynb --- module2.ipynb | 143 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 2 deletions(-) diff --git a/module2.ipynb b/module2.ipynb index abdad4c..15dcc6f 100644 --- a/module2.ipynb +++ b/module2.ipynb @@ -521,7 +521,141 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# " + "# Undoing Changes Before Committing\n", + "\n", + "This reading contains the code used in the instructional videos from [**Undoing changes before committing**Opens in a new tab](https://www.coursera.org/learn/introduction-git-github/lecture/LPJn7/undoing-changes-before-committing)\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", + "cd scripts\n", + "\n", + "atom all\\_checks.py\n", + "```\n", + "\n", + "## File in video\n", + "\n", + "```bash\n", + "#!/usr/bin/env python3\n", + "\n", + "import os\n", + "\n", + "import sys\n", + "\n", + "def main():\n", + "\n", + "    if check\\_reboot():\n", + "\n", + "        print(\"Pending Reboot.\")\n", + "\n", + "        sys.exit(1)\n", + "\n", + "    print(\"Everything ok.\")\n", + "\n", + "    sys.exit(0)\n", + "\n", + "main()\n", + "```\n", + "\n", + "```bash\n", + "./all\\_checks.py \n", + "```\n", + "\n", + "**Code output:**\n", + "\n", + "Traceback (most recent call last):\n", + "\n", + "  File \"all\\_checks.py\", line 14, in \n", + "\n", + "    main()\n", + "\n", + "  File \"all\\_checks.py\", line 7, in main\n", + "\n", + "    if check\\_reboot():\n", + "\n", + "NameError: name 'check\\_reboot' is not defined\n", + "\n", + "```bash\n", + "git status\n", + "```\n", + "\n", + "**Code output:**\n", + "\n", + "On branch master\n", + "\n", + "Changes not staged for commit:\n", + "\n", + "  (use \"git add ...\" to update what will be committed)\n", + "\n", + "  (use \"git checkout -- ...\" to discard changes in working directory)\n", + "\n", + "        modified:   all\\_checks.py\n", + "\n", + "```bash\n", + "git checkout all\\_checks.py\n", + "\n", + "git status\n", + "```\n", + "\n", + "**Code output:**\n", + "\n", + "On branch master\n", + "\n", + "nothing to commit, working tree clean\n", + "\n", + "user@ubuntu:~/scripts$ ./all\\_checks.py \n", + "\n", + "Everything ok.\n", + "\n", + "```bash\n", + "./all\\_checks.py \n", + "```\n", + "\n", + "**Code output:**\n", + "\n", + "Everything ok.\n", + "\n", + "```bash\n", + "./all\\_checks.py > output.txt\n", + "\n", + "git add \\*\n", + "\n", + "git status\n", + "```\n", + "\n", + "**Code output:**\n", + "\n", + "On branch master\n", + "\n", + "Changes to be committed:\n", + "\n", + "  (use \"git reset HEAD ...\" to unstage)\n", + "\n", + "        new file:   output.txt\n", + "\n", + "```bash\n", + "git reset HEAD output.txt\n", + "\n", + "git status\n", + "```\n", + "\n", + "**Code output:**\n", + "\n", + "On branch master\n", + "\n", + "Untracked files:\n", + "\n", + "  (use \"git add ...\" to include in what will be committed)\n", + "\n", + "        Output.txt\n", + "\n", + "```bash\n", + "git commit \\-m \"it should be os.path.exists\"\n", + "```" ] }, { @@ -530,6 +664,11 @@ "source": [ "# " ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] } ], "metadata": { @@ -540,7 +679,7 @@ }, "language_info": { "name": "python", - "version": "3.12.3" + "version": "3.13.2" } }, "nbformat": 4,