Me and my co-worker working on same repository, and my co-worker did mistake, he edited my files and just pushed.
The problem is that I'm also currently working at same file, so if I pull the commit, it will remove every my works.
Files are binary so I can't edit from the text editor. This is what exactly explain of current situations:
Commit 1. I made some binary files, for example: a.bin, b.bin, c.bin and pushed to master branch as commit [1]
Commit 2. My co-worker pull commit [1] and pushed what he worked as [2]
Commit 3. My co-worker accidentally edited my binary files: a.bin, b.bin, c.bin but he just pushed as commit [3]
Commit 4+: My co-worker just keep pushed..
So what I want is just rollback the commits, back to the old specific commit. I searched about git rebase and git revert, but it seems quite not working to me.
I heard that using merge also work, but I want to my history keep clean!
All I want is get everything back to the old commit, but it keeps saying that you have somekind of unmerged or unstaged files over there and keep fails with it. I just want to override to old files.
How do I solve this?
Try doing a git reset
to the old commit. Then you can do a git push --force
to update the remote. However this would cause some modifications to your project history and your co-worker might have to clone the repo again rather than pulling. Also if unmerged / unstaged paths appear try doing a git stash
beforehand.