0

We are moving some repositories from GitHub to BitBucket and we do not want to delete the ones in GitHub because we still have some issues in their issue tracker. We are waiting for this bug to be solved so we can correctly export the issues. So for now we just want to delete all the history of the repository and insert as the initial commit a very small README.md file.

silviubogan
  • 2,416
  • 3
  • 21
  • 38

2 Answers2

1
  1. Copy your working directory to a new directory.

  2. Inside that directory do a git init; git add.; git commit -m 'First Commit Message'

  3. If you want publish this new repo to one of your remote servers, just add the server as remote with git remote add remote-name remote-URL and then a git push remote-name to upload things to the remote that you just add to the new repo and update that remote with the content of this new repo.

    In the case that the remote already has things on the master branch, you could need to -force push: git push -f remote-name

jonrsharpe
  • 99,167
  • 19
  • 183
  • 334
0

Use this:

$ git reset --hard `git rev-list --max-parents=0 HEAD`
$ git rm -r '*'

then one of the following:

$ git commit --amend --allow-empty

or if you want with a README file, use this, but before, please replace vim with your preferred text/code editor and instead of README.md use what name you want for the initial commit's single file:

$ vim README.md
$ git add README.md
$ git commit --amend

I wrote this answer with help from this, this and this StackOverflow answers.

silviubogan
  • 2,416
  • 3
  • 21
  • 38