Skip to content

Commit

Permalink
move steps around to avoid force push
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorsector committed Jan 19, 2024
1 parent aa59690 commit 55b87f1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ There are multiple tools available for removing Git history, we'll use BFG Repo-
### :keyboard: Activity: Use BFG Repo-Cleaner to remove the `.env` file

1. Install BFG Repo-Cleaner on your machine. You can follow the [instructions on the web site](https://rtyley.github.io/bfg-repo-cleaner/) to do so or you can use a package manager for your operating system.
2. Confirm the `.env` file is removed from the root directory. THe command should return empty.
2. Confirm the `.env` file is removed from the root directory. The command should return empty.
```shell
find . -name ".env"
```
Expand All @@ -33,8 +33,13 @@ There are multiple tools available for removing Git history, we'll use BFG Repo-
bfg --delete-files .env
```
5. The tool will run and make some suggestions about some follow-up commands. Run those to get your local repository cleaned up.
6. Push your changes to GitHub. Note we're using the `--force` argument in this step since we're altering Git history.
6. Once again, search for .env in the repository's history. This time, running the command should return empty.
```shell
# should return empty
git log --stat --all -- .env
```
7. Push your changes to GitHub. Note we're using the `--force` argument in this step since we're altering Git history.
```shell
git push --force
```
7. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
8. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:
fetch-depth: 0 # Let's get all the branches.

# TBD-step-1-additional-steps
- name: Ensure .env is gone from the root directory
- name: Check if .gitignore contains .env
run: |
if [ -f .env ]; then
echo "The .env file still exists in the root directory, please remove it."
exit 1
else
echo "Great! The .env is no longer in the root directory."
if grep -qw ".env" .gitignore; then
echo ".env is in .gitignore"
exit 0
else
echo ".env is not in .gitignore"
exit 1
fi
# In README.md, switch step 1 for step 2.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ jobs:
fetch-depth: 0 # Let's get all the branches.

# TBD-step-2-additional-steps
- name: Ensure .env is gone from history
- name: Ensure .env is gone from the root directory
run: |
if [ -n "$(git log --stat --all -- .env)" ]; then
echo "File .env is still in the repository's history, please remove it."
if [ -f .env ]; then
echo "The .env file still exists in the root directory, please remove it."
exit 1
else
echo "File .env doesn't exist in the repository's history."
echo "Great! The .env is no longer in the root directory."
exit 0
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:
fetch-depth: 0 # Let's get all the branches.

# TBD-step-3-additional-steps
- name: Check if .gitignore contains .env
- name: Ensure .env is gone from history
run: |
if grep -qw ".env" .gitignore; then
echo ".env is in .gitignore"
exit 0
else
echo ".env is not in .gitignore"
if [ -n "$(git log --stat --all -- .env)" ]; then
echo "File .env is still in the repository's history, please remove it."
exit 1
else
echo "File .env doesn't exist in the repository's history."
exit 0
fi
# In README.md, switch step 3 for step 4.
Expand All @@ -73,5 +73,5 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 3
to_step: X
to_step: 4
branch_name: tbd-branch-name
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ A trustworthy commit history is the backbone of version control with Git. As a r

In this course, you will:

1. Remove content from the root directory of a repository
2. Use BFG Repo-Cleaner to remove content from repository history
3. Avoid future accidental commits by adding a pattern to `.gitignore`
1. Avoid future accidental commits by adding a pattern to `.gitignore`
2. Remove content from the root directory of a repository
3. Use BFG Repo-Cleaner to remove content from repository history

### How to start this course

Expand Down

0 comments on commit 55b87f1

Please sign in to comment.