<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.spheredev.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ralph+Dratman</id>
		<title>Spherical wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.spheredev.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ralph+Dratman"/>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Special:Contributions/Ralph_Dratman"/>
		<updated>2026-05-25T09:25:07Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.29.0</generator>

	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Git_for_the_lazy&amp;diff=1023</id>
		<title>Git for the lazy</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Git_for_the_lazy&amp;diff=1023"/>
				<updated>2013-08-29T21:27:22Z</updated>
		
		<summary type="html">&lt;p&gt;Ralph Dratman: /* Linux */ add Mac OS X&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://git-scm.com/ Git] is a [http://en.wikipedia.org/wiki/Distributed_revision_control distributed version control system]. No, you don't need to know what that means to use this guide. Think of it as a time machine: [[Subversion]] or [[CVS]] without the cruft.&lt;br /&gt;
&lt;br /&gt;
If you make a lot of changes, but decided you made a mistake, this will save your butt.&lt;br /&gt;
&lt;br /&gt;
This guide is for people who want to jump to any point in time with their project/game/whatever, and want something to use for themselves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Install git==&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, you have two options:&lt;br /&gt;
&lt;br /&gt;
====msysGit====&lt;br /&gt;
Download and install [https://git.wiki.kernel.org/index.php/MSysGit:InstallMSysGit#How_to_install_it msysGit] to use Git in Windows's cmd.exe console.&lt;br /&gt;
&lt;br /&gt;
====Cygwin====&lt;br /&gt;
#	Download [http://www.cygwin.com/ Cygwin].&lt;br /&gt;
#	Put &amp;lt;var&amp;gt;setup.exe&amp;lt;/var&amp;gt; in a folder of its own in your documents.&lt;br /&gt;
#	Launch &amp;lt;var&amp;gt;setup.exe&amp;lt;/var&amp;gt;.&lt;br /&gt;
#	While installing Cygwin, pick these packages:&lt;br /&gt;
#*	'''git''' from the DEVEL category&lt;br /&gt;
#*	'''nano''' (if you're wimpy) or '''vim''' (if you know it), both in the EDITORS category&lt;br /&gt;
&lt;br /&gt;
You'll now have a shortcut to launch Cygwin, which brings up something like the Linux terminal.&lt;br /&gt;
&lt;br /&gt;
===Linux, Mac OS X===&lt;br /&gt;
Install the &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; package using your preferred method (package manager or from source).&lt;br /&gt;
&lt;br /&gt;
==Introduce yourself to git==&lt;br /&gt;
Fire up your Cygwin/Linux terminal, and type:&lt;br /&gt;
&lt;br /&gt;
 git config --global user.name &amp;quot;Joey Joejoe&amp;quot;&lt;br /&gt;
 git config --global user.email &amp;quot;joey@joejoe.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You only need to do this once.&lt;br /&gt;
&lt;br /&gt;
==Start your project==&lt;br /&gt;
Start your project using the Sphere editor, or from a ZIP file, or just by making the directory and adding files yourself.&lt;br /&gt;
&lt;br /&gt;
Now &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; to your project directory:&lt;br /&gt;
&lt;br /&gt;
 cd myproject/&lt;br /&gt;
&lt;br /&gt;
Tell git to start giving a damn about your project:&lt;br /&gt;
&lt;br /&gt;
 git init&lt;br /&gt;
&lt;br /&gt;
... and your files in it:&lt;br /&gt;
&lt;br /&gt;
 git add .&lt;br /&gt;
&lt;br /&gt;
Wrap it up:&lt;br /&gt;
&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
Now type in a &amp;quot;commit message&amp;quot;: a reminder to yourself of what you've just done, like:&lt;br /&gt;
&lt;br /&gt;
 Initial commit.&lt;br /&gt;
&lt;br /&gt;
Save it and quit (type &amp;lt;kbd&amp;gt;Ctrl+o&amp;lt;/kbd&amp;gt; &amp;lt;kbd&amp;gt;Ctrl+x&amp;lt;/kbd&amp;gt; if you're in nano, &amp;lt;kbd&amp;gt;:x&amp;lt;/kbd&amp;gt; if you're in vim) and you're done!&lt;br /&gt;
&lt;br /&gt;
==Work in bits==&lt;br /&gt;
When dealing with git, it's best to work in small bits. Rule of thumb: if you can't summarise it in a sentence, you've gone too long without committing.&lt;br /&gt;
&lt;br /&gt;
This section is your typical work cycle:&lt;br /&gt;
&lt;br /&gt;
#	Work on your project.&lt;br /&gt;
#	Check which files you've changed:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git status&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Check what the actual changes were:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git diff&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Add any files/folders mentioned in step 2 (or new ones):&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git add file1 newfile2 newfolder3&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Commit your work:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git commit&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Enter and save your commit message. If you want to back out, just quit the editor.&lt;br /&gt;
&lt;br /&gt;
Repeat as much as you like. Just remember to always end with a commit.&lt;br /&gt;
&lt;br /&gt;
==Admire your work==&lt;br /&gt;
To see what you've done so far, type:&lt;br /&gt;
&lt;br /&gt;
 git log&lt;br /&gt;
&lt;br /&gt;
To just see the last few commits you've made:&lt;br /&gt;
&lt;br /&gt;
 git log -n3&lt;br /&gt;
&lt;br /&gt;
Replace 3 with whatever you feel like.&lt;br /&gt;
&lt;br /&gt;
For a complete overview, type:&lt;br /&gt;
&lt;br /&gt;
 git log --stat --summary&lt;br /&gt;
&lt;br /&gt;
Browse at your leisure.&lt;br /&gt;
&lt;br /&gt;
==View changes==&lt;br /&gt;
To view changes you haven't committed yet:&lt;br /&gt;
&lt;br /&gt;
 git diff&lt;br /&gt;
&lt;br /&gt;
If you want changes between versions of your project, first you'll need to know the commit ID for the changes:&lt;br /&gt;
&lt;br /&gt;
 git log --pretty=oneline&lt;br /&gt;
&lt;br /&gt;
 6c93a1960072710c6677682a7816ba9e48b7528f Remove persist.clearScriptCache() function.&lt;br /&gt;
 c6e7f6e685edbb414c676df259aab989b617b018 Make git ignore logs directory.&lt;br /&gt;
 8fefbce334d30466e3bb8f24d11202a8f535301c Initial commit.&lt;br /&gt;
&lt;br /&gt;
The 40 characters at the front of each line is the commit ID. You'll also see them when you git commit. You can use it to show differences between commits.&lt;br /&gt;
&lt;br /&gt;
To view the changes between the 1st and 2nd commits, type:&lt;br /&gt;
&lt;br /&gt;
 git diff 8fef..c6e7&lt;br /&gt;
&lt;br /&gt;
Note how you didn't have to type the whole thing, just the first few unique characters are enough.&lt;br /&gt;
&lt;br /&gt;
To view the last changes you made:&lt;br /&gt;
&lt;br /&gt;
 git diff HEAD^..HEAD&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to fix mistakes==&lt;br /&gt;
Haven't committed yet, but don't want to save the changes? You can throw them away:&lt;br /&gt;
&lt;br /&gt;
 git reset --hard&lt;br /&gt;
&lt;br /&gt;
You can also do it for individual files, but it's a bit different:&lt;br /&gt;
&lt;br /&gt;
 git checkout myfile.txt&lt;br /&gt;
&lt;br /&gt;
Messed up the commit message? This will let you re-enter it:&lt;br /&gt;
&lt;br /&gt;
 git commit --amend&lt;br /&gt;
&lt;br /&gt;
Forgot something in your last commit? That's easy to fix.&lt;br /&gt;
&lt;br /&gt;
 git reset --soft HEAD^&lt;br /&gt;
&lt;br /&gt;
Add that stuff you forgot:&lt;br /&gt;
&lt;br /&gt;
 git add forgot.txt these.txt&lt;br /&gt;
&lt;br /&gt;
Then write over the last commit:&lt;br /&gt;
&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
Don't make a habit of overwriting/changing history if it's a public repo you're working with, though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==For the not so lazy==&lt;br /&gt;
Just some extra reading here. Skip it if you're lazy.&lt;br /&gt;
&lt;br /&gt;
===Writing good commit messages===&lt;br /&gt;
The author of [http://progit.org/book/ch5-2.html Pro Git] (an excellent online book) gives this advice for commit messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. As a general rule, your messages should start with a single line that's no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. The Git project requires that the more detailed explanation include your motivation for the change and contrast its implementation with previous behavior — this is a good guideline to follow. It's also a good idea to use the imperative present tense in these messages. In other words, use commands. Instead of &amp;quot;I added tests for&amp;quot; or &amp;quot;Adding tests for,&amp;quot; use &amp;quot;Add tests for.&amp;quot; Here is a template originally written by Tim Pope at tpope.net:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Short (50 chars or less) summary of changes&lt;br /&gt;
&lt;br /&gt;
More detailed explanatory text, if necessary.  Wrap it to about 72&lt;br /&gt;
characters or so.  In some contexts, the first line is treated as the&lt;br /&gt;
subject of an email and the rest of the text as the body.  The blank&lt;br /&gt;
line separating the summary from the body is critical (unless you omit&lt;br /&gt;
the body entirely); tools like rebase can get confused if you run the&lt;br /&gt;
two together.&lt;br /&gt;
&lt;br /&gt;
Further paragraphs come after blank lines.&lt;br /&gt;
&lt;br /&gt;
 - Bullet points are okay, too&lt;br /&gt;
&lt;br /&gt;
 - Typically a hyphen or asterisk is used for the bullet, preceded by a&lt;br /&gt;
   single space, with blank lines in between, but conventions vary here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all your commit messages look like this, things will be a lot easier for you and the developers you work with. The Git project has well-formatted commit messages — I encourage you to run &amp;lt;tt&amp;gt;git log --no-merges&amp;lt;/tt&amp;gt; there to see what a nicely formatted project-commit history looks like.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ignoring files===&lt;br /&gt;
When you check your project status, sometimes you'll get something like this:&lt;br /&gt;
&lt;br /&gt;
 git status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# On branch master&lt;br /&gt;
# Untracked files:&lt;br /&gt;
#   (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)&lt;br /&gt;
#&lt;br /&gt;
#       bleh.txt&lt;br /&gt;
#       module.c~&lt;br /&gt;
nothing added to commit but untracked files present (use &amp;quot;git add&amp;quot; to track)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't want git to track these files, you can add entries to &amp;lt;tt&amp;gt;.gitignore&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nano .gitignore&lt;br /&gt;
&lt;br /&gt;
And add the files you want ignored:&lt;br /&gt;
&lt;br /&gt;
 bleh.txt&lt;br /&gt;
 *~&lt;br /&gt;
&lt;br /&gt;
The first line ignores &amp;lt;tt&amp;gt;bleh.txt&amp;lt;/tt&amp;gt; the second line ignores all files and directories ending with a tilde (~), i.e. backup files.&lt;br /&gt;
&lt;br /&gt;
You can check if you got it right:&lt;br /&gt;
&lt;br /&gt;
 git status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# On branch master&lt;br /&gt;
# Changed but not updated:&lt;br /&gt;
#   (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)&lt;br /&gt;
#&lt;br /&gt;
#       modified:   .gitignore&lt;br /&gt;
#&lt;br /&gt;
no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don't forget to commit your changes to .gitignore!&lt;br /&gt;
&lt;br /&gt;
 git add .gitignore&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
With something like this for your commit message:&lt;br /&gt;
&lt;br /&gt;
 Make git ignore bleh.txt and backup files.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;tt&amp;gt;.gitignore&amp;lt;/tt&amp;gt; to keep your messages clean, and stop git from bugging you about stuff you don't care about. It's a good idea to ignore things like executable binaries, object files, etc. Pretty much anything that can be regenerated from source.&lt;br /&gt;
&lt;br /&gt;
===Branching and merging===&lt;br /&gt;
A branch is a separate line of development. If you're going to make a bunch of changes related to a single feature, it might be a good idea to make a &amp;quot;topic branch&amp;quot;: a branch related to a topic/feature.&lt;br /&gt;
&lt;br /&gt;
To make a new branch:&lt;br /&gt;
&lt;br /&gt;
 git branch feature_x&lt;br /&gt;
&lt;br /&gt;
To view the current branches:&lt;br /&gt;
&lt;br /&gt;
 git branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  feature_x&lt;br /&gt;
* master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The asterisk (*) shows your current branch. ''master'' is the default branch, like the trunk in CVS or Subversion.&lt;br /&gt;
&lt;br /&gt;
To switch to your new branch, just type:&lt;br /&gt;
&lt;br /&gt;
 git checkout feature_x&lt;br /&gt;
&lt;br /&gt;
If you check the branches again, you'll see the switch:&lt;br /&gt;
&lt;br /&gt;
 git branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* feature_x&lt;br /&gt;
  master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go through the usual edit/commit cycle. Your changes will go onto the new branch.&lt;br /&gt;
&lt;br /&gt;
When you want to put your branch changes back onto ''master'', first switch to ''master'':&lt;br /&gt;
&lt;br /&gt;
 git checkout master&lt;br /&gt;
&lt;br /&gt;
Then merge the branch changes:&lt;br /&gt;
&lt;br /&gt;
 git merge feature_x&lt;br /&gt;
&lt;br /&gt;
This will combine the changes of the ''master'' and ''feature_x'' branches. If you didn't change the ''master'' branch, git will just &amp;quot;fast-forward&amp;quot; the ''feature_x'' changes so master is up to date. Otherwise, the changes from ''master'' and ''feature_x'' will be combined.&lt;br /&gt;
&lt;br /&gt;
You can see the commit in your project's log:&lt;br /&gt;
&lt;br /&gt;
 git log -n1&lt;br /&gt;
&lt;br /&gt;
If you're happy with the result, and don't need the branch any more, you can delete it:&lt;br /&gt;
&lt;br /&gt;
 git branch -d feature_x&lt;br /&gt;
&lt;br /&gt;
Now when you see the branches, you'll only see the master branch:&lt;br /&gt;
&lt;br /&gt;
 git branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can make as many branches as you need at once.&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
If you hit a new version of your project, it may be a good idea to mark it with a tag. Tags can be used to easily refer to older commits.&lt;br /&gt;
&lt;br /&gt;
To tag the current version of your project as &amp;quot;v1.4.2&amp;quot;, for example:&lt;br /&gt;
&lt;br /&gt;
 git tag v1.4.2&lt;br /&gt;
&lt;br /&gt;
You can use these tags in places where those 40-character IDs appear.&lt;br /&gt;
&lt;br /&gt;
==What now?==&lt;br /&gt;
git can help with working with other people too. Of course, then you do have to learn about distributed version control. Until then, just enjoy this page.&lt;br /&gt;
&lt;br /&gt;
But if you want to learn:&lt;br /&gt;
&lt;br /&gt;
*	[http://progit.org/book/ Pro Git online book]&lt;br /&gt;
*	[http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html gittutorial manual page online]&lt;br /&gt;
*	[http://www.kernel.org/pub/software/scm/git/docs/everyday.html Everyday git with 20 commands or so]&lt;br /&gt;
*	[http://git-scm.com/ The official git web site]&lt;br /&gt;
&lt;br /&gt;
Main git selling points (ripped off the main site):&lt;br /&gt;
&lt;br /&gt;
*	Distributed development, i.e. working with other people.&lt;br /&gt;
*	Strong support for non-linear development, i.e. working with other people at the same time!&lt;br /&gt;
*	Efficient handling of large projects, i.e. fast!&lt;br /&gt;
*	Cryptographic authentication of history, for the paranoid.&lt;br /&gt;
*	Scriptable toolkit design; you can script pretty much any git task.&lt;br /&gt;
&lt;br /&gt;
If something doesn't seem right or is confusing, contact me at my blog. --tunginobi 07:42, 5 August 2009 (IST)&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Ralph Dratman</name></author>	</entry>

	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Git_for_the_lazy&amp;diff=1022</id>
		<title>Git for the lazy</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Git_for_the_lazy&amp;diff=1022"/>
				<updated>2013-08-29T21:26:02Z</updated>
		
		<summary type="html">&lt;p&gt;Ralph Dratman: /* What now? */ punctuation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://git-scm.com/ Git] is a [http://en.wikipedia.org/wiki/Distributed_revision_control distributed version control system]. No, you don't need to know what that means to use this guide. Think of it as a time machine: [[Subversion]] or [[CVS]] without the cruft.&lt;br /&gt;
&lt;br /&gt;
If you make a lot of changes, but decided you made a mistake, this will save your butt.&lt;br /&gt;
&lt;br /&gt;
This guide is for people who want to jump to any point in time with their project/game/whatever, and want something to use for themselves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Install git==&lt;br /&gt;
===Windows===&lt;br /&gt;
For Windows, you have two options:&lt;br /&gt;
&lt;br /&gt;
====msysGit====&lt;br /&gt;
Download and install [https://git.wiki.kernel.org/index.php/MSysGit:InstallMSysGit#How_to_install_it msysGit] to use Git in Windows's cmd.exe console.&lt;br /&gt;
&lt;br /&gt;
====Cygwin====&lt;br /&gt;
#	Download [http://www.cygwin.com/ Cygwin].&lt;br /&gt;
#	Put &amp;lt;var&amp;gt;setup.exe&amp;lt;/var&amp;gt; in a folder of its own in your documents.&lt;br /&gt;
#	Launch &amp;lt;var&amp;gt;setup.exe&amp;lt;/var&amp;gt;.&lt;br /&gt;
#	While installing Cygwin, pick these packages:&lt;br /&gt;
#*	'''git''' from the DEVEL category&lt;br /&gt;
#*	'''nano''' (if you're wimpy) or '''vim''' (if you know it), both in the EDITORS category&lt;br /&gt;
&lt;br /&gt;
You'll now have a shortcut to launch Cygwin, which brings up something like the Linux terminal.&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
Install the &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; package using your preferred method (package manager or from source).&lt;br /&gt;
&lt;br /&gt;
==Introduce yourself to git==&lt;br /&gt;
Fire up your Cygwin/Linux terminal, and type:&lt;br /&gt;
&lt;br /&gt;
 git config --global user.name &amp;quot;Joey Joejoe&amp;quot;&lt;br /&gt;
 git config --global user.email &amp;quot;joey@joejoe.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You only need to do this once.&lt;br /&gt;
&lt;br /&gt;
==Start your project==&lt;br /&gt;
Start your project using the Sphere editor, or from a ZIP file, or just by making the directory and adding files yourself.&lt;br /&gt;
&lt;br /&gt;
Now &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; to your project directory:&lt;br /&gt;
&lt;br /&gt;
 cd myproject/&lt;br /&gt;
&lt;br /&gt;
Tell git to start giving a damn about your project:&lt;br /&gt;
&lt;br /&gt;
 git init&lt;br /&gt;
&lt;br /&gt;
... and your files in it:&lt;br /&gt;
&lt;br /&gt;
 git add .&lt;br /&gt;
&lt;br /&gt;
Wrap it up:&lt;br /&gt;
&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
Now type in a &amp;quot;commit message&amp;quot;: a reminder to yourself of what you've just done, like:&lt;br /&gt;
&lt;br /&gt;
 Initial commit.&lt;br /&gt;
&lt;br /&gt;
Save it and quit (type &amp;lt;kbd&amp;gt;Ctrl+o&amp;lt;/kbd&amp;gt; &amp;lt;kbd&amp;gt;Ctrl+x&amp;lt;/kbd&amp;gt; if you're in nano, &amp;lt;kbd&amp;gt;:x&amp;lt;/kbd&amp;gt; if you're in vim) and you're done!&lt;br /&gt;
&lt;br /&gt;
==Work in bits==&lt;br /&gt;
When dealing with git, it's best to work in small bits. Rule of thumb: if you can't summarise it in a sentence, you've gone too long without committing.&lt;br /&gt;
&lt;br /&gt;
This section is your typical work cycle:&lt;br /&gt;
&lt;br /&gt;
#	Work on your project.&lt;br /&gt;
#	Check which files you've changed:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git status&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Check what the actual changes were:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git diff&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Add any files/folders mentioned in step 2 (or new ones):&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git add file1 newfile2 newfolder3&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Commit your work:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;git commit&amp;lt;/pre&amp;gt;&lt;br /&gt;
#	Enter and save your commit message. If you want to back out, just quit the editor.&lt;br /&gt;
&lt;br /&gt;
Repeat as much as you like. Just remember to always end with a commit.&lt;br /&gt;
&lt;br /&gt;
==Admire your work==&lt;br /&gt;
To see what you've done so far, type:&lt;br /&gt;
&lt;br /&gt;
 git log&lt;br /&gt;
&lt;br /&gt;
To just see the last few commits you've made:&lt;br /&gt;
&lt;br /&gt;
 git log -n3&lt;br /&gt;
&lt;br /&gt;
Replace 3 with whatever you feel like.&lt;br /&gt;
&lt;br /&gt;
For a complete overview, type:&lt;br /&gt;
&lt;br /&gt;
 git log --stat --summary&lt;br /&gt;
&lt;br /&gt;
Browse at your leisure.&lt;br /&gt;
&lt;br /&gt;
==View changes==&lt;br /&gt;
To view changes you haven't committed yet:&lt;br /&gt;
&lt;br /&gt;
 git diff&lt;br /&gt;
&lt;br /&gt;
If you want changes between versions of your project, first you'll need to know the commit ID for the changes:&lt;br /&gt;
&lt;br /&gt;
 git log --pretty=oneline&lt;br /&gt;
&lt;br /&gt;
 6c93a1960072710c6677682a7816ba9e48b7528f Remove persist.clearScriptCache() function.&lt;br /&gt;
 c6e7f6e685edbb414c676df259aab989b617b018 Make git ignore logs directory.&lt;br /&gt;
 8fefbce334d30466e3bb8f24d11202a8f535301c Initial commit.&lt;br /&gt;
&lt;br /&gt;
The 40 characters at the front of each line is the commit ID. You'll also see them when you git commit. You can use it to show differences between commits.&lt;br /&gt;
&lt;br /&gt;
To view the changes between the 1st and 2nd commits, type:&lt;br /&gt;
&lt;br /&gt;
 git diff 8fef..c6e7&lt;br /&gt;
&lt;br /&gt;
Note how you didn't have to type the whole thing, just the first few unique characters are enough.&lt;br /&gt;
&lt;br /&gt;
To view the last changes you made:&lt;br /&gt;
&lt;br /&gt;
 git diff HEAD^..HEAD&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to fix mistakes==&lt;br /&gt;
Haven't committed yet, but don't want to save the changes? You can throw them away:&lt;br /&gt;
&lt;br /&gt;
 git reset --hard&lt;br /&gt;
&lt;br /&gt;
You can also do it for individual files, but it's a bit different:&lt;br /&gt;
&lt;br /&gt;
 git checkout myfile.txt&lt;br /&gt;
&lt;br /&gt;
Messed up the commit message? This will let you re-enter it:&lt;br /&gt;
&lt;br /&gt;
 git commit --amend&lt;br /&gt;
&lt;br /&gt;
Forgot something in your last commit? That's easy to fix.&lt;br /&gt;
&lt;br /&gt;
 git reset --soft HEAD^&lt;br /&gt;
&lt;br /&gt;
Add that stuff you forgot:&lt;br /&gt;
&lt;br /&gt;
 git add forgot.txt these.txt&lt;br /&gt;
&lt;br /&gt;
Then write over the last commit:&lt;br /&gt;
&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
Don't make a habit of overwriting/changing history if it's a public repo you're working with, though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==For the not so lazy==&lt;br /&gt;
Just some extra reading here. Skip it if you're lazy.&lt;br /&gt;
&lt;br /&gt;
===Writing good commit messages===&lt;br /&gt;
The author of [http://progit.org/book/ch5-2.html Pro Git] (an excellent online book) gives this advice for commit messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Getting in the habit of creating quality commit messages makes using and collaborating with Git a lot easier. As a general rule, your messages should start with a single line that's no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation. The Git project requires that the more detailed explanation include your motivation for the change and contrast its implementation with previous behavior — this is a good guideline to follow. It's also a good idea to use the imperative present tense in these messages. In other words, use commands. Instead of &amp;quot;I added tests for&amp;quot; or &amp;quot;Adding tests for,&amp;quot; use &amp;quot;Add tests for.&amp;quot; Here is a template originally written by Tim Pope at tpope.net:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Short (50 chars or less) summary of changes&lt;br /&gt;
&lt;br /&gt;
More detailed explanatory text, if necessary.  Wrap it to about 72&lt;br /&gt;
characters or so.  In some contexts, the first line is treated as the&lt;br /&gt;
subject of an email and the rest of the text as the body.  The blank&lt;br /&gt;
line separating the summary from the body is critical (unless you omit&lt;br /&gt;
the body entirely); tools like rebase can get confused if you run the&lt;br /&gt;
two together.&lt;br /&gt;
&lt;br /&gt;
Further paragraphs come after blank lines.&lt;br /&gt;
&lt;br /&gt;
 - Bullet points are okay, too&lt;br /&gt;
&lt;br /&gt;
 - Typically a hyphen or asterisk is used for the bullet, preceded by a&lt;br /&gt;
   single space, with blank lines in between, but conventions vary here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If all your commit messages look like this, things will be a lot easier for you and the developers you work with. The Git project has well-formatted commit messages — I encourage you to run &amp;lt;tt&amp;gt;git log --no-merges&amp;lt;/tt&amp;gt; there to see what a nicely formatted project-commit history looks like.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ignoring files===&lt;br /&gt;
When you check your project status, sometimes you'll get something like this:&lt;br /&gt;
&lt;br /&gt;
 git status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# On branch master&lt;br /&gt;
# Untracked files:&lt;br /&gt;
#   (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)&lt;br /&gt;
#&lt;br /&gt;
#       bleh.txt&lt;br /&gt;
#       module.c~&lt;br /&gt;
nothing added to commit but untracked files present (use &amp;quot;git add&amp;quot; to track)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't want git to track these files, you can add entries to &amp;lt;tt&amp;gt;.gitignore&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nano .gitignore&lt;br /&gt;
&lt;br /&gt;
And add the files you want ignored:&lt;br /&gt;
&lt;br /&gt;
 bleh.txt&lt;br /&gt;
 *~&lt;br /&gt;
&lt;br /&gt;
The first line ignores &amp;lt;tt&amp;gt;bleh.txt&amp;lt;/tt&amp;gt; the second line ignores all files and directories ending with a tilde (~), i.e. backup files.&lt;br /&gt;
&lt;br /&gt;
You can check if you got it right:&lt;br /&gt;
&lt;br /&gt;
 git status&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# On branch master&lt;br /&gt;
# Changed but not updated:&lt;br /&gt;
#   (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)&lt;br /&gt;
#&lt;br /&gt;
#       modified:   .gitignore&lt;br /&gt;
#&lt;br /&gt;
no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don't forget to commit your changes to .gitignore!&lt;br /&gt;
&lt;br /&gt;
 git add .gitignore&lt;br /&gt;
 git commit&lt;br /&gt;
&lt;br /&gt;
With something like this for your commit message:&lt;br /&gt;
&lt;br /&gt;
 Make git ignore bleh.txt and backup files.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;tt&amp;gt;.gitignore&amp;lt;/tt&amp;gt; to keep your messages clean, and stop git from bugging you about stuff you don't care about. It's a good idea to ignore things like executable binaries, object files, etc. Pretty much anything that can be regenerated from source.&lt;br /&gt;
&lt;br /&gt;
===Branching and merging===&lt;br /&gt;
A branch is a separate line of development. If you're going to make a bunch of changes related to a single feature, it might be a good idea to make a &amp;quot;topic branch&amp;quot;: a branch related to a topic/feature.&lt;br /&gt;
&lt;br /&gt;
To make a new branch:&lt;br /&gt;
&lt;br /&gt;
 git branch feature_x&lt;br /&gt;
&lt;br /&gt;
To view the current branches:&lt;br /&gt;
&lt;br /&gt;
 git branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  feature_x&lt;br /&gt;
* master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The asterisk (*) shows your current branch. ''master'' is the default branch, like the trunk in CVS or Subversion.&lt;br /&gt;
&lt;br /&gt;
To switch to your new branch, just type:&lt;br /&gt;
&lt;br /&gt;
 git checkout feature_x&lt;br /&gt;
&lt;br /&gt;
If you check the branches again, you'll see the switch:&lt;br /&gt;
&lt;br /&gt;
 git branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* feature_x&lt;br /&gt;
  master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now go through the usual edit/commit cycle. Your changes will go onto the new branch.&lt;br /&gt;
&lt;br /&gt;
When you want to put your branch changes back onto ''master'', first switch to ''master'':&lt;br /&gt;
&lt;br /&gt;
 git checkout master&lt;br /&gt;
&lt;br /&gt;
Then merge the branch changes:&lt;br /&gt;
&lt;br /&gt;
 git merge feature_x&lt;br /&gt;
&lt;br /&gt;
This will combine the changes of the ''master'' and ''feature_x'' branches. If you didn't change the ''master'' branch, git will just &amp;quot;fast-forward&amp;quot; the ''feature_x'' changes so master is up to date. Otherwise, the changes from ''master'' and ''feature_x'' will be combined.&lt;br /&gt;
&lt;br /&gt;
You can see the commit in your project's log:&lt;br /&gt;
&lt;br /&gt;
 git log -n1&lt;br /&gt;
&lt;br /&gt;
If you're happy with the result, and don't need the branch any more, you can delete it:&lt;br /&gt;
&lt;br /&gt;
 git branch -d feature_x&lt;br /&gt;
&lt;br /&gt;
Now when you see the branches, you'll only see the master branch:&lt;br /&gt;
&lt;br /&gt;
 git branch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can make as many branches as you need at once.&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
If you hit a new version of your project, it may be a good idea to mark it with a tag. Tags can be used to easily refer to older commits.&lt;br /&gt;
&lt;br /&gt;
To tag the current version of your project as &amp;quot;v1.4.2&amp;quot;, for example:&lt;br /&gt;
&lt;br /&gt;
 git tag v1.4.2&lt;br /&gt;
&lt;br /&gt;
You can use these tags in places where those 40-character IDs appear.&lt;br /&gt;
&lt;br /&gt;
==What now?==&lt;br /&gt;
git can help with working with other people too. Of course, then you do have to learn about distributed version control. Until then, just enjoy this page.&lt;br /&gt;
&lt;br /&gt;
But if you want to learn:&lt;br /&gt;
&lt;br /&gt;
*	[http://progit.org/book/ Pro Git online book]&lt;br /&gt;
*	[http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html gittutorial manual page online]&lt;br /&gt;
*	[http://www.kernel.org/pub/software/scm/git/docs/everyday.html Everyday git with 20 commands or so]&lt;br /&gt;
*	[http://git-scm.com/ The official git web site]&lt;br /&gt;
&lt;br /&gt;
Main git selling points (ripped off the main site):&lt;br /&gt;
&lt;br /&gt;
*	Distributed development, i.e. working with other people.&lt;br /&gt;
*	Strong support for non-linear development, i.e. working with other people at the same time!&lt;br /&gt;
*	Efficient handling of large projects, i.e. fast!&lt;br /&gt;
*	Cryptographic authentication of history, for the paranoid.&lt;br /&gt;
*	Scriptable toolkit design; you can script pretty much any git task.&lt;br /&gt;
&lt;br /&gt;
If something doesn't seem right or is confusing, contact me at my blog. --tunginobi 07:42, 5 August 2009 (IST)&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Ralph Dratman</name></author>	</entry>

	</feed>