├── LICENSE ├── Makefile ├── README.md └── git-blame-someone-else /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Jay Phelps 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | 3 | # files that need mode 755 4 | EXEC_FILES =git-blame-someone-else 5 | 6 | all: 7 | @echo "usage: make install" 8 | @echo " make uninstall" 9 | 10 | install: 11 | install -m 0755 $(EXEC_FILES) $(prefix)/bin 12 | 13 | uninstall: 14 | test -d $(prefix)/bin && \ 15 | cd $(prefix)/bin && \ 16 | rm -f $(EXEC_FILES) 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-blame-someone-else 2 | 3 | > "I love git-blame-someone-else!!" -[Linus Torvalds says](https://github.com/jayphelps/git-blame-someone-else/commit/e5cfe4bb2190a2ae406d5f0b8f49c32ac0f01cd7)* 4 | 5 | ## Install 6 | 7 | ```bash 8 | $ git clone https://github.com/jayphelps/git-blame-someone-else.git 9 | $ cd git-blame-someone-else 10 | $ sudo make install 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```bash 16 | $ git blame-someone-else 17 | ``` 18 | 19 | ![ezgif-1396449034](https://cloud.githubusercontent.com/assets/762949/12863650/068e2820-cc2e-11e5-80c5-6ebdb71f51ea.gif) 20 | 21 | ## Disclaimer: 22 | 23 | This changes not only who authored the commit but the listed commiter as well. It also is something I wrote as a joke, so please don't run this against your production repo and complain if this script deletes everything. 24 | 25 | *Linus Torvalds didn't really approve of this. It's a joke to prove it works. [See his fake commit here](https://github.com/jayphelps/git-blame-someone-else/commit/e5cfe4bb2190a2ae406d5f0b8f49c32ac0f01cd7) 26 | 27 | :shipit: 28 | -------------------------------------------------------------------------------- /git-blame-someone-else: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ $# -ne 2 ]; then 4 | >&2 echo "Usage: $0 " 5 | exit 1 6 | fi 7 | 8 | AUTHOR=$1 9 | AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*?)\s*<.*>$/ and print $1') 10 | AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1') 11 | COMMIT=$(git rev-parse --short $2) 12 | 13 | { 14 | GIT_SEQUENCE_EDITOR="sed -i -e 's/^pick $COMMIT/edit $COMMIT/'" git rebase -i $COMMIT~1^^ 15 | GIT_COMMITTER_NAME="$AUTHOR_NAME" GIT_COMMITTER_EMAIL="$AUTHOR_EMAIL" git commit --amend --no-edit --author="$AUTHOR" 16 | git rebase --continue 17 | } &> /dev/null 18 | 19 | echo "$AUTHOR_NAME is now the author of $COMMIT. You're officially an asshole."; 20 | --------------------------------------------------------------------------------