rename users
git filter-branch --env-filter '
OLD_EMAIL="old@email.com"
NEW_EMAIL="new@email.com"
NEW_NAME="John Doe"
if test "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL"
then
GIT_AUTHOR_EMAIL=$NEW_EMAIL
GIT_AUTHOR_NAME=$NEW_NAME
fi
if test "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL"
then
GIT_COMMITTER_EMAIL=$NEW_EMAIL
GIT_COMMITTER_NAME=$NEW_NAME
fi' -- --all
tips
sort branch by commit date
branch.sort=-committerdate
use different config by remote url
includeif.hasconfig:remote.*.url:https://github.com/**.path=~/.gitconfig.github
includeif.hasconfig:remote.*.url:git@github.com:*/**.path=~/.gitconfig.github
Subtree
git subtree usage
add a subtree
git subtree add --prefix my-subdirectory http://mysite.com/my_other_project.git master --squash
update a subtree
git subtree pull --prefix my-subdirectory http://mysite.com/my_other_project.git master --squash