Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How can I delete git notes from my commit history?

Hello,

When I looked at my commit graph, I saw some commits that are done by semantic-release-bot.

Screenshot 2023-03-14 at 12.36.27.png

I want to delete all these "git notes add" commits, but I couldn't find any way to access and remove them

  • I checked my local git log, but these commits are not shown there
  • I checked my local refs, but there is no ref named refs/notes

How can I do it?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 15, 2023

Hi @Furkan Kose 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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events