/change-commit-history

A skills course on changing the commit history with Git

MIT LicenseMIT

Remove commit history

Accidental commits can be tricky to remove with Git. In this GitHub Skills course, you'll use BFG Repo-Cleaner to to change the history of a Git repository. You can apply what you learn in this course to fully remove sensitive material from your own repository.

Welcome

A trustworthy commit history is the backbone of version control with Git. As a result, altering commit history is difficult by design. Sometimes, the history needs to be altered to remove credentials or other sensitive data that is mistakenly checked in. In this course, we'll learn how to remove content from repository's complete history and apply best practices for preventing accidental commits in the future.

  • Who is this for: Intermediate users of Git, organizations
  • What you'll learn: How to remove a file from Git's entire history
  • What you'll build: You'll manipulate the history of a Git repository
  • Prerequisites: We recommend you clone this repository to your machine and use the command line to follow along. You'll also need to install BFG Repo-Cleaner, but the steps will be covered in the course.
  • How long: This course takes less than 1 hour to complete.

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

How to start this course

start-course

  1. Right-click Start course and open the link in a new tab.
  2. In the new tab, most of the prompts will automatically fill in for you.
    • For owner, choose your personal account or an organization to host the repository.
    • We recommend creating a public repository, as private repositories will use Actions minutes.
    • Scroll down and click the Create repository button at the bottom of the form.
  3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.

Get help: Post in our discussion boardReview the GitHub status page

© 2024 GitHub • Code of ConductMIT License