IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » git The latest public git snipts.

showing 1-20 of 56 snipts for git
  • Checks whether ssh keys in keydir are broken in a gitosis-admin repository.
    #!/usr/bin/env ruby
    
    # Script by Camillo Bruni, Oscar Nierstrasz, Niko Schwarz, 2010
    
    # This script checks whether any incoming commit 
    # has invalid ssh keys in the keydir directory. That is useful
    # for gitosis-admin repositories, as gitosis crashes hard
    # if faulty keys reside in the keydir.
    
    # Install it in .git/hooks/update, make sure it belongs to the git user
    # and is set to be executable.
    
    require "base64"
     
    def valid_public_ssh_key?(key)
        match = /^(\S+) (\S+=+) (\S+)\n*/.match(key)
        return false if match.nil?
        type = match[1]
        key_string = match[2]
        comment = match[3]
        data = Base64.decode64(key_string)
        int_len = 4
        str_len = data[0..int_len-1].unpack('N')[0]
        return data[int_len..int_len+str_len-1] == type
    end
    
    def valid_key_file?(file)
        line_number = 1
        invalid_lines = []
        `git show #{ARGV[2]}:#{file}`.each_line { |line|
    	
    	if not valid_public_ssh_key?(line) 
                invalid_lines.push(line_number)
            end
    	line_number+=1
        } 
        return "" if invalid_lines.empty?
        return "\033[0;31m Invalid ssh keys on lines #{invalid_lines.inspect} in #{file}\033[0m\n"
    end
    
    files = `git diff #{ARGV[1]} #{ARGV[2]} --name-only --diff-filter=AM -z` 
    errors = files.split("\0").select{|file_name| file_name.match(/^keydir\//)} \
    	.map { |file_name| valid_key_file?(file_name)}.join("")
    puts errors
    exit errors.empty? ? 0 : -1
    

    copy | embed

    0 comments - tagged in  posted by nikoschwarz on Aug 19, 2010 at 10:35 a.m. EDT
  • [Rails] .gitignore
    config/database.yml
    doc/api
    doc/app
    log/*.log
    tmp/**/*
    

    copy | embed

    0 comments - tagged in  posted by khazou on Aug 16, 2010 at 11:31 a.m. EDT
  • Sparse checkout in git
    $ mkdir junk2
    $ cd junk2/
    $ ls
    $ git clone git@scg.unibe.ch:jot-issue-9-5.git
    Initialized empty Git repository in /private/tmp/junk2/jot-issue-9-5/.git/
    remote: Counting objects: 191, done.
    remote: Compressing objects: 100% (186/186), done.
    remote: Total 191 (delta 52), reused 0 (delta 0)
    Receiving objects: 100% (191/191), 26.41 MiB | 6.79 MiB/s, done.
    Resolving deltas: 100% (52/52), done.
    $ cd jot-issue-9-5/
    
    $ ls
    1. Test Case Generation      4. Dynamic Adaptability      
    2. Size Inheritance Change   5. Inferring Design Patterns 
    3. Enhancing NetBeans        GIT-README.txt               
    
    $  git config core.sparsecheckout true
    $ echo "1. Test Case Generation/" > .git/info/sparse-checkout
    $ git read-tree -m -u HEAD
    verratnix:jot-issue-9-5 niko$ ls
    1. Test Case Generation
    $
    

    copy | embed

    0 comments - tagged in  posted by nikoschwarz on Aug 13, 2010 at 11:25 a.m. EDT
  • View the change history of a file
    $ git log -- <filename>
    

    copy | embed

    0 comments - tagged in  posted by buithehoa on Jul 22, 2010 at 12:33 a.m. EDT
  • An alias in git for resetting a staged file.
    git config --global alias.unstage "reset HEAD"
    

    copy | embed

    0 comments - tagged in  posted by mandric on Jul 06, 2010 at 9:12 a.m. EDT
  • Restore deleted files from a git repo
    $ git log --diff-filter=D --summary
    $ git revert $commit
    

    copy | embed

    0 comments - tagged in  posted by buithehoa on Jul 01, 2010 at 5:55 a.m. EDT
  • Git fork of ola
    # first cd into the directory you want to put the repository in
    # then clone the repository from nrlabs
    git clone git@stagenerds.com:stagenerds-ola.git
    
    # a bunch of git output then cd into the new folder
    cd stagenerds-ola/
    
    # now you need to edit the vim config file at stagenerds-ola/.git/config
    # you can use vim or do it through a gui text editor
    vim .git/congig
    
    #replace the entire contents of the config file with this
    [core]
    	repositoryformatversion = 0
    	filemode = true
    	bare = false
    	logallrefupdates = true
    	ignorecase = true
    [remote "origin"]
    	fetch = +refs/heads/*:refs/remotes/origin/*
    	url = git@stagenerds.com:stagenerds-ola.git
    [branch "master"]
    	remote = origin
    	merge = refs/heads/master
    [branch "ola_master"]
    	remote = ola_origin
    	merge = refs/heads/master
    [remote "ola_origin"]
    	url = http://www.nomis52.net/git/lla
    	push = refs/heads/ola_master:master
    	fetch = +refs/heads/*:refs/remotes/ola_origin/*
    
    # save then exit
    # next you need to create and switch to the ola_origin branch
    git checkout -b ola_origin
    
    # then you need to create and switch to the ola_master branch
    git checkout -b ola_master
    
    # finally switch back to the master branch and start working
    git checkout master
    
    # if at any time you want to double check what branch you are on
    git status
    
    # when it comes time to check what the ola_master branch has done recently
    # first switch to the ola_master branch then fetch the latest changes
    git checkout ola_master
    git fetch
    
    # this will get the lates updates but not merge them
    # open up gitg, gitGUI, or gitx depending on your operating system
    # then you can see the local changes, if you review and like the changes
    # you can merge all of the remote OLA changes with 
    git pull
    
    # change back to the master branch and keep working
    git checkout master
    

    copy | embed

    0 comments - tagged in  posted by LupineDev on May 28, 2010 at 5:12 p.m. EDT
  • git revert back in server
    git revert HEAD~1 --hard
    git push origin +master
    git push -f origin HEAD^:master
    

    copy | embed

    0 comments - tagged in  posted by boriscy on May 13, 2010 at 3:28 p.m. EDT
  • Ruby 1.9.2 Rails 3 error
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/object/try.rb:29: [BUG] rb_add_method: unsupported method type (8)
    
    ruby 1.9.2dev (2009-07-18 trunk 24186) [x86_64-linux]
    
    -- control frame ----------
    c:0050 p:---- s:0136 b:0136 l:000135 d:000135 CFUNC  :alias_method
    c:0049 p:0044 s:0131 b:0131 l:000130 d:000130 CLASS  /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0048 p:0009 s:0129 b:0129 l:000128 d:000128 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0047 p:---- s:0127 b:0127 l:000126 d:000126 FINISH
    c:0046 p:---- s:0125 b:0125 l:000124 d:000124 CFUNC  :require
    c:0045 p:0023 s:0121 b:0121 l:000120 d:000120 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0044 p:---- s:0119 b:0119 l:000118 d:000118 FINISH
    c:0043 p:---- s:0117 b:0117 l:000116 d:000116 CFUNC  :require
    c:0042 p:0011 s:0113 b:0113 l:000112 d:000112 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0041 p:---- s:0111 b:0111 l:000110 d:000110 FINISH
    c:0040 p:---- s:0109 b:0109 l:000108 d:000108 CFUNC  :require
    c:0039 p:0011 s:0105 b:0105 l:000104 d:000104 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0038 p:---- s:0103 b:0103 l:000102 d:000102 FINISH
    c:0037 p:---- s:0101 b:0101 l:000100 d:000100 CFUNC  :require
    c:0036 p:0035 s:0097 b:0097 l:000096 d:000096 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0035 p:---- s:0095 b:0095 l:000094 d:000094 FINISH
    c:0034 p:---- s:0093 b:0093 l:000092 d:000092 CFUNC  :require
    c:0033 p:0023 s:0089 b:0089 l:000088 d:000088 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/li
    c:0032 p:---- s:0087 b:0087 l:000086 d:000086 FINISH
    c:0031 p:---- s:0085 b:0085 l:000084 d:000084 CFUNC  :require
    c:0030 p:0076 s:0081 b:0081 l:000080 d:000080 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/a
    c:0029 p:---- s:0078 b:0078 l:000077 d:000077 FINISH
    c:0028 p:---- s:0076 b:0076 l:000075 d:000075 CFUNC  :require
    c:0027 p:0011 s:0072 b:0072 l:000071 d:000071 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/a
    c:0026 p:---- s:0070 b:0070 l:000069 d:000069 FINISH
    c:0025 p:---- s:0068 b:0068 l:000067 d:000067 CFUNC  :require
    c:0024 p:0023 s:0064 b:0064 l:000063 d:000063 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/a
    c:0023 p:---- s:0062 b:0062 l:000061 d:000061 FINISH
    c:0022 p:---- s:0060 b:0060 l:000059 d:000059 CFUNC  :require
    c:0021 p:0047 s:0056 b:0056 l:000055 d:000055 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activerecord/lib
    c:0020 p:---- s:0054 b:0054 l:000053 d:000053 FINISH
    c:0019 p:---- s:0052 b:0052 l:000051 d:000051 CFUNC  :require
    c:0018 p:0021 s:0048 b:0048 l:000039 d:000047 BLOCK  /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rai
    c:0017 p:---- s:0045 b:0045 l:000044 d:000044 FINISH
    c:0016 p:---- s:0043 b:0043 l:000042 d:000042 CFUNC  :each
    c:0015 p:0032 s:0040 b:0040 l:000039 d:000039 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rai
    c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
    c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :require
    c:0012 p:0038 s:0032 b:0032 l:000031 d:000031 TOP    /home/loyolny/Aptana Studio 3 Workspace/Communita/config/application.rb:3
    c:0011 p:---- s:0030 b:0030 l:000029 d:000029 FINISH
    c:0010 p:---- s:0028 b:0028 l:000027 d:000027 CFUNC  :require
    c:0009 p:0016 s:0024 b:0024 l:000015 d:000023 BLOCK  /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rai
    c:0008 p:---- s:0021 b:0021 l:000020 d:000020 FINISH
    c:0007 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC  :tap
    c:0006 p:0442 s:0016 b:0016 l:000015 d:000015 TOP    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rai
    c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
    c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :require
    c:0003 p:0097 s:0006 b:0006 l:0021c8 d:002678 EVAL   script/rails:9
    c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
    c:0001 p:0000 s:0002 b:0002 l:0021c8 d:0021c8 TOP   
    ---------------------------
    -- Ruby level backtrace information-----------------------------------------
    script/rails:9:in `<main>'
    script/rails:9:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/commands.rb:27:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/commands.rb:27:in `tap'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/commands.rb:28:in `block in <top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/commands.rb:28:in `require'
    /home/loyolny/Aptana Studio 3 Workspace/Communita/config/application.rb:3:in `<top (required)>'
    /home/loyolny/Aptana Studio 3 Workspace/Communita/config/application.rb:3:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/all.rb:5:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/all.rb:5:in `each'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/all.rb:11:in `block in <top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/all.rb:11:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activerecord/lib/active_record/railtie.rb:9:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activerecord/lib/active_record/railtie.rb:9:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/railtie.rb:2:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller/railtie.rb:2:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller.rb:1:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_controller.rb:1:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller.rb:4:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/abstract_controller.rb:4:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/ruby/shim.rb:12:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/ruby/shim.rb:12:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/date/calculations.rb:3:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/date/calculations.rb:3:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/zones.rb:1:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/zones.rb:1:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time_with_zone.rb:1:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time_with_zone.rb:1:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/values/time_zone.rb:2:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/values/time_zone.rb:2:in `require'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/object/try.rb:1:in `<top (required)>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/object/try.rb:29:in `<class:Object>'
    /home/loyolny/.rvm/gems/ruby-1.9.2-preview1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/object/try.rb:29:in `alias_method'
    
    -- C level backtrace information -------------------------------------------
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_vm_bugreport+0x9f) [0x515a2f]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5514b8]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_bug+0xb1) [0x551671]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_alias+0x102) [0x511722]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x51194a]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_yield+0x228) [0x513ae8]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_ary_each+0x45) [0x523ee5]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_yield+0x228) [0x513ae8]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_obj_tap+0x9) [0x44e3f9]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval+0x1b0) [0x50c550]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5535e4]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_require_safe+0x63f) [0x554dbf]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x5005c2]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x512001]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x507fdb]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x50c02b]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(rb_iseq_eval_main+0x269) [0x50c369]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(ruby_exec_node+0xb2) [0x419a62]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(ruby_run_node+0x37) [0x41b537]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby(main+0x49) [0x418c19]
    /lib/libc.so.6(__libc_start_main+0xfd) [0x7f4e1ffd4abd]
    /home/loyolny/.rvm/rubies/ruby-1.9.2-preview1/bin/ruby [0x418b09]
    

    copy | embed

    0 comments - tagged in  posted by Loyolny on May 11, 2010 at 12:19 p.m. EDT
  • peek into git objects
    require 'zlib'
    require 'fileutils'
    File.open("objects/df/86d5dfd2060fcc60b22d7f4aa6e383b6ba214b") { |f|
        puts Zlib::Inflate.inflate(f.read)
    }
    

    copy | embed

    0 comments - tagged in  posted by nikoschwarz on Mar 25, 2010 at 4:10 p.m. EDT
  • git: resolve unmerged by checking out one or the other version
    git ls-files -u --abbrev=1 '*.jpg' | ack "\d+\s+[^\s]+\s+3\s+([^\s]+)" --output="\$1" | xargs git checkout --theirs --
    

    copy | embed

    0 comments - tagged in  posted by dennari on Mar 03, 2010 at 11:02 a.m. EST
  • backup all git repositories that are in one folder
    #!/bin/bash
    
    BACKUP_FOLDER="/home/srvadm/p2backups"
    NUM_GROUPS="30"
    
    cd "$BACKUP_FOLDER"
    
    echo "backup at: `date`"
    
    for i in `ls`; do
    	if [ -d "$i" ]; then
    		echo "backing up repository: $i"
    		cd "$i"
    		git pull
    		cd ..
    	fi
    done
    

    copy | embed

    0 comments - tagged in  posted by prauber on Feb 25, 2010 at 5:55 a.m. EST
  • adds a specifiable number of groups to a gitosis server
    #!/bin/bash
    
    ############################################################
    ##                                                         #
    ## author:      Patrik Rauber                              #
    ## email:       rou_pi@hotmail.com                         #
    ## website:     www.patrikrauber.ch                        #
    ##                                                         #
    ## script for generating as much gitosis repositories      #
    ##  as you need.                                           #
    ##  the user specified in the GITOSIS_GROUP_MEMBERS will   #
    ##  be able to read from and write to each of the repos.   #
    ##                                                         #
    ## repos will be named groupX where X is a number from     #
    ##  1 to $2 (can be entered at startup                     #
    ##                                                         #
    ## the script assumes that you can manage gitosis          #
    ##  (that means you are logged in as the user that is      #
    ##  authorized to update the configuration of gitosis      #
    ##                                                         #
    ## after setting up gitosis, the repositories are          #
    ## initialized too and ready for work (ready for git clone #
    ############################################################
    
    # the git remote servername (from where to check out the repos)
    GIT_SERVER="$3"
    
    # check out gitosis admin into empty directory
    cd /tmp
    git clone "$GIT_SERVER:gitosis-admin.git"
    cd gitosis-admin
    
    
    # write the corresponding number of groups into the conf file
    
    # the filename of the conf file.
    GITOSIS_CONF="gitosis.conf"
    # the name of the members that should be able to admin each repo
    GITOSIS_GROUP_MEMBERS="$4"
    # read the number of groups as first passed argument from commandline
    NUM_GROUPS="$1"
    # get the git ignore file path from the commandline
    GIT_IGNORE="$2"
    
    
    # create groups and repository in the gitosis.conf file
    for i in `seq -w 1 "$NUM_GROUPS"`; do
    	echo "[repos group$i]" >> "$GITOSIS_CONF"
    	echo "description = repository of group $i" >> "$GITOSIS_CONF"
    	echo >> "$GITOSIS_CONF"
    	echo "[group group$i]" >> "$GITOSIS_CONF"
    	echo "members = $GITOSIS_GROUP_MEMBERS" >> "$GITOSIS_CONF"
    	echo "writable = group$i" >> "$GITOSIS_CONF"
    	echo >> "$GITOSIS_CONF"
    	echo >> "$GITOSIS_CONF"
    done
    
    
    # update the gitosis file: push changes back to server
    git commit -a -m "adding users for p2 lecture to gitosis"
    git push
    
    # remove the gitosis directory
    cd ..
    rm -Rf gitosis-admin
    
    #initialize each repository we created above.
    
    for i in `seq -w 1 "$NUM_GROUPS"`; do
    	mkdir "group$i"
    	cd "group$i"
    	git init
    	git remote add origin "$GIT_SERVER:group$i.git"
    	# in order for the repo to be created it must not be empty
    	# therefore we add the .gitignore file
    	cp "$GIT_IGNORE" .gitignore
    	git add .gitignore
    	git commit -a -m "Initial import."
    	git push origin master
    	cd ..
    	rm -Rf "group$i"
    done
    	
    

    copy | embed

    0 comments - tagged in  posted by prauber on Jan 26, 2010 at 5:20 a.m. EST
  • Git Basics
    # init a git repository
    git init
    
    # add file to repository
    git add <filename>
    
    # remove file from repository but not from working dir
    git rm --cached <filename>
    
    # commit all changes
    git commit -a -m <message>
    
    # change to previous revision
    git checkout <revision>
    
    # give current revision a name
    git tag <name>
    
    
    
    # create new branch
    git branch <branch>
    
    # switch to branch
    git checkout <branch>
    
    
    
    # checkout remote repository
    git clone <url>
    
    # checkout changes from remote repository
    git pull
    
    
    
    # list all files under version control
    git ls-files
    

    copy | embed

    0 comments - tagged in  posted by lucastheis on Dec 25, 2009 at 4:00 a.m. EST
  • gits from server backup per ssh
    # run 'git-archive.sh' on server
    scp -r -P 1234 user@192.168.0.1:~/git/*.tar.gz /g/git
    

    copy | embed

    0 comments - tagged in  posted by dalord on Dec 24, 2009 at 5:54 a.m. EST
  • Include Git repo in existing folder (e.g. C:\Users-repo)
    git init
    git remote add origin <path_to_repo>
    echo -e "[branch \"master\"]\n\tremote = origin\n\tmerge = refs/heads/master" >> .git/config
    git pull
    

    copy | embed

    0 comments - tagged in  posted by dalord on Dec 18, 2009 at 9:37 a.m. EST
  • List added files in the index
    git diff-index HEAD|awk '{print $5 " " $6}'|sed -n -e's/^A //p'
    

    copy | embed

    0 comments - tagged in  posted by kergoth on Dec 17, 2009 at 5:32 p.m. EST
  • List unmerged files
    git ls-files -u|awk '{print $4}'|sort -u
    

    copy | embed

    0 comments - tagged in  posted by kergoth on Dec 17, 2009 at 5:32 p.m. EST
  • Git merge stages
    1 - Common ancestor
    2 - HEAD
    3 - Remote
    
    rev-parse syntax - :<stage>:<path>
    Check out stage 2 (HEAD) - git checkout --ours <path>
    Check out stage 3 (Remote) - git checkout --theirs <path>
    

    copy | embed

    0 comments - tagged in  posted by kergoth on Dec 17, 2009 at 5:31 p.m. EST
  • Small script to show the current branch when we are inside a git repo.
    #!/bin/bash
    
    GITOUT=`git branch 2>&1 | grep \* | awk '{ print $2; }'`
    
    if [[ $GITOUT ]]; then
        echo -n "($GITOUT)"
    else
        echo -n ''
    fi
    

    copy | embed

    3 comments - tagged in  posted by marcelor on Dec 13, 2009 at 2:14 p.m. EST
Sign up to create your own snipts, or login.