<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: github code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 21 Aug 2008 07:19:26 GMT</pubDate>
    <description>DZone Snippets: github 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>Trac Wiki to GitHub Wiki</title>
      <link>http://snippets.dzone.com/posts/show/5304</link>
      <description>A rough start of a script to help convert the wiki syntax of Trac pages to GitHub-friendly syntax.&lt;br /&gt;&lt;br /&gt;Some TLC is still needed on each output page, but better than doing it all by hand.&lt;br /&gt;&lt;br /&gt;Project lives here: &lt;a href="http://github.com/seven1m/trac_wiki_to_github"&gt;github.com/seven1m/trac_wiki_to_github&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby&lt;br /&gt; &lt;br /&gt;TRAC_DB_PATH = 'trac.db'&lt;br /&gt;OUT_PATH = 'wiki'&lt;br /&gt;GITHUB_WIKI_URL = '/seven1m/onebody/wikis/'&lt;br /&gt; &lt;br /&gt;require 'sqlite3'&lt;br /&gt; &lt;br /&gt;db = SQLite3::Database.new(TRAC_DB_PATH)&lt;br /&gt;pages = db.execute('select name, text from wiki w2 where version = (select max(version) from wiki where name = w2.name);')&lt;br /&gt; &lt;br /&gt;pages.each do |title, body|&lt;br /&gt;  File.open(File.join(OUT_PATH, title.gsub(/\s/, '')), 'w') do |file|&lt;br /&gt;    body.gsub!(/\{\{\{([^\n]+?)\}\}\}/, '&lt;code&gt;\1&lt;/' + 'code&gt;')&lt;br /&gt;    body.gsub!(/\{\{\{(.+?)\}\}\}/m, '&lt;pre&gt;&lt;code&gt;\1&lt;/' + 'code&gt;&lt;/pre&gt;')&lt;br /&gt;    body.gsub!(/====\s(.+?)\s====/, 'h4. \1')&lt;br /&gt;    body.gsub!(/===\s(.+?)\s===/, 'h3. \1')&lt;br /&gt;    body.gsub!(/==\s(.+?)\s==/, 'h2. \1')&lt;br /&gt;    body.gsub!(/=\s(.+?)\s=[\s\n]*/, '')&lt;br /&gt;    body.gsub!(/\[(http[^\s\[\]]+)\s([^\[\]]+)\]/, '"\2":\1')&lt;br /&gt;    body.gsub!(/\[([^\s]+)\s(.+)\]/, '"\2":' + GITHUB_WIKI_URL + '\1')&lt;br /&gt;    body.gsub!(/([^"\/\!])(([A-Z][a-z0-9]+){2,})/, '\1[[\2]]')&lt;br /&gt;    body.gsub!(/\!(([A-Z][a-z0-9]+){2,})/, '\1')&lt;br /&gt;    body.gsub!(/'''(.+)'''/, '*\1*')&lt;br /&gt;    body.gsub!(/''(.+)''/, '_\1_')&lt;br /&gt;    body.gsub!(/^\s\*/, '*')&lt;br /&gt;    body.gsub!(/^\s\d\./, '#')&lt;br /&gt;    file.write(body)&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 02 Apr 2008 02:05:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5304</guid>
      <author>timmorgan (Tim Morgan)</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>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>
  </channel>
</rss>
