GitOverview

advertisement
Quick Guide To Git & Wiki
Why We Need Version Control
• Group projects
– Prevents loss of code when trying to merge
versions
– Allows
• Individual projects
– Create a branch during debugging to keep track of
changes and avoid accidental introduction of
errors
– Defines a central version of the code when
working in multiple locations
Installing it on your Mac
• If you have Snow Leopard or Lion (10.6 or
newer):
– http://git-scm.com/
• If you have Mac OS 10.5 or older:
– http://code.google.com/p/git-osxinstaller/downloads/detail?name=git-1.7.5.4-i386leopard.dmg&can=2 http://code.google.com/p/gitosx-installer/downloads/detail?name=git-1.7.5.4x86_64-leopard.dmg&can=2
– Check your hardware: second link requires 64-bit chip
Initialize
Clone
Working
Directory
A
Main
Branch
How the Git Server Works
Edit
Clone
Initialize
Error: Version
Conflict
Pull
Edit
Clone
Working
Directory
B
Working
Directory
A
Main
Branch
How the Git Server Works
Edit
Initializing a Git Repository
• Init
– Creates a /.git object in the current directory
– To create a shared git
• git init –shared foo.git
• chgrp –R groupname foo.git
• Add
– This does not commit the files to the git, just adds files to
the list of tracked objects
– Standard Linux trick apply, e.g. git add *.py will add all
Python files in the current directory
• Push
– Used to import an old repository into a new one
Global Configuration Steps
• Set your name and email for the tracking logs:
– git config –global user.name “Your Name”
– git config –global user.email you@example.com
Getting Code from the Git Repo
• Clone: git clone ssh://user@server:project.git
– Unlike “checkout” used by other programs, creates a
complete duplicate of the code
– Easier for multiple people to work on the same file
simultaneously
• Pull
– Allows you to look at someone else’s code without
committing changes to the central version
– For multiple users, copies any commits that have been
made since you last cloned to your clone before you
can merge back to the main branch
EXAMPLE: git clone ssh://titicaca.engin.umich.edu/home/code/GAS.git
Making Changes in the Git
• Status
– Checking which files have been modified/added
– Identifies what’s been modified and staged
• Staging
• Branching
• Creates new branch, great for debugging
Committing to Change
• Commiting
– Initial commit defines the main branch of the code
• git commit –a both adds and commits a file to the main branch
– Later commits merge changes from branches into the main code
• Must include a commit message!
Getting Help for Git
• http://ftp.newartisans.com/pub/git.from.bott
om.up.pdf
• http://www.kernel.org/pub/software/scm/git/
docs/gittutorial.html
• http://git-scm.com/documentation
Graphical Interfaces
• http://git-cola.github.com/
• http://sourceforge.net/projects/qgit/
• More comprehensive list:
https://git.wiki.kernel.org/index.php/Interface
sFrontendsAndTools#Web_Interface
Wiki 101
• Create an account
– Have Katie or Mike log in as WikiSysop
– Go to
http://titicaca.engin.umich.edu/mediawiki/index.php/
Special:UserLogin
Click this
Change this
Fill out the form
• You will get an error about the email address: still
working out why, but your account will be set up!
Navigating Wiki Editing
• To create a header: ==Header
Text==
– More ‘=‘ demotes the heading
in the outline (e.g., Section 3
to Section 2.1)
• Formatting basics:
–
–
–
–
–
‘’italic’’
‘’’bold’’’
‘’’’bold & italic’’’’
<strike> text </strike>
<nowiki> ignores wiki
‘’markup’’ </nowiki>
– * bullet
– ** indented bullet
• HTML symbols
• Still sorting out math libraries
http://www.mediawiki.org/wiki/Help:Formatting
Creating New Pages/ Linking
• To create a new page in the Wiki, you have to
create a link to it from somewhere else
• Links are formatted as:
– [http://example.org/index.php DISPLAY TEXT]
Download