Thứ Năm, 26 tháng 6, 2014

How to truncate git history by Git Extension

After a year working with project Legend, our team created about 1400 commits. However I don’t think anyone need to view the commit history of six or twelve months ago, so I would like to truncate too old commits.
If you love command line, you can use following awesome git commands:
 git checkout --orphan temp $1
 git commit -m "Truncated history"
 git rebase --onto temp $1 master
 git branch -D temp
 git gc
I’m a fan of GIT extension so I try converting those commands to Git Extension actions:
1. Open your git directory with Git extension
 
2. Create a temp branch at the last commit you would like to truncate
3. Reset MIX to the root commit
 
 
4. Amend commit with new message “Truncate 3 commits”
5. Check out master, rebase on temp
6. Enjoy the result, your old commit has been truncated

Không có nhận xét nào:

Đăng nhận xét