We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Squashing PRs

So we did a weird thing (squash commits on main), now let's do the common thing: squash all the commits on a feature branch for a pull request. If your team prefers single-commit-pull-requests, this will likely be your workflow:

  1. Create a new branch off of main.
  2. Go about your work on the feature branch making commits as you go.
  3. When you're ready to get your code into main, squash all your commits into a single commit.
  4. Push your branch to the remote repository.
  5. Open a pull request from the feature branch into main.
  6. Merge the pull request once it's approved.

Assignment

First, let's just do points 1 & 2. MegaCorp needs you to add a new feature to the content management system. Specifically, they need a script that will automatically scan for sensitive information in the repo.

printf "\n====== SCANNING FOR CREDIT CARD NUMBERS ======\n"
grep -rE --color=always '(\b[0-9]{4}[- ]?){3}[0-9]{4}\b' . --exclude-dir={.git} --line-number
echo "========= CREDIT CARD SCAN COMPLETE =========="
./scripts/scan.sh

It should find some credit card numbers in the customers/unstructured.txt file!

printf "\n==== SCANNING FOR SOCIAL SECURITY NUMBERS ====\n"
grep -rE --color=always '\b[0-9]{3}-[0-9]{2}-[0-9]{4}\b' . --exclude-dir={.git} --line-number
echo "======= SOCIAL SECURITY SCAN COMPLETE ========"
printf "\n========= SCANNING FOR PHONE NUMBERS =========\n"
grep -rE --color=always '\b[0-9]{3}-[0-9]{3}-[0-9]{4}\b' . --exclude-dir={.git} --line-number
grep -rE --color=always '\([0-9]{3}\) [0-9]{3}-[0-9]{4}' . --exclude-dir={.git} --line-number
echo "========= PHONE NUMBER SCAN COMPLETE ========="

Run and submit the CLI tests.