git - Comment modifier un commit spécifié

Mots clés : gitgit-rewrite-historygit

meilleur 4 Réponses git - Comment modifier un commit spécifié

vote vote

94

$ git rebase --interactive 'bbc643cd^' 
$ git commit --all --amend --no-edit 
$ git rebase --continue 
vote vote

88

git rebase -i @~9   # Show the last 9 commits in a text editor 
$ git reset @~3   # go back 3 commits $ git reflog c4f708b HEAD@{0}: reset: moving to @~3 2c52489 HEAD@{1}: commit: more changes 4a5246d HEAD@{2}: commit: make important changes e8571e4 HEAD@{3}: commit: make some changes ... earlier commits ... $ git reset 2c52489 ... and you're back where you started 
vote vote

76

$ git log --graph --oneline * b42d293 Commit3 * e8adec4 Commit2 * faaf19f Commit1 
$ git commit -m "fixup! Commit2" 
$ git rebase e8adec4^ -i --autosquash 
pick e8adec4 Commit2 fixup 54e1a99 fixup! Commit2 pick b42d293 Commit3 
vote vote

64

git rebase -i HEAD~3  
pick e499d89 Delete CNAME pick 0c39034 Better README pick f7fde4a Change the commit message but push the same commit. 
pick e499d89 Delete CNAME reword 0c39034 Better README pick f7fde4a Change the commit message but push the same commit. 
git push --force 

Questions similaires