Reputation: 4974
Have a situation:
And now I see in Github stats, that developer added 1kk lines, and remove 1kk lines.
How can I clean git history? How change those commits and remove those files from history?
Thank you
Upvotes: 1
Views: 132
Reputation: 13262
You can use the github recommended steps using either:
filter-branch
and on step 3
instead of Rackfile
add your directory or files that were added by accident. Also follow the step 8
, that is very important, since you are modifying the history.BFG
will also alter the history.Upvotes: 2
Reputation: 7975
You can use git rebase -i <last good commit>
then in the editor choose to squash the commits the add and remove the files into one
This does have the disadvantage of meaning that you only have one commit where you might want the two change sets separate.
Also you will have rewritten history and need to be careful that your developers reset to your new history.
Upvotes: 1
Reputation: 60056
Use git-filter-branch with --tree-filter
or --index-filter
.
More info in the link.
Upvotes: 0