<jupyter_start><jupyter_text>More Basics of Using GitCreate a directory named `countries_repo` and make sure that it is initialized as a git repository.<jupyter_code>!git init countries_repo<jupyter_output><empty_output><jupyter_text>If you have correctly initialized the repo and created the directory, the following should change the present working directory to `countries_repo`<jupyter_code>%cd countries_repo<jupyter_output><empty_output><jupyter_text>Feel free to customize the following to use your own name and email.<jupyter_code>%%bash
git config --global user.email "<EMAIL>"
git config --global user.name "<NAME>"<jupyter_output><empty_output><jupyter_text>The original approach for storing names of cities in a single file no longer makes sense because the file can grow too large. The following creates directories for different countries and writes a sample list of cities in those countries to a corresponding file.<jupyter_code>%%bash
mkdir us es uk fr

echo "New York
Los Angeles
Miami" > us/cities

echo "Madrid
Barcelona" > es/cities<jupyter_output><empty_output><jupyter_text>Now there are several untracked files in your working tree. Check which files are untracked.<jupyter_code>!git status -s<jupyter_output><empty_output><jupyter_text>To start, stage the `us` and `es` directories. Note that staging a directory automatically stages the files in the directory and in its subdirectories.<jupyter_code>!git add us es
!git status -s<jupyter_output><empty_output><jupyter_text>The `uk` and `fr` directories are currently empty but should be staged as placeholders for future development. **HINT:** Use `.gitignore` to help you.<jupyter_code>%%writefile uk/.gitignore
*
!.gitignore
%%writefile fr/.gitignore
*
!.gitignore<jupyter_output><empty_output><jupyter_text>Once the `.gitignore` files have been correctly placed, stage both the `uk` and `fr` directories.<jupyter_code>!git add uk fr<jupyter_output><empty_output><jupyter_text>Confirm that the continent directories and the corresponding files have been staged.<jupyter_code>!git status -s<jupyter_output><empty_output><jupyter_text>At this point, you should have the entire directory structure staged for a commit. The output of your `git status -s` should resemble the following:A  es/citiesA  fr/.gitignoreA  uk/.gitignoreA  us/citiesFix up any issues you may have with staging and commit the working tree.<jupyter_code>!git commit -m 'initial commit'<jupyter_output><empty_output><jupyter_text>Great! Since you did such an examplary job, you are now tasked to ensure that the `us/cities` file doesn't grow too large. Output the content of the `us/cities` to examine the cities in the United States.<jupyter_code>!cat us/cities<jupyter_output><empty_output><jupyter_text>For each line in the output (i.e. a city name), create a separate directory named after the 2 letter code for the state (e.g. `de`) and write the city names to the `cities` file. A single `mkdir` command can take multiple arguments and create multiple directories in one step.<jupyter_code>!mkdir ny ca fl
%%bash
echo "New York" > ny/cities
echo "Los Angeles" > ca/cities
echo "Miami" > fl/cities<jupyter_output><empty_output><jupyter_text>Git `status` should confirm that the three new directories in the working tree are in the untracked state.<jupyter_code>!git status<jupyter_output><empty_output><jupyter_text>Texas does not have a placeholder directory yet. Create one with the `tx` code and make sure it is staged for a commit along with the other files.<jupyter_code>!mkdir tx
%%writefile tx/.gitignore
*
!.gitignore
!git add tx ca fl ny
!git status -s<jupyter_output><empty_output><jupyter_text>Before committing, you should also delete the original `us/cities` file. It is enough to delete just the file because Git will not commit an empty directory.<jupyter_code>!git rm us/cities<jupyter_output><empty_output><jupyter_text>Now your status should look similar to the following:A  ca/citiesA  fl/citiesA  ny/citiesA  tx/.gitignoreD  us/cities<jupyter_code>!git status -s<jupyter_output><empty_output><jupyter_text>If the status matches, go ahead and commit.<jupyter_code>!git commit -m 'broke up us/cities across state dirs; deleted us/cities'<jupyter_output><empty_output><jupyter_text>Check the status again just to convince yourself that the working tree is now clean.<jupyter_code>!git status<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07906128958760537, 'fraction_numerical': 0.000227842333105491, 'mean_word_length': 6.328881469115192, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '18', 'dir': 'jupyter-structured-clean-dedup', 'id': '614735', 'license': 'Apache-2.0', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1327, 'n_words': 502, 'path': 'git0/Solution_More_Basics.ipynb', 'repo_name': 'nsingh216/edu', 'size': '4406'}