Because I just started using Git, sometimes I have 10+ commits just to properly set up my repository. Deleting all clumsy commit history can make me professional (not true).
Step 1. Checkout
1 | git checkout --orphan new_branch |
Step 2. Add all files
1 | git add -A |
Step 3. Commit changes
1 | git commit -am "Initial commit" |
Step 4. Delete the previous branch
1 | git branch -D master |
Step 5. Rename the current branch to master
1 | git branch -m master |
Step 6. Force update the repository
1 | git push -f origin master |
At last, special thanks to stack overflow, which gives me the chance to pretend I’m proficient in Git.