http://progit.org/book/ch6-4.html
Splitting a Commit
git rebase -i HEAD~3
(change the commit to edit)
(now we are at the commit, commited, which we want to change)
git reset HEAD^
(change, commit, whatever is needed)git add -p
git ci
git add -p
git ci
(...)
git rebase --continue
The Nuclear Option: filter-branch
Removing a File from Every Commit (slower)
git filter-branch --tree-filter 'rm -f passwords.txt' HEAD
Removing a File/Directory from Every Commit (faster)
git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD
Making a Subdirectory the New Root
git filter-branch --subdirectory-filter trunk HEAD
Changing E-Mail Addresses Globally
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "schacon@localhost" ];
then
GIT_AUTHOR_NAME="Scott Chacon";
GIT_AUTHOR_EMAIL="schacon@example.com";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
All commit (HEAD), or last part of commit XXXXX..HEAD is valid.
git-filter-branch(1): Rewrite branches - Linux man page
http://linux.die.net/man/1/git-filter-branch
Extracting a subdirectory from git as a new git repository
http://www.pither.com/articles/2009/02/04/extracting-a-subdirectory-from-git-as-a-new-git-repository
Checkout subdirectories in Git?
http://stackoverflow.com/questions/180052/checkout-subdirectories-in-git
Splitting a subpath out into a new repo
http://help.github.com/splitting-a-subpath-to-a-new-repo/
沒有留言:
張貼留言