reverting previous git commit that is not the last one -


i have git project , have 5 commits ranging 2-4 files changed. there 1 commit did, affecting 2 files, should not have done branch checked out. revert changes made in specific commit, reverting 2 files previously.

these files have no other change history on branch (again, shouldn't have been changed on branch @ all). how do this?

as bonus, cool "re-assign" commit branch should have had checked out @ time, that's over-ambitious. can make changes again manually correct branch checked out.

one final thing, use sourcetree, knowing cli method well.

not sure understood you, have reorder commits , open new branches

first let's have commits:

c5 c4 c3 c2 c1 

now want revert commit c3 do

git rebase -i head~3 

now i'll new screen show me last 3 commits, change order of commits, , place c3 in last spot.

now save , run it.

now removing last commit, moment last commit c3, do

git reset --hard head^ 

this reset 1 commit back.

after finished that, should push changes repository, can with:

git push origin mater -f 

we place -f forcing our changes repository.

just make sure, sure in changes reverting history, , action not revertable