Changes for page Getting Started with Git
Last modified by Bastian Triller on 2013/05/21 17:24
From version 132.1
edited by Kieran Kelleher
on 2011/03/21 15:08
on 2011/03/21 15:08
Change comment:
There is no comment for this version
To version 165.1
edited by Kieran Kelleher
on 2011/04/01 15:07
on 2011/04/01 15:07
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,21 +1,40 @@ 1 += Got Git? If not, Get Git here = 2 + 3 +[[OS X dmg Installer>>http://code.google.com/p/git-osx-installer/]] 4 + 1 1 = Learning About git = 2 2 3 -[[Free Online Pro Git book>>http://progit.org/book/]] 4 -[[Git User Manual>>http://www.kernel.org/pub/software/scm/git/docs/user-manual.html]] 5 -[[Git Reference>>http://gitref.org/index.html]] 7 +Start here: 6 6 7 - =InstallGit=9 +* [[Excellent Concept Tutorial on Git>>http://www.eecs.harvard.edu/~~cduan/technical/git/]] 8 8 9 - [[OSXdmgInstaller>>http://code.google.com/p/git-osx-installer/]]11 +Have a Good Laugh here as Linus Torvalds Evangelizes git: 10 10 13 +* [[Linus Torvalds talks about git>>http://www.youtube.com/watch?v=4XpnKHJAok8]] 14 + 15 +Learn the basics here: 16 + 17 +* [[Everyday GIT With 20 Commands Or So>>http://www.kernel.org/pub/software/scm/git/docs/everyday.html]] 18 +* [[Free Online Pro Git book>>http://progit.org/book/]] 19 + 20 +Get the Detailed Reference Materials Here: 21 + 22 +* [[Git User Manual>>http://www.kernel.org/pub/software/scm/git/docs/user-manual.html]] 23 +* [[Git Reference>>http://gitref.org/index.html]] 24 + 11 11 = Git Goodies = 12 12 13 -== Git XgitGUI==27 +=== Git Bash Completion === 14 14 29 +This is really an absolute necessity and a **huge** productivity improvement. Basically you need the bash completion script from the source tarball and use your shell profile to include it whenever you open a shell. See the **Auto-Completion** section on this page: 30 +[[Git Bash Auto-Completion>>http://progit.org/book/ch2-7.html]] 31 + 32 +=== GitX git GUI === 33 + 15 15 GitX is an awesome FREE history viewer made for OS X. It is a better way to visualize your branch and commit history of your git repository. However, power users (aka "cool kids") will probably only use it for history viewing while they continue to use the terminal command line for checkouts, branching, staging, rebasing and committing. 16 16 [[GitX Home Page>>http://gitx.frim.nl/]] 17 17 18 -== Open in GitX == 37 +=== Open in GitX === 19 19 20 20 [[Open In GitX Finder Droplet>>http://code.google.com/p/git-osx-installer/wiki/OpenInGitX]] 21 21 ... ... @@ -28,7 +28,7 @@ 28 28 29 29 OK, so you are addicted to git, and now you have to work on a team project that is hosted in a remote subversion repository ... and it is making you depressed :-(. Well, you can use manage your local svn working copy using git and be happy again! 30 30 31 - Don't use thegit-svntool, just use the [[git+svn protocol>>http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx]] instead.50 +There is a git-svn tool (type man git-svn in the terminal for details), but that adds yet another tool into the mix that you have to learn. So while you could use it and YMMV for projects tht are going to be on svn forever, I recommend you just use the [[git+svn protocol>>http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx]] instead, especially if you are typically working on one particular branch of the remote svn repository. 32 32 33 33 = I want to learn git before I switch from Subversion = 34 34 ... ... @@ -37,8 +37,76 @@ 37 37 38 38 [[**git+svn** Working Protocol>>http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx]] 39 39 40 -When you first learn about git and you google "git svn" you will learn about a command line tool git-svn which works directly with remote svn repos ,howevermyadviceis don'tusegit-svn. Use the **git+svn** approach outlined in above blog post instead.59 +When you first learn about git and you google "git svn" you will learn about a command line tool git-svn which works directly with remote svn repos. Unless you want to use git locally to switch between svn branches, I don't recommend it. Use the **git+svn** approach outlined in above blog post instead. 41 41 42 42 Once you start using git, it becomes addictive ....... you can never go back ...... really, it's that good ...... and it is not hard. 43 43 44 -For Eclipse setup when using git locally on svn working copies, just check out the entire svn branch on the command line, then LINK (import no copy) the projects you want in your workspace using the Subclipse import tool, and just do your git operations (status, staging, commit, diff, branching, checkouts, rebase and merge using the terminal). git on the terminal is efficient... honest. 63 +Some tips for Eclipse setup and general workflow when using git locally on svn working copies, 64 + 65 +* check out the entire svn branch that you work on using the command line, then LINK (import no copy) the projects you want in your workspace using the Subclipse import tool, and 66 +* Do your git operations (status, staging, commit, diff, branching, checkouts, rebase and merge using the terminal). git on the terminal is efficient... honest. 67 +* Do all your local work and cimmits on branches other than the master branch. 68 +* Switch to master branch to update from svn and commit those svn updates on the master branch. 69 +* Merge your working branch(es) with or rebase your working branch(es) from the master and just keep on working. 70 +* Switch to master branch before synchronizing with remote svn repo. 71 +* You can use ##git stash## to temporarily put aside your uncommitted changes before doing an svn update. Then use ##git stash pop## to replay those uncommitted changes onto the working copy. 72 + 73 +{{code title="Mechanics of an svn update operation on a git-managed svn working copy"}} 74 + 75 + 76 +# Assume you are currently on a working branch. Verify this and check for uncommitted changes. 77 +git status 78 + 79 +# Either commit your local changes to your working branch 80 +# using 'git add' + 'git commit', or temporarily stash 81 +# them using 'git stash' 82 +git stash 83 + 84 +# Switch to master branch 85 +git checkout master 86 + 87 +# Ensure there are no changes either from an svn perspective 88 +# or a git perspective on the master branch. 89 +git status 90 +svn status 91 + 92 +# Update the master branch from remote svn repo 93 +svn update 94 + 95 +# Commit those updates to git repo 96 +git commit -a -m "updated from remote svn repo" 97 + 98 +# Switch to your working branch 99 +git checkout workingbranch 100 + 101 +# Merge or rebase your working branch off of the updated master. 102 +# This rewinds your branch commits back to the common commit ancestor 103 +# shared between your working branch and the master branch. Then it 104 +# applies the master branch commits (the svn updates) so that this 105 +# working branch becomes identical to the master. After that it 'replays' 106 +# your working branch commits on top of the updated branch. 107 +# This ensures a clean linear progression. Rebasing is a very cool feature of git. 108 +rebase master 109 + 110 +# Now if you stashed uncommitted changes earlier, you can pop them back into 111 +# the working copy 112 +git stash pop 113 + 114 +{{/code}} 115 + 116 +{{code title="Mechanics of an svn commit operation from a git-managed svn working copy"}} 117 + 118 +# First perform an svn update as outlined above in the previous section 119 + 120 +# Switch to the master branch 121 +git checkout master 122 + 123 +# Merge your working branch with the master 124 +git merge workingbranch 125 + 126 +# Use svn status, svn add and svn commit to commit your changes to the remote svn repository 127 + 128 +# Switch back to your workingbranch and get back to work. 129 + 130 + 131 +{{/code}}