You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I already have a solution for my question below.
From my local CLI, I performed a push -> the branch was there again. Then, I merged it into the correct branch. I might live a few years less, but it's okay now.
"I have a question about reverting a merged branch that I also closed through the GUI in Bitbucket.
I had three branches:
I merged and closed 'project-name' into 'master.' I didn't do this via a pull request but directly through the branches menu on the left-hand side. I entered the branch itself and clicked the three dots where it says 'merge' in the menu. In the popup window, I clicked the checkbox where it says 'Close source branch.' Then I hit the merge button, and everything merged.
The mistake I made is that I merged it into the wrong branch. I wanted to merge it into the 'craft' branch because 'master' is way behind, and I did not use it anymore. Don't ask me why.
Locally, there aren't any changes yet because I did not perform a pull on the CLI. So everything still works there, but I have messed up my commits.
Is there a way to revert this mistake?"
I'm afraid to cause more damage, so I haven't attempted anything after I noticed my mistake.
On the master branch, do you see 1 single merge commit with all changes from project-name?
If that's the case you can use the git revert command: https://www.atlassian.com/git/tutorials/undoing-changes/git-revert
It is the cleanest way to do this. You could also merge your local branch to master (becasue you did not pull yet) and perform a force push overwriting everything on master but this is not very safe in my opinion.
To be safe: clone the repostory in another directory on your PC in order to avoid any losses in your other directory where you did not pull yet.
git clone <your repo URL>
git checkout master
git log #this will show you the latest commit. You need to find the commit ID of the merge commit
git revert -m 1 <merge_commit_ID>