Search code examples
gitbitbucketsourcetree

Git remove duplicate commits from history


So.... I say trying to remove a file from history as it contained a password (I know - should have been in gitignore from the start!). I followed https://help.github.com/articles/remove-sensitive-data/ to point 6 but I had an issue with my SSH key being used by Git Bash (usually use sourcetree as store the repository on BitBucket) that had to be fixed and now I have a duplicate of all commits in my history (except the latest two).

The duplicate commits are independent when looking at the parents. In effect it looks as though there are two branches of master that have never merged.

Here is a look at the top and bottom of my log: Top and bottom of log

If anyone can suggest how I can clean this up I would greatly appreciate it.


Solution

  • After a comment by agrias asking

    Is "Pub-201603141450" a branch?

    (It is a Tag) I realised that all of my Tags were on the old commits. Deleting these tags or moving them to the new version of the commit removed the old commits from my history. Not being that familiar with tags I guess these hold their own history.

    I guess if I hadn't had the SSH key issue and followed on with step 7 in https://help.github.com/articles/remove-sensitive-data/ it would have moved my tags over and avoided this issue.