Magie di git
-
Upload
michele-franzin -
Category
Technology
-
view
690 -
download
2
Transcript of Magie di git
Magie di
„ …any sufficiently advanced technology is indistinguishable from magic. “
Arthur C. Clarke
„ Sono un egoista bastardo, e do a
tutti i miei progetti un nome che mi riguardi.
Prima Linux, adesso Git “
Linus Torvard
open source version control system designed to handle very large projects with speed and efficiency.
● non-linear development● distributed development● HTTP, FTP, ssh, rsync, or a Git protocol● cryptographic authentication● toolkit design● pluggable merge strategies
Installation
Windows - msysGit http://code.google.com/p/msysgit/
OS X Leopard - Git OS X Installerhttp://code.google.com/p/git-osx-installer/
Linux - apt-get/yum install git-core
Setup & Initialization
setting a few global variables:
git config --global user.name “michele franzin“git config --global user.email [email protected] config --global color.status autogit config --global color.branch auto
create a git repository in the current project directory:
git initgit add .git commit -m "initial commit of project"
Basic Workflowmake some changes, review what you have done,
stage (add) those changes, commit
# make some changes to README.txtgit statusgit diffgit add README.txtgit commit -m "updated the description"
make some BAD changes, revert to the last state
# make some bad changes to config/hoe.rbgit statusgit reset --hard HEAD #NOT -> git revert HEAD
Ignoring
Project Global - edit the .git/info/exclude file
Per Directory - put it in a .gitignore file
Exploring history
exploring commit messages
git loggit log --since="2008-05-20"git log --since="1 week ago" --until="2 days ago"git log path/to/filegit log -p
show commit details
git show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
Simple Branching and Merging
# write a Hello World program tmp/hw.rbgit add tmp/hw.rbgit commit -m "hello commit"git checkout -b refactor
# refactor out our putsgit commit -a -m "refactored puts"git branch # lists banrchesgit checkout mastergit pull . refactor # fast forward merge
Hold on!
use git stash to hold onto changes
conflicts are marked with “<“
resolve them using git mergetool
git add the files
Collaborating & Contributions
git clone /home/alice/project myrepo(edit files)bob$ git commit -a
alice$ cd /home/alice/projectalice$ git pull /home/bob/myrepo master
# inspect without mergingalice$ git fetch /home/bob/myrepo masteralice$ git log -p HEAD..FETCH_HEAD
Extra
Hosting http://www.github.com/
Netbeans 6.0 plugin (beta)http://code.google.com/p/nbgit/
Eclipse pluginhttp://www.jgit.org/
Resources
Official websitehttp://git.or.cz/
Tutorial - http://www.kernel.org/ pub/software/scm/git/docs/gittutorial.html
Guideshttp://github.com/guides/home
Git - SVN Crash Coursehttp://git.or.cz/course/svn.html