Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To find all options use:

gits --help

The first time you use gits it will prompt for git usernames and emails for the pair of developers. This is stored in ~/.gits and this file can safely removed to reset pairing.
The first time you use gits it will prompt for git usernames (spaces are allowed) and emails for the pair of developers. This is stored in ~/.gits and this file can safely removed to reset pairing.

Although you only need to use gits when committing to repositories, you can use it instead of git for all operations if you prefer.

Expand All @@ -23,6 +23,6 @@ If you want to take the random element out of a commit you can force the author

## Installation
### Manual Installation
$ sudo wget https://raw.github.com/roylines/gits/master/gits.sh -O /usr/local/bin/gits
$ sudo chmod ugo+x /usr/local/bin/gits
$ gits
$ wget https://raw.github.com/roylines/gits/master/gits.sh -O /usr/local/bin/gits
$ chmod ugo+x /usr/local/bin/gits
$ gits
16 changes: 13 additions & 3 deletions gits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ then
echo "Please enter the second pair email > "
read email2

echo "$username1 $email1" > $config
echo "$username2 $email2" >> $config
echo "$username1" > $config
echo "$email1" >> $config
echo "$username2" >> $config
echo "$email2" >> $config

echo "created config for: $username1 ($email1), $username2 ($email2)"
exit 0
Expand All @@ -28,14 +30,19 @@ if [ $1 = "1" ];
then
echo 'forcing author to first user'
shift
n=1
fi

if [ $1 = "2" ];
then
echo 'forcing author to second user'
shift
n=2
fi

old_IFS=$IFS
IFS=$'\n'

filecontent=( `cat "$config" `)
if [ $n -eq 1 ]
then
Expand All @@ -50,6 +57,9 @@ else
export GIT_AUTHOR_EMAIL=${filecontent[1]}
fi

IFS=$old_IFS

git "$@"

echo "commit: $GIT_COMMITTER_NAME, author: $GIT_AUTHOR_NAME"
echo "commit name: $GIT_COMMITTER_NAME, email: $GIT_COMMITTER_EMAIL"
echo "author name: $GIT_AUTHOR_NAME, email: $GIT_AUTHOR_EMAIL"