Skip to content

Instantly share code, notes, and snippets.

@setdjod
Created May 31, 2019 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save setdjod/05e6dd6a6cbf10fd1922e8373eb79e74 to your computer and use it in GitHub Desktop.
Save setdjod/05e6dd6a6cbf10fd1922e8373eb79e74 to your computer and use it in GitHub Desktop.
Remove History Commit

Remove History Commit on Github

Create Orphan Branch

git checkout --orphan temp_branch

Add Files to Branch

git add -A
git commit -am "the first commit"

Delete master Branch

git branch -D master

Rename Current Branch

git branch -m master

Push Changes

git push -f origin master

Source: tecadmin.net

#!/bin/bash
# Remove History Commit
# Create Orphan Branch
git checkout --orphan temp_branch
# Add Files to Branch
git add -A
git commit -am "the first commit"
# Delete master Branch
git branch -D master
# Rename Current Branch
git branch -m master
# Push Changes
git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment