revert committed changes from local repository
I have committed a lot of changes into my local repository but I want to push only few of them. Is it possible? I have a list (before push) with all my changes, but I need to push only few. I would like to revert all this changes from my local repostitory. I created patches with only changes I want to push but now I cannot remove changes from my local repo. I tried to use git reset hard
but it does not work as I want.
If you really, really just want to delete unwanted commits, then do
git rebase -i <sha_of_commit_before_those_that_are_unwanted>
and then delete lines with commits you want to get rid of.
However , bear in mind that those commit will disappear and getting them back might not be possible. Maybe push those commits to a temporary remote branch first, or make a local branch with them?
Now that you've gotten rid of your commits, you can do a simple git push origin branch
上一篇: 删除提交但保留更改
下一篇: 从本地存储库还原已提交的更改