-1

I would like to delete Git logs after merging. I have tried git rebase -i and git reset --hard but bbb branch commit logs doesn't change. I have deleted bbb branch but 3 logs have not been deleted from the Sourcetree. The bbb branch has 3 logs now, so I would like to delete 2 commits from the log or delete bbb branch.

enter image description here

After deleting the bbb branch, Git condition is like this picture. I still can see commit logs for the bbb branch.

enter image description here

I have tried git rebase -i xxx, and replaced to squash. But I still can see commit logs like this.

enter image description here

guitar-man
  • 13
  • 4
  • 4
    Possible duplicate of [Squash my last X commits together using Git](https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git) – Bishakh Ghosh Apr 01 '18 at 07:09
  • you want to `squash` the commits of the branch getting merged into your base branch. you should have a single commit where you can add a new message. – Derek Apr 01 '18 at 07:31
  • Your solution is to delete the commits (by squashing) **before the merge**. For that, see the link above. – Nils Werner Apr 01 '18 at 07:37

1 Answers1

0

I don't understand what you are trying to do with the commits but to delete the bbb branch run git push -d <remote_name> <branch_name> to delete the remote branch and git branch -d <branch_name> to delete the local branch

Mwangi Njuguna
  • 75
  • 2
  • 10
  • Thank you for editing and answering my question. I have tried to delete the `bbb` branch. But also I would like to delete git commit logs. I still can see commit logs for the `bbb` branch. – guitar-man Apr 01 '18 at 07:20
  • I would suggest you revert back to the point that you wanted to delete the `bbb` branch using `git rebase -i HEAD~N` The ~N means rebase the last N commits (N must be a number, for example HEAD~3). Then, you can delete the `bbb` branch. – Mwangi Njuguna Apr 01 '18 at 08:17