Created
May 2, 2023 00:24
-
-
Save cryptorick/527cf36cb0f1027afaf9e1df3ab579a8 to your computer and use it in GitHub Desktop.
Impersonate people in git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Add this, if you want, to the bottom of your $HOME/.gitconfig. | |
;; Impersonate people: add personages (like the 3 below here); then say | |
;; $ git impersonate bob | |
;; Now, git thinks you are Bob (locally of course). This is good for helping | |
;; your team do git surgery on a branch (and retain the credit for the original | |
;; person's work). Don't forget to set yourself back (unmask) when you are done. | |
;; $ git impersonate me | |
;; | |
[user-me] | |
name = Joe Blow | |
email = [email protected] | |
[user-rick] | |
name = Rick Sharky | |
email = [email protected] | |
[user-bob] | |
name = Robert Young | |
email = [email protected] | |
; Template for adding a user: copy the following 3 lines above, uncomment and fill in. | |
; [user-] | |
; name = | |
; email = | |
[alias] | |
whoami = "!f() { git config user.name && git config user.email; }; f" | |
impersonate = "!f() { git config user.name \"$(git config user-$1.name)\" && git config user.email \"$(git config user-$1.email)\" && git whoami; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment