Git tips and tricks

Feb 13, 2014

How do I change the author of my commits?

Sometimes it happens that you commit from different computers with different git author and email configurations. If you prefer consistency, follow the following steps:

Reset the git commits author

git filter-branch --commit-filter \
'export GIT_AUTHOR_NAME="Author Name"; \
export GIT_AUTHOR_EMAIL=authoremail; \
export GIT_COMMITTER_NAME="Committer Name"; \
export GIT_COMMITTER_EMAIL=committeremail; \
git commit-tree "[email protected]"'

Push the changes to remote

git push -u -f origin --all

Keep your clone in-sync

git fetch origin master
git reset --hard origin/master

E voilà!

Source: could I change my name and surname in all previous commits?


How many lines of code do I have?

Reading “How many lines of code is Facebook?“ question, I found this git gem:

git ls-files | xargs cat | wc -l