You are currently browsing the tag archive for the ‘Git’ tag.
We use this script to automatically merge all features into staging and re-merge those features with deploy-ed code. It will stop when there is a merge conflict -> resolve and start it again.
Automatic –>
often -> smaller conflicts.
no thinking/typing -> less mistakes/headaches.
Usage
e.g. store it in scripts folder or turn it into a rake task
Code
git ls-files --others --exclude-standard | xargs rm
To use it as git rmuntracked, add to ~/.gitconfig
[alias] rmuntracked = "!git ls-files --others --exclude-standard | xargs rm"
(as you can see in my dotfiles)
Also available as Gist
Ever wondered how much who adds/removes, its time to find out ![]()
(those are real stats, I just obfuscated the names
)
Results
Git scores (in LOC): mr-add : +482273 -9466 justu : +286250 -159905 grosser : +152384 -323344 another : +121257 -82116 naames : +104577 -13591 justfor : +68716 -72446 example : +7795 -4987 andeven : +5100 -1730 morenow : +4225 -2764 finish : +17 -19
Update: After working 2.5 years on this project my final stats where: +861345 -1115685 = -254340 LOC
Install
Copy init git_stats.rb and ruby git_stats.rb
(you can add the names of people who commit with different users into the ‘same’ array)
# please add enhancements to http://gist.github.com/234560
#!/usr/bin/env ruby
t = Time.now
same = [['name-a','name-b'],['mr fred','fred']]
pipe = open("|git log --shortstat")
author = "unknown"
stats = {}
loop do
line = pipe.readline rescue break
author = $1 if line =~ /Author\: ([a-z]+) </
found = same.detect{|a| a.include?(author)}
author = found.first if found
if line =~ /files changed, (\d+) insertions\(\+\), (\d+) deletions/
stats[author] ||= Hash.new(0)
stats[author]['+']+=$1.to_i
stats[author]['-']+=$2.to_i
print '.'
end
end
puts "\nGit scores (in LOC):"
puts stats.sort_by{|a,d| -d['+'] }.map{|author, data| "#{author.ljust(20)}: +#{data['+'].to_s.ljust(10)} -#{data['-'].to_s.ljust(10)} " } * "\n"
