I created a new branch from development branch and started writing code and pushing it to github. But after awhile the development branch was updated. So I needed to update the changes and rebase my code. So I checked out development and did a git pull and then I checked out to the new branch again and did a git rebase development.
After that I pushed the commits to remote and now it shows that there are codes from someone else's commit in my commit. I looked over some documents but was confused about what I should do exactly.
How can I go back to previous state before rebasing or can I solve this from the point I am on now?
Asked
Active
Viewed 89 times
0
Shamim Fahad
- 102
- 1
- 9
-
I don’t see why there’s a problem. “the development branch was updated. So I needed to update the changes”. You did. That’s where the “codes from someone else's commit” came from. You wanted to acquire what had happened on development and you did. – matt Aug 24 '20 at 05:00
-
but they want me to remove their code from my commit – Shamim Fahad Aug 24 '20 at 05:00
-
I mean their code should be in their commit, right? why is it in my commit in the first place? – Shamim Fahad Aug 24 '20 at 05:01
-
@matt I suspect that the OP is confused actually about how rebasing works. The intercalation of someone else's commit before the OP's work is where the confusion might be. – Tim Biegeleisen Aug 24 '20 at 05:02
-
1Code does not live in one commit. Every commit consists of all the files. You rebased, thus causing the other persons changes to become your own history and thus appear in your code. That is what rebasing is. If you’re sorry you rebased, undo it. See https://stackoverflow.com/questions/134882/undoing-a-git-rebase – matt Aug 24 '20 at 05:06
-
Does this answer your question? [Undoing a git rebase](https://stackoverflow.com/questions/134882/undoing-a-git-rebase) – LeGEC Aug 25 '20 at 06:49
-
No, I reordered commits and deleted their commit from my code – Shamim Fahad Aug 25 '20 at 07:16