Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. 從所有 commit 中刪除特定檔案
  2.  
  3. remove a file from a git repository with:
  4. ```
  5. git filter-branch --tree-filter 'rm file'
  6. ```
  7.  
  8. remove a folder from a git repository with:
  9. ```
  10. git filter-branch --tree-filter 'rm -rf directory'
  11. ```
  12. This removes the directory or file from all the commits
  13.  
  14. you can specify a commit by using:
  15. ```
  16. git filter-branch --tree-filter 'rm -rf directory' HEAD
  17. ```
  18. Or an range
  19. ```
  20. git filter-branch --tree-filter 'rm -rf vendor/gems' t49dse..HEAD
  21. ```
  22. To push everything to remote, you can do:
  23.  
  24. ```
  25. git push origin master --force
  26. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement