How to do it...

  1. We now have a branch with no parent. You can verify it by examining the commit log as follows:
$ git logfatal: your current branch 'fresh-start' does not have any commits yet

Fresh start does not mean that you are starting from scratch. The files and directories that have been added to the repository still exist:

$ lsREADME.md a_sub_directory another-file.txt cat-me.txt hello_world.c$ git statusOn branch fresh-startNo commits yetChanges to be committed: (use "git rm --cached <file>..." to unstage) new file: README.md new file: a_sub_directory/readme new file: another-file.txt new file: cat-me.txt new file: hello_world.c
  1. If you need a fresh start, you can delete the files (but remember not to delete .git) as follows:

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.