I have messed up my git repository a bit. I have worked on several branches at one and made merges which in retroperspective were a really bad decision.
I was working on branches JIRADAPTER-108, JIRADAPTER-109 and JIRADAPTER-104 (see attached picture of the history). JIRADAPTER-108 and JIRADAPTER-109 were bugfixes which i branched from master and merged back to master with only one commit respectively. To use those changes I decided to merge the master into branch JIRADAPTER-104, which turned out to be a bad idea!
At first glance i was not able to merge back everything from branch JIRADPATER-104 into master, as foxtrot merges are not allowed. This was, as I tried to merge from origin/JIRADPATER-104 (last green commit).
I was able to merge the right changes into master by merging from the last commit before merging the master into JIRADAPTER-104 (last pink commit).
Although only cosmetic, i now, try to get rid of those to commits to branch JIRADAPTER-104, where i merged the master into it (all green commits).
I was trying to reset to the last pink commit: without success.
Can anybody help me to get rid of those two green commits, so that origin/JIRADAPTER-104 and JIRADAPTER-104 tags are on the last pink commit?
EDIT
Using worktree, be sure to have set the option Enable Force Push
under Tool > Options > Git
.
Then the workflow is quite similar as Mlad274 suggested (many thanks for that):
Reset current branch to this commit
Force Push
at bottom of the menu`)Since you know the commit you want, just force the branch to point to it.
git checkout JIRADAPTER-104
git reset --hard <COMMIT-ID>
git push -f