Skip to content

Instantly share code, notes, and snippets.

@adamlogic
Created October 27, 2008 12:46
Show Gist options
  • Save adamlogic/20092 to your computer and use it in GitHub Desktop.
Save adamlogic/20092 to your computer and use it in GitHub Desktop.
# Original Author: Bryan Helmkamp (http://www.brynary.com/2008/9/1/setting-the-git-commit-author-to-pair-programmers-names)
namespace :git do
desc "Configures the git author to a list of developers when pair programming; USAGE: sake git:pair AUTHORS=Adam,Jon OR leave off AUTHORS to revert"
task :pair do
unless File.exists?(".git")
puts "This doesn't look like a git repository."
exit 1
end
authors = ENV["AUTHORS"]
pair_email = "pair@theedgecase.com"
if authors.blank?
`git config --unset user.name`
`git config --unset user.email`
puts "Unset user.name and user.email"
else
`git config user.name '#{authors}'`
`git config user.email '#{pair_email}'`
puts "user.name = #{authors}"
puts "user.email = #{pair_email}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment