Check out my first novel, midnight's simulacra!

Git: Difference between revisions

From dankwiki
No edit summary
Line 27: Line 27:
| <tt>git submodule add repo dir/path</tt> (there's a [http://git.wiki.kernel.org/index.php/GitSubmoduleTutorial Submodule Tutorial])
| <tt>git submodule add repo dir/path</tt> (there's a [http://git.wiki.kernel.org/index.php/GitSubmoduleTutorial Submodule Tutorial])
|}
|}
 
==Recipes==
===Create bare repo from existing files===
We have existing, untracked files at <tt>workpath</tt>. We want to initialize a (possibly remote) bare repository <tt>repo</tt> with the contents of <tt>workpath</tt>.
* In <tt>repo/</tt>, run <tt>git init --bare</tt>
* In <tt>workpath/</tt>, run <tt>git init</tt>
* In <tt>workpath/</tt>, run <tt>git remote add origin repo</tt>
* In <tt>workpath/</tt>, run <tt>git add .</tt>
* In <tt>workpath/</tt>, run <tt>git push</tt>
==Links==
==Links==
* Tv's "[http://eagain.net/articles/git-for-computer-scientists/ Git for Computer Scientists]"
* Tv's "[http://eagain.net/articles/git-for-computer-scientists/ Git for Computer Scientists]"
* tpope's "[http://www.tpope.net/node/106 Note About Git Commit Messages]" (2008-04-19)
* tpope's "[http://www.tpope.net/node/106 Note About Git Commit Messages]" (2008-04-19)
* GitWiki's [http://git.or.cz/gitwiki/GitTips GitTips]
* GitWiki's [http://git.or.cz/gitwiki/GitTips GitTips]

Revision as of 06:31, 15 May 2011

Here's a good crash course for subversion users.

Hosting

  • GitHub provides pretty reasonable git hosting services; open source projects eat free.
  • github-trac is a trac extension for working with GitHub

Configuration

Dump your user configuration with git config -l:

[recombinator](129) $ git config -l
user.name=Nick Black
user.email=dank@qemfd.net
github.user=dankamongmen
[recombinator](0) $

Dump the system configuration, if one exists, via git config --system -l:

[recombinator](129) $ git config --system -l
color.diff=auto
color.status=auto
color.branch=auto
[recombinator](0) $

Subversion equivs

goal subversion git
Add an external repository repo at point dir/path svn propedit svn:externals dir, and add repo path git submodule add repo dir/path (there's a Submodule Tutorial)

Recipes

Create bare repo from existing files

We have existing, untracked files at workpath. We want to initialize a (possibly remote) bare repository repo with the contents of workpath.

  • In repo/, run git init --bare
  • In workpath/, run git init
  • In workpath/, run git remote add origin repo
  • In workpath/, run git add .
  • In workpath/, run git push

Links