1 / 33

Introduction GIT

Introduction GIT. Jun-Ru Chang jrjang@gmail.com. Outline. Introduction VCS Introduction GIT. Introduction VCS. VCS: Version Control System We will be known forever by the tracks we leave Automatic backup Sharing on multiple computers Version control and branching

porter
Download Presentation

Introduction GIT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction GIT Jun-Ru Chang jrjang@gmail.com

  2. Outline • Introduction VCS • Introduction GIT

  3. Introduction VCS • VCS: Version Control System • We will be known forever by the tracks we leave • Automatic backup • Sharing on multiple computers • Version control and branching • Logging where be changed

  4. Introduction VCS

  5. Introduction VCS • Local VCS

  6. Introduction VCS • Centralized VCS • Subversion (SVN) • checkout • update • commit

  7. Introduction VCS • Distributed VCS • GIT

  8. Introduction GIT

  9. Introduction GIT • Linus Torvalds • Orignally using VCS developed by BitKeeper • Feature • Fast • Decentralize revsion control

  10. Introduction GIT • Git basics • Snapshot, not differences • Nearly every operation is local • Three stages

  11. Introduction GIT

  12. Introduction GIT

  13. Introduction GIT • Github • https://github.com/ • msysgit • http://code.google.com/p/msysgit/downloads/detail?name=PortableGit-1.7.10-preview20120409.7z&can=2&q=

  14. Introduction GIT • Register account on Github • Unzip msysgit • Generate key • $ ssh-keygen -t rsa -C "user@email" • Import public key into Github • $ ssh -T git@github.com • Create a new repository

  15. Introduction GIT • $ git config --global user.name "user1" • $ git config --global user.email "user1@email"

  16. Introduction GIT • $ mkdir test; cd test • Getting a repository • importing existing project or directory into git$ git init $ git remote add origin git@github.com:user1/test.git • cloning an existing git repository from another server$ git clone git@github.com:jrjang/ppt.git

  17. git add git rm git mv git diff git commit git log $ touch test1.c$ touch test2.c$ git add test1.c test2.c$ git commit -c "xxx"$ git rm test2.c$ git mv test1.c test.c$ git status$ git commit -c "yyy"$ git log$ echo "test" > test.c$ git diff Introduction GIT

  18. Introduction GIT • git status

  19. git commit --amend git reset HEAD file $ touch test3.c$ git add test3.c$ git reset HEAD test3.c Introduction GIT

  20. Working with remotes git pull git push $ git push origin master $ git pull git@github.com:user1/test.git Introduction GIT

  21. Introduction GIT • What a branch is

  22. Introduction GIT

  23. Introduction GIT

  24. Introduction GIT • git checkout • git branch

  25. Introduction GIT

  26. Introduction GIT

  27. Introduction GIT

  28. Introduction GIT • $ git checkout -b testing$ git branch$ touch haha.c$ git add haha.c$ git commit -c "in testing"$ git checkout master$ touch hehe.c$ git add hehe.c$ git commit -c "in master"$ git show-branch

  29. Introduction GIT • git checkout master • git checkout -b hotfix

  30. Introduction GIT • $ git checkout master • $ git merge hotfix • $ git branch -D hotfix

  31. Introduction GIT

  32. Introduction GIT

  33. Introduction GIT • Conflict • git status • edit the conflict files • git commit <<<<<<<HEAD:test.c ======= >>>>>>>iss53:test.c

More Related