xxxxxxxxxx
mkdir git-remote
cd git-remote
git init --bare
cd ..
mkdir git-local
cd git-local
git clone ../git-remote .
touch a
git add a
git commit -m "initial"
git push origin master
xxxxxxxxxx
git pull
git rm -r *
git commit
git push
Demonstration example:
git checkout <first commit hash>
git rm -r *
touch README
git add README
git commit --amend
git push -f
xxxxxxxxxx
mkdir reset
cd reset
git init
touch README.md
git add .
git commit -m 'Initial commit'
git remote add origin git@github.com:XXX/xxx.git
git push --force --set-upstream origin master
xxxxxxxxxx
# create a new repository that has the initial commit that you want
mkdir foo; cd foo; git init; ; git commit
# set up a remote
git remote add origin <url-of-remote>
git branch --set-upstream master origin/master
# push your new history
git push -f
# delete obsolete remote branches
git push origin :deprecated-branch