Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to Git, GitHub, and BitBucket

506 views

Published on

With these slides we introduce the concept of source control and teach the core features to using Git, GitHub and BitBucket. You can find the accompanying video here. https://youtu.be/lZpNrCgGvuI

Published in: Technology
  • Be the first to like this

Intro to Git, GitHub, and BitBucket

  1. 1. Using Git, GitHub, & BitBucket Gwen Daniels Illinois Legal Aid Online gdaniels@illinoislegalaid.org
  2. 2. Who are you?
  3. 3. Survey Question Which of these describe how you use Drupal? Our program website runs on Drupal Our statewide website runs on Open Advocate Our statewide website runs on Drupal, but not Open Advocate We don’t use Drupal
  4. 4. How would you describe your role on the website(s)? I write code/custom modules for the website I install contributed modules, install security updates on the website or edit configuration information in Drupal’s user interface (for example, creating content types, adding fields or changing permissions. I’m a project manager; I sometimes have to deal with developers who work on our website I’m a content manager None of these apply to me; I just want to know a bit more about Git.
  5. 5. What We’re Covering What is Git and why you should be using it Git setup and options Git commands Git hosting with GitHub and Bitbucket Where to go next
  6. 6. What is Git? Code management tool Version control Distributed
  7. 7. Why Use Git? For our own projects Acts as a backup It lets us undo changes It promotes collaboration It organizes To take advantage of other projects
  8. 8. But I’m not a developer! Drupal sites have probably have at least 2 of these: Custom modules Contributed modules Core modules In Drupal 8: Configuration lives in code, not the database. In Drupal 7, configuration lives in the database but can (and should) live in code via Features.
  9. 9. How Do I Work With Git? Command line Using a GUI GitHub client SourceTree Within your development IDE (PhpStorm, NetBeans, Eclipse, Sublime Text)
  10. 10. Getting Git For Windows: Download from https://git-scm.com or Install a GUI like GitHub or Sourcetree For Mac Open Terminal and type git; you’ll be prompted to install the Xcode command line tools OR Same options as Windows For Linux:
  11. 11. The Git process
  12. 12. Demo
  13. 13. Walking through Git: Common Tasks Git init: Create a Git repository Git clone: to copy an existing repo with git clone Git add: to add files to Git Git commit: to commit those files to your local copy Add -m and a message and describe what you did: git commit -m ‘I did something’
  14. 14. Walking through Git: Interacting with Remote Repositories Add a remote repository using git remote add [name] [url] Git pull: Push your commits to the remote repository Git push: Pull the latest changes from the remote repository
  15. 15. Keeping track of things... Get help with git --help or git --help command See with list of files you’ve changed with git status View your commit history with git log (or git log remote/branch) Compare changes with git diff
  16. 16. Advanced Git
  17. 17. Using Branches By default, everything is in the Master branch Branches let you: Keep the master branch clean of “in development” code changes Makes a copy of the then-existing master branch All work is then done in the new branch Only commit to master when you are done You can publish your branch to share
  18. 18. Working with branches Get a list of branches using git branch Create a branch using git branch [branch name] Delete a branch using git branch -d [branch name] Merge your branch git merge master [branch name]
  19. 19. Tags Tags let you: Mark a specific point in time Is essentially a branch that you can not change List all your tags with git tag Create a new tag with git tag ‘name’ -m ‘message’ Push a tag with git push origin ‘name’
  20. 20. Reverting changes Use git checkout -- . or git reset --hard HEAD to revert any uncommitted file back to the current state Use git checkout [commit] [file] to change your local working copy to an old version. [File] is optional. Use git revert [commit] to undo all the work in that commit and create a new commit undoing those changes
  21. 21. GitHub & Bitbucket
  22. 22. What are Github and BitBucket? Cloud-hosted repositories Public and private repositories Both offer additional tools: Issue tracking Wikis Nice user interfaces Webhooks and services to integrate with other systems
  23. 23. Differences GitHub Integrates well with the Github client Free for public repositories Private repositories start at $7/month Nonprofit pricing Bitbucket Integrates well with SourceTree Free for public repositories and small teams (less than 5 people) Seamless integration with other Atlassian products, like Jira
  24. 24. Github Home of many open source projects DLaw Q & A markup Learn the Law Jonathan Pyle’s DocAssemble
  25. 25. Code Repository
  26. 26. Create or switch branches
  27. 27. Add new file, upload files
  28. 28. View, or edit files live in the browser
  29. 29. Manage Your Issues
  30. 30. Creating an issue
  31. 31. Email notifications
  32. 32. Pull Requests
  33. 33. GitHub Wiki
  34. 34. BitBucket
  35. 35. Source
  36. 36. Create or change branches
  37. 37. Online Editing…
  38. 38. Issue Tracking
  39. 39. Pull Requests
  40. 40. Wiki
  41. 41. Learn More… Try git in the cloud: https://try.github.io/levels/1/challenges/1 Git Cheat Sheet: https://www.git-tower.com/blog/git-cheat- sheet/ Git Workflows: https://www.atlassian.com/git/tutorials/comparing-workflows/ Slides at:

×