If you have lots of commits like "Oops", "Reverted X", "Fixed bug", squash them.
- Backup your current repo by copying it into another folder
- Be sure to remove the
.git
folder as you don't need that in your backup.
- Be sure to remove the
- Go back to the working folder, aka the one with the
.git
folder. git log --pretty=oneline --abbrev-commit
- The displayed list will be shown top (newest) to bottom (oldest).
- Find the main commit that you made (before the small fixes).
- Copy the code under it, it will look something like this...
742c3ac
git rebase -i <abbreviated commit code>
- Git should guide you through this.
- If you need to fix conflicts your files will be edited, and you will get an error.
- Don't panic
- Review your changes!
- Make sure to review your changes sometimes conflict resolution can get undesirable code back into your repo.
- When you're ready use
git push --force
to push your rebase.
- Don't panic! You made a backup.
- Delete everything besides the
.git
folder. - Copy and paste everything from your backup.
- Now just push the change as a new commit.
- Be sure to be very descriptive in your commit message/comment.
You may also want to look into this stackoverflow question and the answer provided.
You don't have to write a paragraph about all your changes, but describe what you're trying to do in a clear way.
Always test and check your code, and don't just test once. Test multiple times in multiple environements. If your code isn't tested don't commit.
This addon will be runnning with other addons, please make sure it plays nice. Specify any detours, try not to error, and be sure to make all your codes behaviour expected.