Your SlideShare is downloading. ×
0
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Git   Distributed Version Control System
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Git Distributed Version Control System

619

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
619
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
30
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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. GitVictor Wong
    • 2. OutlineInstall and Configure Git (x)Git ConceptsGit CommandsGit WorkflowGit Hosting (GitHub, Bitbucket)Case Studies
    • 3. InstallationGit for OS Xhttp://code.google.com/p/git-osx-installer/Git for Windowshttp://code.google.com/p/msysgit/
    • 4. Setting users name and email globally in git $ git config --global user.name "Victor Wong" $ git config --global user.email "victorwkm@gmail.com" $ git config user.name bonus: $ cat ~/.gitconfig
    • 5. Add color to status and branch $ git config --global color.status auto $ git config --global color.branch auto
    • 6. Git Concepts
    • 7. Git Conceptsremote repo <-> local repo <-> staging area <-> working directory# On branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)# Changed but not updated:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)# Untracked files:# (use "git add <file>..." to include in what will be committed)
    • 8. Basic Git CommandsCreating & Getting Branching Inspection init branch log clone checkout show mergeBasic Remote Sharing status remote add push commit pull mv, rm fetch tag
    • 9. Advanced Git Commands git-stash git-pop git-apply git-blame git-diff git-reflog git-reset git-revert git-clean git-rebase git-fetch
    • 10. Branch
    • 11. $ git branch testing
    • 12. $ git checkout testing
    • 13. new commit on testing branch
    • 14. $ git checkout master
    • 15. $ git commit -m Change the master!
    • 16. Merge
    • 17. $ git checkout master$ git merge iss53Merge made by recursive.README | 1 +1 files changed, 1 insertions(+), 0 deletions(-)
    • 18. Conflict
    • 19. $ git status$ vim index.html$ git add index.html$ git commit
    • 20. .git/confighooks (pre-commit, post-commit, ...)
    • 21. Git Workflow
    • 22. Distributed Workflows
    • 23. Centralized Workflow (us)
    • 24. Integration-Manager Workflow (GitHub)
    • 25. Dictator and Lieutenants Workflow (Linux)
    • 26. github.com
    • 27. GitHubCode ReviewCommit CommentsAnalyze BranchesCompare ViewPull request
    • 28. Case Studies
    • 29. Can I change the commitmessage before or after push?
    • 30. Can I change the commitmessage before or after push? $ git commit --amend bonus: $ git rebase -i Note: Never change your commit history after push to a public repository!
    • 31. How do I ignore files in a project? Some filessuch as .log which shouldnt be include in every project, can I ignore it in every projects?
    • 32. How do I ignore files in a project? Some filessuch as .log which shouldnt be include in every project, can I ignore it in every projects? $ vim .gitignore ... add the file and folder path that you dont want git to track ... $ vim ~/.gitignore_global $ git config --global core.excludesfile ~/.gitignore_global Bonus: git config --global --list Remind: Dont add too much files in the globa excludesfile
    • 33. Search commit message
    • 34. Search commit message git log -g --grep=<pattern> -g, --walk-reflogs Instead of walking the commit ancestry chain, walk reflog entries from the most recent one to older ones. --grep=<pattern> Limit the commits output to ones with log message that matches the specified pattern (regular expression).
    • 35. Can I change the filename case in Git? fatal: destination exists, source=font.ttf, destination=Font.ttf
    • 36. Can I change the filename case in Git? fatal: destination exists, source=font.ttf, destination=Font.ttf git mv -f font.ttf Font.ttf
    • 37. You have pushed a WordPress folder in the Github and pull it fromthe server.But you make a mistake, you want to- keep the wp-config.php in the server- remove it on the GitHub, so your colleagues wont get a copy ofthe wp-config.php
    • 38. You have pushed a WordPress folder in the Github and pull it fromthe server.But you make a mistake, you want to- keep the wp-config.php in the server- remove it on the GitHub, so your colleagues wont get a copy ofthe wp-config.php [On the server] $ vim .gitignore $ git commit -am ignore wp-config.php file $ git rm --cached wp-config.php $ git commit -m remove wp-config.php $ git push
    • 39. Clients: This feature worked well in the past.Why does it not work properly today?We: How do we use Git to quickly identify theissue?
    • 40. Clients: This feature worked well in the past.Why does it not work properly today?We: How do we use Git to quickly identify theissue? Use GitHub to: search history blame $ git checkout <commit-sha>
    • 41. Can I undo a git commit?
    • 42. Can I undo a git commit?Preserve all changes as unstaged changes$ git reset HEAD^Preserve all changes$ git reset --soft HEAD^Discard all changes$ git reset --hard HEAD^
    • 43. You are on a branch called "development", and you receivedan email from the client said this bug needs to be fixednow! Hence, you tried to switch your branch to "hotfix" or"master" to do a quick fix, but your working dirctory is"dirty", what should you do?
    • 44. You are on a branch called "development", and you receivedan email from the client said this bug needs to be fixednow! Hence, you tried to switch your branch to "hotfix" or"master" to do a quick fix, but your working dirctory is"dirty", what should you do? $ git stash $ git checkout master ... fix issue ... $ git commit -am "fix issue #100" $ git checkout development $ git stash list $ git stash pop bonus: $ git stash apply stash@{0} $ git stash drop stash@{0}
    • 45. The same code can also applied to thefollowing scenario.After finishing the development, you suddenlyrealized the you are developing a feature onthe WRONG branch. Can I save thosechanges and apply those changes in thecorrect branch?
    • 46. RecommendationsRead the git ERROR messageCommit or lose itDo one thing at a time (the smaller thebetter)Don’t modify any history after pushing to livePractice together
    • 47. ReferencesGit Reference http://gitref.org/Pro Git http://git-scm.com/book

    ×