If I’m not mistaken, you had two synchronized branches,
master and dev, and simply forgot to switch the branch,
before your commits.
If that is the case, we have:
----------------
git log in dev
xxx
yyy
...
----------------
and:
----------------
git log in master
ccc
bbb
aaa
<---- here you forgot to switch branch
xxx
yyy
...
----------------
The solution is:
First, make sure, that:
git status -s
returns empty results.
Next, get all your new commits from master to dev with:
git checkout dev
git merge master
Now return to you master:
git checkout master
Remove unnecessary commits:
git reset --hard HEAD~3
The number ~3 is the number of commits you want to remove.
Remember: git status -s have to return empty results.
Otherwise, git reset --hard can cause data loss.