Changes for page Getting Started with Git
Last modified by Bastian Triller on 2013/05/21 17:24
From version 75.1
edited by Bastian Triller
on 2013/05/21 17:24
on 2013/05/21 17:24
Change comment:
There is no comment for this version
To version 91.1
edited by Kieran Kelleher
on 2011/07/27 15:33
on 2011/07/27 15:33
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. btriller1 +XWiki.kieran - Content
-
... ... @@ -3,6 +3,9 @@ 3 3 = Got Git? No? Get Git = 4 4 5 5 * Official Download Site: [[http://git-scm.com/download]] 6 +* Direct Download Links: 7 +** MacOS X [[.dmg Binary Installers>>http://code.google.com/p/git-osx-installer/]] 8 +** Microsoft Windows [[.exe Binary Installers>>http://code.google.com/p/msysgit/]] 6 6 7 7 {{info title="Git is included with XCode 4.x"}} 8 8 ... ... @@ -13,17 +13,13 @@ 13 13 = Learn About Git = 14 14 15 15 * Learn the concepts. 16 -** Scott Chacon (of GitHub) Video Intro [[http://www.youtube.com/watch?v=ZDR433b0HJY]] 17 17 ** [[This>>http://www.eecs.harvard.edu/~~cduan/technical/git/]] is an excellent tutorial on the basic concepts behind Git 18 18 ** [[Git for Computer Scientists>>http://eagain.net/articles/git-for-computer-scientists/]] gives another good view on the underlying concepts 19 -** [[Git For Ages 4 And Up>>https://lca2013.linux.org.au/wiki/Tutorials/Git_For_Ages_4_And_Up]]: video tutorial ([[mp4>>http://mirror.internode.on.net/pub/linux.conf.au/2013/mp4/Git_For_Ages_4_And_Up.mp4]], [[YouTube>>http://www.youtube.com/watch?v=1ffBJ4sVUb4]]) 20 20 * Learn the basics. 21 -** [[Everyday GIT With 20 Commands Or So>>http:// schacon.github.com/git/everyday.html]]22 +** [[Everyday GIT With 20 Commands Or So>>http://www.kernel.org/pub/software/scm/git/docs/everyday.html]] 22 22 ** [[Free Online Pro Git book>>http://progit.org/book/]] 23 -*** There is even a free epub version for your iPad/iPhone [[https://github.s3.amazonaws.com/media/progit.epub]] 24 24 25 25 * Get familiar with the reference materials available online 26 -** [[Git Community Book>>http://book.git-scm.com/]] 27 27 ** Official [[Git Documentation>>http://git-scm.com/documentation]] Site 28 28 ** Official [[Git User Manual>>http://www.kernel.org/pub/software/scm/git/docs/user-manual.html]] 29 29 ** [[Git Reference>>http://gitref.org/index.html]] ... ... @@ -30,6 +30,7 @@ 30 30 31 31 * Git Cheat Sheets 32 32 ** [[http://cheat.errtheblog.com/s/git/]] 32 +** [[http://ktown.kde.org/%7Ezrusin/git/git-cheat-sheet-medium.png]] 33 33 34 34 * [[Linus Torvalds talks about git>>http://www.youtube.com/watch?v=4XpnKHJAok8]] 35 35 Have a Good Laugh here as Linus Torvalds Evangelizes git. //NOTE: This isn't really learning, but it is way more fun and gives you insight into the motivation behind git.// ... ... @@ -42,13 +42,10 @@ 42 42 43 43 = Use Git with a Subversion Project = 44 44 45 -OK, so you want to use Git but you are working on a team project that is hosted in a subversion repository ... and it is making you depressed :-( . Well, you can still use Git to manage your local SVN working copy and be almosthappy again(Either way, you won't be 100% happy unless the repository is a git one.)45 +OK, so you want to use Git but you are working on a team project that is hosted in a subversion repository ... and it is making you depressed :-( . Well, you can still use Git to manage your local SVN working copy and be happy again 46 46 47 - Thereareacouplewaysofdoingthis.Twohem:47 +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]]. 48 48 49 -* Follow these [[Instructions>>http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx]] to manually set up the integration. 50 -* Use [[SourceTree>>http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12]] which can clone your SVN repository locally as a full Git repository including all historical SVN commits and their metadata. 51 - 52 52 = Git Goodies for WebObjects Developers = 53 53 54 54 This is a list of tools that other WebObjects developers have found to be helpful. It's not a comprehensive list, and if you find things not listed here please add them ... ... @@ -72,20 +72,11 @@ 72 72 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: 73 73 [[Git Bash Auto-Completion>>http://progit.org/book/ch2-7.html]] 74 74 75 -=== SourceTree by Atlassian===72 +=== GitX git GUI === 76 76 77 -SourceTree is a free Git/Mercurial GUI for OS X. A key feature is that it can use git-svn to "Clone" a SVN repository into a standard Git repository with your full SVN commit history and maintains a link back to the SVN repository. This allows you to easily use Git locally for development but still do your final commits to SVN. 74 +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. 75 +[[GitX Home Page>>http://gitx.frim.nl/]] 78 78 79 -* [[SourceTree on AppStore>>http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12]] 80 -* [[SourceTree Home Page>>http://www.sourcetreeapp.com/]] 81 - 82 -=== GitX (L) git GUI === 83 - 84 -While most (if not all) Git GUI apps will never be able to emulate all the intricate functionality of Git, one advantage of a GUI app is more convenient and faster browsing/visualization of history and inter-relationships of branches. While development on the original open source GitX.app has waned, this fork of the original has continued to mature into a nice Git client, and is useful for common every day Git operations. 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. 85 -[[GitX (L) Home Page>>http://gitx.laullon.com/]] 86 - 87 -Note this app replaces the original [[GitX>>http://gitx.frim.nl/]] by Pieter de Bie. 88 - 89 89 === Open in GitX === 90 90 91 91 [[Open In GitX Finder Droplet>>http://code.google.com/p/git-osx-installer/wiki/OpenInGitX]] ... ... @@ -97,28 +97,6 @@ 97 97 I use Tower (bought it), but only for committing and fixing merge conflicts. I think Tower misses quite a bit of the flagship feature of GIT: branches. You can't see a branch tree graphically, like you can with gitX or even the command line (git log -graph -color, IIRC). But it's cool for committing. For everything else I use command line. 98 98 Miguel Arroz 99 99 100 -=== Gitolite - A Git Repository Server === 101 - 102 -Need a way to host a few dozen or hundred repositories with dead simple administration? Look no further than the free and open-source [[gitolite>>http://sitaramc.github.com/gitolite/]]. You just need a single dedicated user account on some unix based OS. Once installed and configured, you can perform administration tasks such as adding users, adding repositories and setting fine-grained user access privileges all from your own desktop. 103 - 104 -The best place to start is probably the ProGit chapter on gitolite, which is maintained by the author of gitolite, and is right here: 105 -[[Pro Got Gitolite Chapter>>https://github.com/sitaramc/gitolite/blob/pu/doc/progit-article.mkd]] 106 - 107 -Some tips/gotchas to keep in mind when setting up gitolite 108 - 109 -* Make sure you give the gitolite user ownership of the admin public ssh key after copying the key over 110 -* Rename your public keyname to username.pub, where username is the name you want to use to identify yourself when configuring gitolite access control to repositories. 111 -* During setup, gitolite creates the file /.ssh/authorized//keys in the gitolite user account. Ensure it has permissions of 600. If not change it// 112 -* If other system users such as apache, chiliproject or redmine need [[read access to the gitolite repositories to allow integration>>http://www.giocc.com/public-repositories-in-gitolite-with-umasks.html]], then you probably want to change the $REPO//MASK configuration value from 0077 to 0027 in the [[gitolite configuration file>>http://sitaramc.github.com/gitolite/rc.html]]// 113 - 114 -=== Gitlab - Self hosted Git management software === 115 - 116 -From the [[Gitlab>>http://gitlab.org/]] homepage: 117 - 118 -GitLab is a fast, secure and stable solution to manage your projects. 119 -It is based on Ruby on Rails and has a free and open-source license (MIT). 120 -GitLab is the most installed git management application in the world. 121 - 122 122 = Unique Git Concepts = 123 123 124 124 === Rebasing === ... ... @@ -147,15 +147,13 @@ 147 147 148 148 What if one wants to generate a pull request the origin and also push to a fork? You would do this if you were not a Wonder committer but wanted to share code. You organize your changes in your local repository/branch and, from the clean repository or branch, generate the pull request and, separately, push the changes to your fork. 149 149 150 -=== TestingaPull-Request===116 +=== Versions? or Diffs? === 151 151 152 - It maynot be obvioushowtodothis.Ifoneis acommitter,thereis a buttononecanpush toautomaticallyaccept apull-request.But is thisreallyasafe thingtodo?Buthow canyouget the diffsbeingsuggested?Itseemsmorecomplicatedthanitneedstobetomerge thebranchthepull-requestwas made from.Onecan actuallysea URL that specifies just the diff.Ifthepull-requestsat[[https://github.com/wocommunity/wonder/pull/43]],onecando:118 +One satori that I had is this. Subversion is all about versions. CVS was all about versions. We have been working with these a long time and the ideas are sticky. Git is //not// about versions. It is about diffs. Diffs are the main thing. If you think about it, this makes sense. You have thoughts and make changes and those diffs are the product of your work. If you get those diffs into something, that is good, but the work product was the diffs. 153 153 154 -{{code}} 155 -curl 'https://github.com/wocommunity/wonder/pull/43.patch' | git am 156 -{{/code}} 120 +All this rebasing and such may seem odd. But the main thing is the diffs. I have edits from a two-week old repository. What do I do? I move the diffs so that they are diffs from the latest code. That is a rebase. When we make edits, we are used to being over-concerned about merge conflicts. But they do not happen all that often and are actually easy to deal with when they do, if the tools are oriented to making them easy to deal with. If we are worrying about the versions and not the diffs, we are paying attention to the paper we write on and not to the words we are putting down. 157 157 158 - The curlfetches thediff.Take offthe"git am"tojustsee thediffs.The"gitam"merges the diffs. Thenyoumaybuildand test the pull-request.Anormalpushwill push thecode into the repository.122 +Internally, git keeps track of text fragments and not files. Why is this? Because the versions are not the point. The diffs are. I can imagine how Linus Torvalds had this idea. He was looking at all the versions of all the files in Linux and all the e-mails of all the diffs. These are two separate worlds. It is conceptually painful to look at every diff, find its source and see how it maps to what now exists. At some point, he must have realized that all he needed was the e-mails. If he had no files any longer, but all the e-mails, he could always reconstruct the files. He would not have to make the conceptual switch from the diffs to the versions and back. Collectively, those e-mails with the diffs defined everything that needed to be said. Quod erat demonstrandum. 159 159 160 160 === How Easy Are Branches? === 161 161 ... ... @@ -165,10 +165,6 @@ 165 165 166 166 Keep in mind that the difficult part of what you do should be the thinking. Git makes it easy to organize and share your thoughts as branches. Your local copies may be messy or not. They are the thoughts you have in your head and lots of those thoughts will stay there and never see the light of day and that is ok. But when you have clarified your thoughts, git will make it easy to share them. 167 167 168 -=== Finding the List of All Git Commands === 169 - 170 -The "git help" command gives one the list of commonly used git commands. How does one find the others, since some of them turn out to be very useful? I tried "git help v". That was wrong. It would have been better to try "git help help", but this did tell me about the -all flag, which actually lists out all of the commands, and there are quite a few of them. So, good hunting. 171 - 172 172 = Git Everyday Tasks = 173 173 174 174 === How to revert? === ... ... @@ -180,19 +180,3 @@ 180 180 git reset --hard 181 181 182 182 {{/code}} 183 - 184 -=== Stash to Clean and Checkout from Stash to Work === 185 - 186 -Say that you have several different things going on in your project at any one time. How can you seperate them to check something in? You know about the "git stash" command, which cleans up your project. But what if you want part of the dirtiness, but not all of it? 187 - 188 -Suppose you have file1.java, file2.java, file3.java, and file4.java. You have a single feature implemented in file1.java and file3.java and those edits stand on their own. If you are going to check in just file1.java and file3.java, you should test them on their own, without your other changes. First, do a "git stash". A "git status" will show you have no staged changes. Now do: 189 - 190 -{{code}} 191 - 192 -git checkout stash@{0} -- file1.java 193 -git checkout stash@{0} -- file3.java 194 - 195 -{{/code}} 196 - 197 -Now you have your two files and not the others and you can build and test them in a clear project before you check them in 198 -One odd thing I noticed is this. The "git diff" you were doing before the stash will show your changes. Now you have to do "git diff HEAD". Not completely sure why, but there it is.