Skip to content

Instantly share code, notes, and snippets.

@Mr-Kumar-Abhishek
Forked from ozh/new empty git branch.md
Created February 23, 2019 07:17
Show Gist options
  • Select an option

  • Save Mr-Kumar-Abhishek/db1e6803fd89bdcde0d637d92c4a2ee6 to your computer and use it in GitHub Desktop.

Select an option

Save Mr-Kumar-Abhishek/db1e6803fd89bdcde0d637d92c4a2ee6 to your computer and use it in GitHub Desktop.

Revisions

  1. @ozh ozh renamed this gist Feb 7, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @ozh ozh created this gist Feb 7, 2013.
    9 changes: 9 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    ```
    $ git checkout --orphan NEWBRANCH
    $ git rm -rf .
    ```

    `--orphan` creates a new branch, but it starts without any commit. After running the above command you are on a new branch "NEWBRANCH", and the first commit you create from this state will start a new history without any ancestry.

    You can then start adding files and commit them and they will live in their own branch. If you take a look at the log, you will see that it is isolated from the original log.