Reputation: 400
I made a mistake when rebased commits on my branch and then pushing everything. Afterwards I made a few more commits and tried to merge master. I solved all the conflicts and now git status gives me "Everything uptodate".
However when I made a closer look into some files I noticed that on my branch they preserve older version of code. I assume that is because of the rebased commits which are now kinda "newer" than the actual newer code.
How to deal with this kind of mess? Should one checkout the commit before the rebase and then manually add all the developments again?
Upvotes: 0
Views: 128
Reputation: 12356
Rebase again, removing all the local changes that are ahead of the ones in master that should not be there. Instead of resolving conflicts in your local branch when you are done, when you push, do a git push -f to force the rebased changes to override the changes that is in your local branch. When you rebase, you want to override what is in your local branch, not resolve conflicts. When you resolve conflicts, it will try to maintain the old and new version of the code that you don't want. You want to be re-writing your own branch history. Take care though - this is a dangerous operation and you should never rebase and force your changes on a shared branch or main branch such as master or you'll mess up everyone elses history! However, rebasing and overriding your own changes is necessary to clear the conflicting code and be on a clean code base. Good luck.
Upvotes: 1