~ read.

Cool git trick for setting author

Don't know about you, but in the past i had couple times burned myself when wrong git configuration of the project was making me to commit things under wrong author. I'm using my work laptop for personal projects as well, so sometimes i mix "identities" and get in troubles. How excited i was when i discovered this small git trick! . Just add this to your ~/.gitconfig file :

[includeIf "gitdir:/Users/andrew/Work/"]
    [user]
        name = Andrew Zakordonets
        email = [my_work_email]
[includeIf "gitdir:/Users/andrew/Github/"]
    [user]
        name = Andrew Zakordonets
        email = [my_personal_email]

And that's it! Now, when you commit things under Work folder - author is set as work user. For personal projects - you get personal author!

It's gonna save from multiple git commit --amend --author= commands in the future.

comments powered by Disqus
comments powered by Disqus