czwartek, 13 października 2016

Merging all commits in repo to one

Today note copied from Stack Overflow (please consider of backuping your repo before this):
git log --oneline
Copy SHA of first commit and next (it's reset your local repo state withouch changing files):
git reset --soft <SHA of first commit>
Check that everything to commit is green:
git status
Commit your changes (--amend fixes last commit), you can change commit message by adding "-m <your new message>":
git commit --amend
Push your changes:
git push --force