<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: git code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 03:44:45 GMT</pubDate>
    <description>DZone Snippets: git code</description>
    <item>
      <title>Getting git pull to work for new repos in GitHub</title>
      <link>http://snippets.dzone.com/posts/show/5714</link>
      <description>When creating a new repos in GitHub, I sometimes what to have 2 master branches on different machines to work on, and to use the version on GitHub as my root. In order to keep my 2 branches in sync I would run 'git pull', but out of the box on gitHub this spews out a message asking for more information. Adding the lines below should make it work again as expected.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;git config branch.master.remote origin&lt;br /&gt;git config branch.master.merge refs/heads/master &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 30 Jun 2008 08:43:14 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5714</guid>
      <author>whomwah (Duncan Robertson)</author>
    </item>
    <item>
      <title>new git repo</title>
      <link>http://snippets.dzone.com/posts/show/5708</link>
      <description>// setup new git repo&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;cd ~/repo/&lt;br /&gt;git clone &#8211;bare ~/projects/myprojectname myprojectname.git&lt;br /&gt;touch myprojectname.git/git-daemon-export-ok&lt;br /&gt;cd myprojectname.git&lt;br /&gt;git &#8211;bare update-server-info&lt;br /&gt;# post-update executes everytime there is a push to this public repository;&lt;br /&gt;# it executes an update-server-info by default.&lt;br /&gt;chmod a+x hooks/post-update&lt;br /&gt;&lt;br /&gt;cd ~&lt;br /&gt;rsync -av ~/repo username@webhost.example.com:~/git/&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 29 Jun 2008 03:12:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5708</guid>
      <author>lorenb (Loren Brichter)</author>
    </item>
    <item>
      <title>Remove Deleted Files From Git</title>
      <link>http://snippets.dzone.com/posts/show/5669</link>
      <description>// Via http://www.jamesrobey.com/bash-script-to-remove-deleted-files-from-git/&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for i in `git status | grep deleted | awk '{print $3}'`; do git rm $i; done&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 18 Jun 2008 20:33:20 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5669</guid>
      <author>mattgrayson (Matt)</author>
    </item>
    <item>
      <title>Adding new files to your github repository</title>
      <link>http://snippets.dzone.com/posts/show/5280</link>
      <description>Here is a set of instructions to apply new files to my github repository which is called projectx.&lt;br /&gt;&lt;br /&gt;Before you start make sure you don't already have the repository name listed as a directory in the local current directory.&lt;br /&gt;&lt;br /&gt;1) copy the remote repository to your local machine&lt;br /&gt;syntax: git clone [uri] # eg. &lt;code&gt;git clone git@github.com:jrobertson/projectx.git&lt;/code&gt;&lt;br /&gt;1.5) cd into the newly created local repository eg.&lt;code&gt;cd projectx&lt;/code&gt;&lt;br /&gt;2) copy the local file to the local repository directory&lt;br /&gt;eg. &lt;code&gt;cp ../projectx2/feed.rb .&lt;/code&gt;&lt;br /&gt;3) add the local files to the local repository&lt;br /&gt;syntax: git add [file] # eg. &lt;code&gt;git add feed.rb&lt;/code&gt;&lt;br /&gt;4) Inform the git system that you have completed the required changes for this session.&lt;br /&gt;&lt;code&gt;git commit -a # add a message associated with this file revision&lt;/code&gt;&lt;br /&gt;5) copy the new local repository files back to the remote repository.&lt;br /&gt;&lt;code&gt;git push # updates the changes back to the server&lt;/code&gt;&lt;br /&gt;Note: The text with the square-brackets should be replaced with your own values.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://cworth.org/hgbook-git/tour/"&gt;A tour of git: the basics&lt;/a&gt; [cworth.org]</description>
      <pubDate>Tue, 25 Mar 2008 15:16:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5280</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>rake task to rename views to rails 2.0 format </title>
      <link>http://snippets.dzone.com/posts/show/5262</link>
      <description>// This task will rename your files to the rails 2.0 format, using git mv. Add it to /lib/tasks/rails.rake&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;namespace 'views' do&lt;br /&gt;  desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder, and .haml to .html.haml'&lt;br /&gt;  task 'rename' do&lt;br /&gt;    Dir.glob('app/views/**/[^_]*.rhtml').each do |file|&lt;br /&gt;      puts `git mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    Dir.glob('app/views/**/[^_]*.rxml').each do |file|&lt;br /&gt;      puts `git mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    Dir.glob('app/views/**/[^_]*.rjs').each do |file|&lt;br /&gt;      puts `git mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`&lt;br /&gt;    end&lt;br /&gt;    Dir.glob('app/views/**/[^_]*.haml').each do |file|&lt;br /&gt;      puts `git mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 20 Mar 2008 03:11:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5262</guid>
      <author>caffo ()</author>
    </item>
    <item>
      <title>overwrite heroku code with an alien git repository</title>
      <link>http://snippets.dzone.com/posts/show/5243</link>
      <description>// Use this command in your repos directory to push to your heroku repos. Useful for github / heroku sync.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;git push -v -f git@heroku.com:&lt;application&gt;.git&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 18 Mar 2008 06:15:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5243</guid>
      <author>caffo ()</author>
    </item>
    <item>
      <title>Alias to a Nice Default Gitk</title>
      <link>http://snippets.dzone.com/posts/show/4992</link>
      <description>Just a really quick and easy shell alias for my preferred defaults for Git's repository and branch viewer, Gitk.&lt;br /&gt;&lt;br /&gt;This runs "gitk"...&lt;br /&gt;...including all branches,&lt;br /&gt;...outputting errors to the black hole,&lt;br /&gt;...and any extra command-line arguments.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Run like this&lt;br /&gt;# gitk --since="2 days ago" &amp;&lt;br /&gt;&lt;br /&gt;alias gitk="gitk --all $1 2&gt;/dev/null"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 17 Jan 2008 04:44:18 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4992</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Git-diff last two commits through TextMate</title>
      <link>http://snippets.dzone.com/posts/show/4866</link>
      <description>I believe this is how svn diff operates... but anyway, this alias will allow you to diff the last two commits in Git through TextMate. If you have a theme that supports Diff's then you'll see the differences clearly. Remove the last pipe statement (the mate part) to expose your diff in the console.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;alias gitdiff='git log|grep commit|cut -d " " -f2|head -n 2|xargs -n 2 git diff -R|mate'&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 09 Dec 2007 04:52:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4866</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Checkout a Git clone of an SVN repository in parent folder</title>
      <link>http://snippets.dzone.com/posts/show/4813</link>
      <description>Here is a quick executable cmd that you run inside a folder checked out with Subversion. It will clone the repository using Git into the parent folder as &amp;lt;projname&amp;gt;.git&lt;br /&gt;&lt;br /&gt;Stick this code into ~/bin/gitify and add ~/bin to your path:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby -wKU&lt;br /&gt;&lt;br /&gt;# get svn info location&lt;br /&gt;svnurl = `svn info | grep "^URL:"`.gsub('URL: ','').chomp&lt;br /&gt;&lt;br /&gt;# project = basename&lt;br /&gt;project = File.basename(Dir.pwd)&lt;br /&gt;&lt;br /&gt;puts cmd = "git-svn clone #{svnurl} ../#{project}.git"&lt;br /&gt;&lt;br /&gt;`#{cmd}`&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 22 Nov 2007 22:35:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4813</guid>
      <author>nicwilliams (Dr Nic Williams)</author>
    </item>
  </channel>
</rss>
