Your SlideShare is downloading. ×
  • Like
版本控制Git
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

版本控制Git

  • 228 views
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
228
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
19
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. 版本控制 GITkewang
  • 2. 2git burst !!!
  • 3. 3RCS comparison
  • 4. 4server command offline software(e.g.)Local optional cp/mv/rm optional your brainCentralized MUST simple no SVNDistributed optional complex optional git
  • 5. 5Git history
  • 6. 6Linux kernel file management●1991~2002 : Local– 大多數 Linux kernel 維護工作花在 patch 及歸檔上●2002~2005 : BitKeeper– 開始改為商用型 RCS : BitKeeper●2005~ 現在: Git– BitKeeper 與 Linux kernel 合作結束, Linus Torvalds自行開發新的 RCS ,名為 Git
  • 7. 7from SVN migrate toGit you must know
  • 8. 8you must know● Repositories– SVN has a central repository.– Git has a personal repository, also has an officialrepository.● Revisions– SVN revisions start at 1 and every commitincrement.– Git revisions has 40-character SHA-1(you can think ofas random string).
  • 9. 9Installing......http://git-scm.com/book/en/Getting-Started-Installing-Git
  • 10. 10Creating a new repository1.mkdir prj2.cd prj3.git init
  • 11. 11File Status Lifecycle
  • 12. 12
  • 13. 13File Status Lifecycle● untracked unmodified→– git add filename● unmodified modified: modify some files→● modified staged→– git add filename● staged unmodified→– git commit
  • 14. 14File Status Lifecycle● unmodified untracked→– git rm filename● modified unmodified→– git checkout -- filename● staged modified→– git reset HEAD filename
  • 15. 15SVN maps to Git
  • 16. 16Importing an existing project● Git1.git init2.git add .3.git commit● SVN1.svnadmin create prj_repo2.svn import . proj_repo
  • 17. 17Check what youve done● Git1.git diff● SVN1.svn diff | less
  • 18. 18Reverting a file● Git● git reset --hard HEAD filename● or● git revert HEAD filename (new commit)● SVN1.svn revert filename
  • 19. 19Branching● Git1.git branch new_branch old_branch2.git checkout new_branch● SVN1.svn copy svn://svn.example.com/old_branchsvn://svn.example.com/branches/new_branch2.svn switchsvn://svn.example.com/branches/new_branch
  • 20. 20Merging● Git● git merge branch● SVN● svn merge -r 20:HEADsvn://svn.example.com/branches/branch
  • 21. 21and more commands...
  • 22. 22git remoting
  • 23. 23
  • 24. 24github morepopular !!!
  • 25. 25publicrepositoriesprivaterepositoriesotherGitHub unlimited paidwiki, issue tracking,pull request, forkBitbucket unlimited freewiki, issue tracking,pull request, fork
  • 26. 26Set up Git● Give a name– git config --global user.name "Your NameHere"– git config --global user.email"your_email@example.com"● Caching my password– git config --global credential.helpercache
  • 27. 27GitHub
  • 28. 28Step by Step
  • 29. 29Bitbucket
  • 30. 30Step by Step
  • 31. 31Downloading someone project● git clone url prj
  • 32. 32Add a remote repository1.git remote add originhttps://example.com/hello.git2.git push origin master
  • 33. 33Push & Pull● Push (like svn commit)– git push● Pull (like svn update)– git pull
  • 34. 34Links● MY GITHUB RÉSUMÉ●Git flow開發流程● GitSvnCrashCourse●Git 教學(2):Git Branch 的操作與基本工作流程● 3.2 Git Branching - Basic Branching and Merging●寫給大家的Git教學● Code School - Try Git
  • 35. 35via http://blog.gslin.org/archives/2013/01/17/3136/
  • 36. 36