V každém případě se nedoporučuje upravovat commity už pushlé na server. Sice se změněné commity bez problémů pushnou na server, ale problém můžou mít ostatní uživatelé. Pokud si totiž ty původní commity někdo už pullnul k sobě, tak se pak trochu zapotí...
Změna posledního commitu
... je jednoduchá a bezproblémová
git commit --amend
Změna staršího commitu
git rebase -i
git add
git commit --amend
git rebase --continue
Delete file/directory from history
- Delete the single file StackOverflow:
git filter-branch --index-filter 'git update-index --remove myFile' HEAD # ATTENTION: do backup of this file if you don't want actually to lose it! - Delete the whole directory - more complicated because of references (Stack Overflow)