Hello,
When I looked at my commit graph, I saw some commits that are done by semantic-release-bot.
I want to delete all these "git notes add" commits, but I couldn't find any way to access and remove them
How can I do it?
Hi @Furkan Elibol and welcome to the community!
Please run the following commands in your clone of the repo:
git fetch --all
git branch --all
Does the output of git branch --all show this branch in your remote branches?
If so, and if the branch does not exist locally, you can checkout the branch locally with the command
git checkout -b branch-name origin/branch-name
where branch-name replace with the name of your branch and origin replace with the name of the branch's remote, if it is different.
Before you proceed with removing any commits, I would strongly recommend taking a backup of the repo as the process includes destructive operations. If your Bitbucket Cloud repo has all the branches and changes you have locally, you can take a backup by cloning with the mirror flag:
git clone --mirror repo_url
If the commits you want to remove are the last ones on that branch, after you checkout out this specific branch you can use
git reset --soft HEAD~1
where 1 replace with the number of commits you want to remove. E.g. git reset --soft HEAD~3 will remove the last 3 commits on the branch that is checked out.
If you have made other commits that you want to keep, and the commits you want to delete are not the last ones on that branch, you can use an interactive rebase to remove these commits. You can see more details in the following post in StackOverflow:
https://stackoverflow.com/a/42522493
In both cases, you will need to force-push your changes to the remote repo (push with the -f flag). Please keep in mind that pushing with the -f option will overwrite the commits on the remote (which is why it's important to have a backup in case anything goes wrong).
If you have any questions, please feel free to reach out.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.