Coder Social home page Coder Social logo

git_scripts's Introduction

Build Status

Git Scripts

These scripts are helpers for managing developer workflow when using git repos hosted on GitHub. Install as a rubygem and they can be run as standard git commands like git about.

Gem Installation

gem install pivotal_git_scripts

System Wide Installation

cd /usr/local/bin && curl -L http://github.com/pivotal/git_scripts/tarball/master | gunzip | tar xvf - --strip=2

git-about

git about shows settings set by git pair and git project

git-pair

Configures git authors when pair programming.

git pair sp js
user.name=Josh Susser & Sam Pierson
[email protected]

Create a .pairs config file in project root or your home folder.

# .pairs - configuration for 'git pair'
pairs:
  # <initials>: <Firstname> <Lastname>[; <email-id>]
  eh: Edward Hieatt
  js: Josh Susser; jsusser
  sf: Serguei Filimonov; serguei
email:
  prefix: pair
  domain: pivotallabs.com
  no_solo_prefix: true
global: false  # Set to true for git-pair to change git configuration for all your projects

By default this affects the current project (.git/config). Use the --global option or add global: true to your .pairs file to set the global git configuration for all projects (~/.gitconfig).

Options are:

-g, --global                     Modify global git options instead of local
-v, --version                    Show Version
-h, --help                       Show this.

When you're done pairing, change git's configuration to use your personal details.

git pair <your-initials>

git-pair-commit

Makes a git commit as normal, but chooses one of the pair members randomly to get credit for the commit on github (by setting the author email to that member's email address). The author name on the commit will list all members of the pair, as usual.

If pair members have email addresses on different domains, you can specify them separately in your .pairs file.

pairs:
  jd: Jane Doe
  fb: Frances Bar
email_addresses:
  jd: [email protected]
  fb: [email protected]

Using git-pair-commit in RubyMine

RubyMine already supports pointing at a custom location for your git executable in the Preferences -> Version Control -> Git screen shot 2014-03-11 at 12 49 02 pm The trick then is that pair-commit doesn't encompass all git functionality, so you can't just point RubyMine directly at it, you need something in the middle that will use pair-commit if the first arg is commit, otherwise just pass through. Here's a ruby script to do just that:

#!/usr/bin/env ruby

exit_code = if ARGV[1] == "commit"
  system "git pair-commit #{ARGV[1..-1].join(" ")}"
else
  system "git #{ARGV.join(" ")}"
end

exit exit_code

Make sure it's executable.

git-project

$ git project pivots

This script sets the user account you will use to access repos hosted on github.com. It creates a symlink from id_github_current to id_github_pivotal<project>, which switches the SSH key you are currently using to access GitHub repos. Make sure you have the following lines in your .ssh/config file:

Host github.com
  User git
  IdentityFile /Users/pivotal/.ssh/id_github_current

Authors

Copyright (c) 2010 Pivotal Labs. This software is licensed under the MIT License.

git_scripts's People

Contributors

bigtiger avatar clemf avatar davidmfoley avatar dideler avatar flavorjones avatar jsanders avatar lvarvel avatar mark-rushakoff avatar mikegehard avatar peeja avatar pivotalcommon avatar pivotalops avatar ragaskar avatar rbobbins avatar thewoolleyman avatar tildewill avatar tjarratt avatar toddboom avatar zrob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git_scripts's Issues

Git Pair should use Git's co-authored-by

I am just now discovering this utility after coming across a team using it. One downside I'm noticing is that contributions are not associated with a GitHub profile due to the email address being a mix of both the pairs.

GitHub has this functionality built-in using Co-authored-by in your commit message. Would it be possible for git pair to automatically append the co-authored-by line to a commit rather than re-writing the user/email to contain both pairs?

https://help.github.com/articles/creating-a-commit-with-multiple-authors/

How do you unpair?

Once I've finished pairing, how do I (easily) go back to using my own author info? It's not documented in the README.

git-pair-commit fails when username includes single quote

when using my name
pairs:
do: Diana O'Haver
...

$ git pair do
# results in correct behavior... 

$ git commit -m "test" 
# works

$ git-pair-commit -m "test"
# results in error below:

Committing under <<email deleted>>
sh: OHaver: command not found

git-pair-commit not working with JRuby

This is when installed via the 'system wide installation' and JRuby is installed via rbenv

The error occurs when the system call is run to do the git commit with the environment variables set. It has to do with the vim instance not having input/output be the terminal.

I modified the installed git_pair.rb to print out the command that it attempts to system and all looks good there and when I run that command myself there is no problem.

here is some output from running git pair-commit with some additional info printed such as what command is being invoked by the system command, what version of ruby the current environment is using and what the RUBY_VERSION constant is set to in the running script.

Committing under [email protected]
running 'GIT_AUTHOR_NAME='Jonathan Barnes' GIT_AUTHOR_EMAIL='[email protected]' GIT_COMMITTER_NAME='Jonathan Barnes' GIT_COMMITTER_EMAIL='[email protected]' git commit '-v''
which: /Users/vdp/.rbenv/versions/jruby-1.7.4/bin/ruby
version: 1.9.3
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

the net effect of vim not having the input/output set correctly is that some vim like window is presented with the commit message, but the user is unable to get out of visual mode, and thus save and exit the session. You have to ctrl+c to quit vim and the shell itself is also busted and needs to be killed.

git-pair should work in any directory when used globally

I always put global: true in my .pairs file, and I usually either keep it in my home directory, or symlink one from a project I most often work on to the home directory.

But even when I have ~/.pairs with global mode on, I get this...

$ git pair gh
fatal: Not a git repository (or any of the parent directories): .git

We should just set the global git user.

/usr/local/bin/ error in require

git-pair script does not run error in require 'pivotal_git_scripts/git_pair'

I was able to get this to work by adding /usr/local/bin/ to the $LOAD_PATH

git-pair-commit doesn't work on Windows

On Windows the system call doesn't work, probably because of the environment variables being set before git commit (GIT_AUTHOR_NAME=name git commit). Is there any plans on making this compatible with Windows? Thanks!

git-pair duplicating names

.pairs file is adding pair names twice as single developer.

For instance, commit is being shown in github as:
Brandon Myers and Drew Wood and Brandon Myers and Drew Wood commited

Shouldn't it be showing each users github account name? Or is this intended behavior?

Bump gem version?

Hi:

Is it possible to bump the gem version? We would like to pull in the custom email feature, and it's inconvenient to do this from master vs. the gem.

git about keeps saying that my ruby version is incorrect

Trying to use git_scripts on my project. This is a Mac, with RVM, using ruby 1.9.3 and bundler. I got "Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)":

Ok, the gem is installed:

$ gem list pivotal_git_scripts
*** LOCAL GEMS ***
pivotal_git_scripts (1.1.4)

Bundle looks fine:

$ bundle check
The Gemfile's dependencies are satisfied

Ruby is correct:

$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]

But git about keeps saying that my ruby is incorrect:

$ git about
/Users/mariozaizar/.rvm/gems/ruby-1.9.3-p194@myapp/gems/bundler-1.2.4/lib/bundler/definition.rb:360:in `validate_ruby!': Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
  from /Users/mariozaizar/.rvm/gems/ruby-1.9.3-p194@myapp/gems/bundler-1.2.4/lib/bundler.rb:112:in `setup'
  from /Users/mariozaizar/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.1.0/lib/rubygems-bundler/noexec.rb:77:in `setup'
  from /Users/mariozaizar/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.1.0/lib/rubygems-bundler/noexec.rb:89
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
  from /Users/mariozaizar/.rvm/gems/ruby-1.9.3-p194@myapp/bin/ruby_noexec_wrapper:9

Even when I use bundle exec:

$ bundle exec git about
Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3

My Gemfile looks like:

source 'https://rubygems.org'
ruby '1.9.3'

gem 'rails', '~> 3.2'

Test suite fails if .pairs file not present

See the latest builds on Travis CI, e.g. build 31

I suggest that in the CLI spec, this particular spec should be run with a CWD of a directory under /spec or /tmp that is purposefully made to have the .pairs file present (or something to that effect).

`git pair-commit` should work at the command line

I want to be able to use the new email switching functionality at the command line.

โ†’ git pair-commit
git: 'pair-commit' is not a git command. See 'git --help'.

It feels like the gem needs to create a shim when installed. May be helpful to look at modcloth's git-duet for reference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.