Changes for page Getting Started with Git
Last modified by Bastian Triller on 2013/05/21 17:24
From version 218.2
edited by Bastian Triller
on 2013/05/21 17:24
on 2013/05/21 17:24
Change comment:
Changed document parent to [xwiki:WEB.Home.Getting Started.WebHome].
To version 216.1
edited by Bastian Triller
on 2013/04/21 15:06
on 2013/04/21 15:06
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,1 +1,0 @@ 1 -WEB.Home.Getting Started.WebHome - Content
-
... ... @@ -1,62 +1,64 @@ 1 -{{toc/}} 1 +{{toc}}{{/toc}} 2 2 3 -= Got Git? No? Get Git !=3 += Got Git? No? Get Git = 4 4 5 -* Official Download Site: [[http: ~~/~~/git-scm.com/download>>url:http://git-scm.com/download||shape="rect"]]5 +* Official Download Site: [[http://git-scm.com/download]] 6 6 7 7 {{info title="Git is included with XCode 4.x"}} 8 + 8 8 XCode 4.x installs a copy of git in /usr/bin/git 10 + 9 9 {{/info}} 10 10 11 11 = Learn About Git = 12 12 13 13 * Learn the concepts. 14 -** Scott Chacon (of GitHub) Video Intro [[http: ~~/~~/www.youtube.com/watch?v=ZDR433b0HJY>>url:http://www.youtube.com/watch?v=ZDR433b0HJY||shape="rect"]]15 -** [[This>> url:http://www.eecs.harvard.edu/~~cduan/technical/git/||shape="rect"]] is an excellent tutorial on the basic concepts behind Git16 -** [[Git for Computer Scientists>> url:http://eagain.net/articles/git-for-computer-scientists/||shape="rect"]] gives another good view on the underlying concepts17 -** [[Git For Ages 4 And Up>> url:https://lca2013.linux.org.au/wiki/Tutorials/Git_For_Ages_4_And_Up||shape="rect"]]: video tutorial ([[mp4>>url:http://mirror.internode.on.net/pub/linux.conf.au/2013/mp4/Git_For_Ages_4_And_Up.mp4||shape="rect"]], [[YouTube>>url:http://www.youtube.com/watch?v=1ffBJ4sVUb4||shape="rect"]])16 +** Scott Chacon (of GitHub) Video Intro [[http://www.youtube.com/watch?v=ZDR433b0HJY]] 17 +** [[This>>http://www.eecs.harvard.edu/~~cduan/technical/git/]] is an excellent tutorial on the basic concepts behind Git 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]]) 18 18 * Learn the basics. 19 -** [[Everyday GIT With 20 Commands Or So>> url:http://schacon.github.com/git/everyday.html||shape="rect"]]20 -** [[Free Online Pro Git book>> url:http://progit.org/book/||shape="rect"]]21 -*** There is even a free epub version for your iPad/iPhone ![[https:~~/~~/github.s3.amazonaws.com/media/progit.epub>>url:https://github.s3.amazonaws.com/media/progit.epub||shape="rect"]]21 +** [[Everyday GIT With 20 Commands Or So>>http://schacon.github.com/git/everyday.html]] 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]] 22 22 23 23 * Get familiar with the reference materials available online 24 -** [[Git Community Book>> url:http://book.git-scm.com/||shape="rect"]]25 -** Official [[Git Documentation>> url:http://git-scm.com/documentation||shape="rect"]] Site26 -** Official [[Git User Manual>> url:http://www.kernel.org/pub/software/scm/git/docs/user-manual.html||shape="rect"]]27 -** [[Git Reference>> url:http://gitref.org/index.html||shape="rect"]]26 +** [[Git Community Book>>http://book.git-scm.com/]] 27 +** Official [[Git Documentation>>http://git-scm.com/documentation]] Site 28 +** Official [[Git User Manual>>http://www.kernel.org/pub/software/scm/git/docs/user-manual.html]] 29 +** [[Git Reference>>http://gitref.org/index.html]] 28 28 29 29 * Git Cheat Sheets 30 -** [[http: ~~/~~/cheat.errtheblog.com/s/git/>>url:http://cheat.errtheblog.com/s/git/||shape="rect"]]32 +** [[http://cheat.errtheblog.com/s/git/]] 31 31 32 -* [[Linus Torvalds talks about git>> url:http://www.youtube.com/watch?v=4XpnKHJAok8||shape="rect"]]33 - 34 +* [[Linus Torvalds talks about git>>http://www.youtube.com/watch?v=4XpnKHJAok8]] 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.// 34 34 35 -= Get Started with Project Wonder !=37 += Get Started with Project Wonder = 36 36 37 -The best way to learn a new concept is to actually use it, and what better way than to do something practical like clone the Project Wonder git source code repository !39 +The best way to learn a new concept is to actually use it, and what better way than to do something practical like clone the Project Wonder git source code repository 38 38 39 -* [[Downloading Wonder>> url:http://wiki.objectstyle.org/confluence/display/WONDER/Getting+the+Wonder+Source+Code||shape="rect"]] Wiki Page41 +* [[Downloading Wonder>>http://wiki.objectstyle.org/confluence/display/WONDER/Getting+the+Wonder+Source+Code]] Wiki Page 40 40 41 41 = Use Git with a Subversion Project = 42 42 43 -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 almost happy 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 almost happy again (Either way, you won't be 100% happy unless the repository is a git one.) 44 44 45 45 There are a couple ways of doing this. Two of them are: 46 46 47 -* Follow these [[Instructions>> url:http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx||shape="rect"]] to manually set up the integration.48 -* Use [[SourceTree>> url:http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12||shape="rect"]] which can clone your SVN repository locally as a full Git repository including all historical SVN commits and their metadata.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. 49 49 50 50 = Git Goodies for WebObjects Developers = 51 51 52 -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 !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 53 53 54 54 === EGit === 55 55 56 56 EGit is a plugin for Eclipse 3.6. It's not as good as Tower or GitX, but you can use it for most tasks (add, commit, push, pull). 57 57 58 -* [[EGit/Git For Eclipse Users>> url:http://wiki.eclipse.org/EGit/Git_For_Eclipse_Users||shape="rect"]]59 -* [[User Guide>> url:http://wiki.eclipse.org/EGit/User_Guide||shape="rect"]]60 +* [[EGit/Git For Eclipse Users>>http://wiki.eclipse.org/EGit/Git_For_Eclipse_Users]] 61 +* [[User Guide>>http://wiki.eclipse.org/EGit/User_Guide]] 60 60 * Installation 61 61 *1. In Eclipse, select //Help > Install New Sofware...// 62 62 *1. Select the "Helios" download site from the Work with: combo box ... ... @@ -68,54 +68,54 @@ 68 68 === Git Bash Completion === 69 69 70 70 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: 71 - url:http://progit.org/book/ch2-7.html||shape="rect"]]73 +[[Git Bash Auto-Completion>>http://progit.org/book/ch2-7.html]] 72 72 73 73 === SourceTree by Atlassian === 74 74 75 75 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. 76 76 77 -* [[SourceTree on AppStore>> url:http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12||shape="rect"]]78 -* [[SourceTree Home Page>> url:http://www.sourcetreeapp.com/||shape="rect"]]79 +* [[SourceTree on AppStore>>http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12]] 80 +* [[SourceTree Home Page>>http://www.sourcetreeapp.com/]] 79 79 80 80 === GitX (L) git GUI === 81 81 82 82 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. 83 - url:http://gitx.laullon.com/||shape="rect"]]85 +[[GitX (L) Home Page>>http://gitx.laullon.com/]] 84 84 85 -Note this app replaces the original [[GitX>> url:http://gitx.frim.nl/||shape="rect"]] by Pieter de Bie.87 +Note this app replaces the original [[GitX>>http://gitx.frim.nl/]] by Pieter de Bie. 86 86 87 87 === Open in GitX === 88 88 89 -[[Open In GitX Finder Droplet>> url:http://code.google.com/p/git-osx-installer/wiki/OpenInGitX||shape="rect"]]91 +[[Open In GitX Finder Droplet>>http://code.google.com/p/git-osx-installer/wiki/OpenInGitX]] 90 90 91 91 === Git Tower === 92 92 93 -[[Git Tower>> url:http://www.git-tower.com/||shape="rect"]] is a commerical app for those of you who just get panic attacks at the thought of using the Terminal.95 +[[Git Tower>>http://www.git-tower.com/]] is a commerical app for those of you who just get panic attacks at the thought of using the Terminal. 94 94 95 - >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.96 - >-Miguel Arroz97 +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 + Miguel Arroz 97 97 98 98 === Gitolite - A Git Repository Server === 99 99 100 -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>> url:http://sitaramc.github.com/gitolite/||shape="rect"]]. 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.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. 101 101 102 102 The best place to start is probably the ProGit chapter on gitolite, which is maintained by the author of gitolite, and is right here: 103 - url:https://github.com/sitaramc/gitolite/blob/pu/doc/progit-article.mkd||shape="rect"]]105 +[[Pro Got Gitolite Chapter>>https://github.com/sitaramc/gitolite/blob/pu/doc/progit-article.mkd]] 104 104 105 105 Some tips/gotchas to keep in mind when setting up gitolite 106 106 107 -* Make sure you give the gitolite user ownership of the admin public ssh key after copying the key over !109 +* Make sure you give the gitolite user ownership of the admin public ssh key after copying the key over 108 108 * 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. 109 -* During setup, gitolite creates the file ~~/.ssh/authorized_keys in the gitolite user account. Ensure it has permissions of 600. If not change it!110 -* If other system users such as apache, chiliproject or redmine need [[read access to the gitolite repositories to allow integration>> url:http://www.giocc.com/public-repositories-in-gitolite-with-umasks.html||shape="rect"]], then you probably want to change the $REPO_MASK configuration value from 0077 to 0027 in the [[gitolite configuration file>>url:http://sitaramc.github.com/gitolite/rc.html||shape="rect"]]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]]// 111 111 112 112 === Gitlab - Self hosted Git management software === 113 113 114 -From the [[Gitlab>> url:http://gitlab.org/||shape="rect"]] homepage:116 +From the [[Gitlab>>http://gitlab.org/]] homepage: 115 115 116 116 GitLab is a fast, secure and stable solution to manage your projects. 117 - 118 - 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. 119 119 120 120 = Unique Git Concepts = 121 121 ... ... @@ -129,17 +129,17 @@ 129 129 130 130 However before using it on work that is shared with others you MUST follow the these rules, otherwise you will screw everyone else on the project. 131 131 132 -* If you don't understand rebasing, don't use it !You can learn more about it here:133 -** [[http: ~~/~~/progit.org/book/ch3-6.html>>url:http://progit.org/book/ch3-6.html||shape="rect"]]134 -** [[http: ~~/~~/www.eecs.harvard.edu/~~~~cduan/technical/git/git-5.shtml>>url:http://www.eecs.harvard.edu/~~cduan/technical/git/git-5.shtml||shape="rect"]]135 -** [[http: ~~/~~/book.git-scm.com/4_rebasing.html>>url:http://book.git-scm.com/4_rebasing.html||shape="rect"]]136 -** [[http: ~~/~~/blip.tv/file/4094727>>url:http://blip.tv/file/4094727||shape="rect"]]137 -* Use rebase only on **private** branches !134 +* If you don't understand rebasing, don't use it You can learn more about it here: 135 +** [[http://progit.org/book/ch3-6.html]] 136 +** [[http://www.eecs.harvard.edu/~~cduan/technical/git/git-5.shtml]] 137 +** [[http://book.git-scm.com/4_rebasing.html]] 138 +** [[http://blip.tv/file/4094727]] 139 +* Use rebase only on **private** branches 138 138 * Use rebase only for commits that have **not been pushed** to a remote repo 139 139 140 140 === Push/Pull vs Commit/Update === 141 141 142 -It may be helpful to separate "push/pull" in your mind from "commit/update". Say that I have a bunch of changes that I want to (% style="text-decoration: line-through;" %)commit to Wonder(%%)share with the community. I am not going to push my changes. I am going to check in my changes to my repository (either a clone or a fork) and then push from my repository or generate a pull request from my repository. My repository should be fully checked in before I do this.144 +It may be helpful to separate "push/pull" in your mind from "commit/update". Say that I have a bunch of changes that I want to --commit to Wonder-- share with the community. I am not going to push my changes. I am going to check in my changes to my repository (either a clone or a fork) and then push from my repository or generate a pull request from my repository. My repository should be fully checked in before I do this. 143 143 144 144 Say that I do not want to check in all of the changes I am looking at. The answer seems to be that you create a branch, take the changes you want to share, commit them and then share from that branch. And, again, before one generates the pull request or does the push, the branch should be clean and all changes in it should be committed. 145 145 ... ... @@ -147,10 +147,10 @@ 147 147 148 148 === Testing a Pull-Request === 149 149 150 -It may not be obvious how to do this. If one is a committer, there is a button one can push to automatically accept a pull-request. But is this really a safe thing to do? But how can you get the diffs being suggested? It seems more complicated than it needs to be to merge the branch the pull-request was made from. One can actually use a URL that specifies just the diff. If the pull-request is at [[https: ~~/~~/github.com/wocommunity/wonder/pull/43>>url:https://github.com/wocommunity/wonder/pull/43||shape="rect"]], one can do:152 +It may not be obvious how to do this. If one is a committer, there is a button one can push to automatically accept a pull-request. But is this really a safe thing to do? But how can you get the diffs being suggested? It seems more complicated than it needs to be to merge the branch the pull-request was made from. One can actually use a URL that specifies just the diff. If the pull-request is at [[https://github.com/projectwonder/wonder/pull/43]], one can do: 151 151 152 152 {{code}} 153 -curl 'https://github.com/ wocommunity/wonder/pull/43.patch' | git am155 +curl 'https://github.com/projectwonder/wonder/pull/43.patch' | git am 154 154 {{/code}} 155 155 156 156 The curl fetches the diff. Take off the "git am" to just see the diffs. The "git am" merges the diffs. Then you may build and test the pull-request. A normal push will push the code into the repository. ... ... @@ -159,13 +159,13 @@ 159 159 160 160 It may be helpful to realize this. You should become comfortable with branching. In svn, branching is hard but it is not hard in git. If you have a thought, mull over that thought for a few minutes and jot something down, you have done enough to justify a branch and the branch will be not much harder than finding the post-its on your desk, and perhaps easier. Think about when you would have created a branch in svn. For that amount of work and to establish that level of separation, in git you would create a fork, or create a new repository. 161 161 162 -Might you end up with too many branches? Perhaps. How messy is your desk? If you are a clean-desk person, you will probably not have too many branches. You will organize and combine your branches. You will rebase your branches. You may delete your branches. After all, you had the thought. You can write the code again. If it is too distracting to keep the branch relevant, tuck the thought into the back of your head, delete the branch, let it go and move on. If you are a messy-desk person, you will probably have lots of branches. It would probably be a good thing to clean up, merge and rebase your branches before you try to share your changes. But that is obvious. Nobody wants to see how messy your desk is. 164 +Might you end up with too many branches? Perhaps. How messy is your desk? If you are a clean-desk person, you will probably not have too many branches. You will organize and combine your branches. You will rebase your branches. You may delete your branches. After all, you had the thought. You can write the code again. If it is too distracting to keep the branch relevant, tuck the thought into the back of your head, delete the branch, let it go and move on. If you are a messy-desk person, you will probably have lots of branches. It would probably be a good thing to clean up, merge and rebase your branches before you try to share your changes. But that is obvious. Nobody wants to see how messy your desk is. 163 163 164 164 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. 165 165 166 166 === Finding the List of All Git Commands === 167 167 168 -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.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. 169 169 170 170 = Git Everyday Tasks = 171 171 ... ... @@ -192,5 +192,5 @@ 192 192 193 193 {{/code}} 194 194 195 -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 !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.