I have a commit, I have stored in a branch, because this should go only to a specific box.
I have merged it to the branch master, but not the branch dev, that I use locally.
Now, by mistake I merged master to dev and that introduced this commit to dev.
I know can git revert sha, to branch dev; but since this is going to introduce a commit that undoes that commit (I am guessing, I haven't exactly tried this), when I merge master, will this commit be undone too?
If so, how do I undo this commit only from the branch dev.
And oh, git reset HEAD^1
--hard is not an option because there are other commits on master, after the un-needed commit.
If reset back again and apply is the only option, then how do I only merge those extra commits from master other than the un-needed commit.
Update:
Here is the commit tree. Looks complex. I have pointed to the commit, that I don't need in the dev. (I have also removed any personally identifiable information, thanks for understanding. It is so much simpler to screenshot gitk than to ascii art.)
Thanks in advance!
On a scratch copy of your branch, git rebase --interactive
and drop the unwanted commit. Alternatively, you could create a new branch upstream of the unwanted commit and git cherry-pick
the desired commits onto it.
There are probably more ways to achieve this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With