|
|
(59 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
− | [[Image:Git-Logo-2Color.png|center|thumb|Git]] | + | [[Image:Git-Icon.png|center|Git]] |
| + | ==GLM Git Guide== |
| + | [[The Great GLM Git Guide]] |
| + | |
| ==Git Docs== | | ==Git Docs== |
| + | [http://try.github.com/ Try git tutorial] |
| + | |
| [http://git-scm.com/book Git Pro Book] | | [http://git-scm.com/book Git Pro Book] |
| | | |
Line 7: |
Line 12: |
| [http://www.atlassian.com/git/workflows#!workflow-gitflow Git Flow Workflow] | | [http://www.atlassian.com/git/workflows#!workflow-gitflow Git Flow Workflow] |
| | | |
− | ==Install==
| + | [http://www.atlassian.com/git/tutorial/remote-repositories#!pull git pull --rebase] |
− | [[Installing Git]] | + | |
| | | |
− | ==Git for the first time== | + | ==Installation & Initial Setup== |
− | [[Setting up Git for the first time]] | + | [[Git Installation & Initial Setup]] |
| | | |
− | == Git Ignore File == | + | ==Setup ssh-agent== |
− | create a file called .gitignore_global in you home directory
| + | [[ssh-agent on windows(git bash)]] |
− | <pre>
| + | |
− | # OS generated files #
| + | |
− | ######################
| + | |
− | .DS_Store*
| + | |
− | ehthumbs.db
| + | |
− | Icon?
| + | |
− | Thumbs.db
| + | |
− | ._*
| + | |
− | *.swp
| + | |
− | | + | |
− | # Gaslight Media Application specific #
| + | |
− | # files that are updated on server #
| + | |
− | #######################################
| + | |
− | iconCache/
| + | |
− | uploads/
| + | |
− | cache/
| + | |
− | compiled/
| + | |
− | compile/
| + | |
− | original/
| + | |
− | resized/
| + | |
− | midsized/
| + | |
− | thumb/
| + | |
− | thumbs/
| + | |
− | ht_images/
| + | |
− | photo-large/
| + | |
− | photo-small/
| + | |
− | prototype/
| + | |
− | weather-feed.xml
| + | |
− | php.error
| + | |
− | reports/
| + | |
− | editimagesworkwith/
| + | |
− | editimagesoriginal/
| + | |
− | editedImages/
| + | |
− | editimagespng/
| + | |
− | .buildpath
| + | |
− | .settings
| + | |
− | .project
| + | |
− | .svn
| + | |
− | nbproject
| + | |
− | </pre>
| + | |
− | | + | |
− | ==SSH Keys==
| + | |
− | [[Creating your ssh keys (private/public)]] | + | |
| | | |
| ==Git-Svn== | | ==Git-Svn== |
Line 65: |
Line 26: |
| | | |
| ==Gitolite== | | ==Gitolite== |
− | [[Creating a new Git repo]] | + | [[The Great GLM Git Guide#Creating a new Git repo|Creating a new Git repo]] |
| | | |
| ==gpg signing== | | ==gpg signing== |
− | [[How to sign your commit or tags]]
| + | If you’re making signed annotated tags (as discussed in Chapter 2 of Git Pro), setting your GPG signing key as a configuration setting makes things easier. Set your key ID like so: |
| | | |
− | ==Reference==
| + | git config --global user.signingkey <gpg-key-id> |
− | git book online
| + | |
− | http://git-scm.com/book
| + | |
| | | |
− | ==Git Flow Process (example)== | + | ==Git New Website Setup Checklist== |
− | This is merely an example. Things may not always follow this line of commands exactly.
| + | [[The Great GLM Git Guide#Git New Website Setup Checklist|Git New Website Setup Checklist]] |
| | | |
− | (0. '''ssh-add''')
| + | == Git Flow == |
| + | [[The Great GLM Git Guide#Git Flow|Git Flow]] |
| | | |
− | 1. '''git clone git@cvs2:web/mywebsite.git www.mywebsite.com''' (like SVN checkout)
| + | == Git home config file == |
| + | [[The_Great_GLM_Git_Guide#Git_home_config_file| Git home config file]] |
| | | |
− | 2. '''cd www.mywebsite.com'''
| + | == Git Ignore File == |
| + | [[The_Great_GLM_Git_Guide#Git_ignore_file|Git Ignore File Setup]] |
| | | |
− | 3. '''git flow init''' (master, develop, feature, release, hotfix, support, V (only change from default) - this should only be necessary -once- the very first time anyone sets up the repository for the website)
| + | ==SSH Keys== |
| + | [[Creating your ssh keys (private/public)]] |
| | | |
− | 4. '''git branch -av''' (shows what branch you are on, as well as the branches that exist both locally and remotely)
| + | ==Reference== |
− | | + | git book online |
− | 5. '''git checkout develo'''p (unnecessary, but UNLIKE SVN this merely changes the branch you're currently on to ''Develop'')
| + | http://git-scm.com/book |
− | | + | |
− | 6. '''git flow hotfix start 1.0.3''' (this creates the hotfix branch called 1.0.3)<br/>
| + | |
− | (*. or: '''git flow feature start AwesomeFeature''')
| + | |
− | | + | |
− | -- start up your favorite editor and make whatever changes to whichever project/files you please --
| + | |
− | | + | |
− | 7. '''git status''' (will show you all changed files)
| + | |
− | | + | |
− | 8. '''git add''' . (will make all files in all folders in the current directory ready for committing)<br/>
| + | |
− | (*. or to add a single file: ''git add .htaccess'')
| + | |
− | | + | |
− | 9. '''git commit''' (will commit changes to the main branch)<br/>
| + | |
− | (*. oops! Forgot a change/file? It's not too late to add: '''git commit --amend''' )
| + | |
− | | + | |
− | 10. liberal use of '''git status'''. This will also show the command '''git reset HEAD -- .gitignore.whatever''' to remove something you '''git add'''-ed (also works on folders)
| + | |
− | | + | |
− | 11. '''git flow hotfix finish '1.0.3'''' (this will bring you back to the develop branch and delete the hotfix branch after it merges its changes. Make note of your edits!)
| + | |
− | | + | |
− | (*. '''git flow feature publish someFeature''' is another example, though '''publish''' doesn't remove the branch, it merely does the merge) <br/>
| + | |
− | (*. Git may at some point complain about the fact that there are changes to wherever you're trying to commit/push to. It's merely a matter of doing '''git pull origin develop''' (where origin is the name of the branch you're taking it from, and develop is the branch you're taking it to) so that you're up-to-date!)<br/>
| + | |
− | (*. '''git pull''' is a two-step process: '''git fetch''' takes it from the main repository onto your ''remotes'' branch, then '''git merge''' takes it from there to whatever branch you indicated (where you're likely working from) <br/>
| + | |
− | (*. This is also when you may realize you didn't yet start a branch, and you've already made changes. Have a look at '''git stash''', which will essentially put all changes into a separate stash. Then '''git flow feature start awesomeFeature''', which should put you on that branch, then do '''git stash pop''' to drop the stash onto that branch, after which the branch can be finished or published as noted above)
| + | |
− | | + | |
− | 10. '''git branch -av''' (to make sure you're on the branch you're meant to be)
| + | |
− | | + | |
− | 11. '''git push origin develop''' (send changes to the remote main branch - TO origin FROM develop)<br/>
| + | |
− | (*. '''git push --all''' is an alternative though it may be safer to be precise. This must be followed by '''git push --tags''')
| + | |
− | | + | |
− | 12. '''gitk''' to marvel at a graphical representation of the good you've done today
| + | |
− | | + | |
− | 13. '''ssh ws6''' (or dev53 or whatever server), then '''cd /var/www/server/www.myweb'''~
| + | |
− | | + | |
− | 14. '''git pull origin develop''' (this command may also be used on your own server kind of like ''svn checkout'', instead of cloning at step 1) <br/>
| + | |
− | (*. on WS6 you use '''git pull origin ''master''''' instead, since it only has a master branch)
| + | |
If you’re making signed annotated tags (as discussed in Chapter 2 of Git Pro), setting your GPG signing key as a configuration setting makes things easier. Set your key ID like so: