Skip to content

Instantly share code, notes, and snippets.

@atelierbram
Created January 29, 2023 16:00
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 atelierbram/1d575a728f4841482e2d8d1b3208d0df to your computer and use it in GitHub Desktop.
Save atelierbram/1d575a728f4841482e2d8d1b3208d0df to your computer and use it in GitHub Desktop.
Start over in Github

Start over in GitHub

  • Create a new branch to point to your old code
  • Delete all the code and commit on master
  • Start your rewrite on master
# checkout the master branch
git checkout master

# create a new branch so you can find the old code easily
git branch oldStuff-KeepingForReference

# push the branch to github
git push origin oldStuff-KeepingForReference

# You currently have the master branch checked out
# so now cd to the project root and start your rewrite: 
cd <your project root>
rm -rf *

# Create a commit of the delete
git add --all *
git commit -m "Fresh start"

# Start your rewrite
echo "Some changes" > file.txt
git add file.txt
git commit -m "This is the first commit of the rewrite"

Source

softwareengineering.stackexchange.com/questions/311261/how-to-start-over-in-github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment