0 Diffing Files
Command: $ cat rearrange1.py Code output: #!/usr/bin/env python3 import re def rearrange_name(name): result = re.search(r"^([\w .]*), ([\w .]*)$", name) if result == None: re...
Command: $ cat rearrange1.py Code output: #!/usr/bin/env python3 import re def rearrange_name(name): result = re.search(r"^([\w .]*), ([\w .]*)$", name) if result == None: re...
Command: $ cat cpu_usage.py Code output: #!/usr/bin/env python3 import psutil def check_cpu_usage(percent): usage = psutil.cpu_percent() return usage < percent if not check_cpu_us...
File with code #!/usr/bin/env python3 import shutil def check_disk_usage(disk, min_absolute, min_percent): """Returns True if there is enough free disk space, false otherwise.""" du = shutil.di...
diff and patch The diff command You use the diff command to find the differences between two files. On its own, it’s a bit hard to use; instead, use diff -u to find lines that differ in two files:...
Command: $ git config --global user.email "me@example.com" $ git config --global user.name "My name" $ mkdir checks $ cd checks # Initialized empty Git repository in `/home/user/checks/.git/` $ gi...
Command: $ cd checks $ ls -l Code output: total 4 -rw-r--r-- 1 user user 657 Jul 9 12:52 disk_usage.py Command: $ git status Code output: On branch master nothing to commit, working tree clea...
Command: $ mkdir scripts $ cd scripts $ git init Code output: Initialized empty Git repository in /home/user/scripts/.git/ Command: $ git config -l Code output: user.email=artwalker@example.com ...
Command: $ cat example_commit.txt Code output: Provide a good commit message example The purpose of this commit is to provide an example of a hand-crafted, artisanal commit message. The first l...
Study Guide: Git In any Git project, there are three sections: the Git directory, the working tree, and the staging area. This study guide provides some basic concepts and commands that can help ...
Terms and definitions Commit: A command to make edits to multiple files and treat that collection of edits as a single change Commit files: A stage where the changes made to files are safely stor...