sirzento
sirzento

Reputation: 707

Delete first commits in github

At the beginning I committed a few test commits with 600k+ rows of Code. After that I deleted all files and just used git like normal.

Now I see in the contributors statistic that I added and deleted over 650k+ rows of Code.

Is there a way to delete the first test commits? (I just want to get the statistic right)

Edit: that's my commit history:

Upvotes: 1

Views: 128

Answers (1)

eftshift0
eftshift0

Reputation: 30214

Suppose the branch is called master and it has 10 linear revisions.

git checkout master~7 # checkout the 3rd revision from history
git reset --soft master~9 # set branch pointer at first revision, all diffs between master~7 and master~9 are on index
git commit --amend --no-edit # now first revision has the content (working tree) of master~7, so first two revisions from master are gone
git cherry-pick master~7..master # replay history
# if you like the result
git branch -f master # set master on new branch
git checkout master

Upvotes: 1

Related Questions