Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
Creating an empty commit in a new project
$ git clone <stash>/your_new_proj.git
$ cd your_new_proj
$ git commit -m "initial commit" --allow-empty
If you need to create a new parent with no files in an existing project (ie, you oops'd)
$ git clone <stash>/your_existing_proj.git
# create a new empty branch with no history
$ git checkout --orphan new_root
# unstage and remove existing files
$ git rm -rf .
$ git commit -m 'initial commit' --allow-empty
# move history of master branch onto the empty commit
$ git rebase --root master --onto new_root
# overwrite the remote repository's history for master
$ git push -f origin master
# remove the branch locally as it is no longer needed
$ git branch -d new_root
If you need to create a new empty branch:
git checkout --orphan <branch_name>