Top Banner
Using Git, GitHub, & BitBucket Gwen Daniels Illinois Legal Aid Online [email protected]
41

Intro to Git, GitHub, and BitBucket

Feb 10, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Intro to Git, GitHub, and BitBucket

Using Git, GitHub, & BitBucket

Gwen DanielsIllinois Legal Aid [email protected]

Page 2: Intro to Git, GitHub, and BitBucket

Who are you?

Page 3: Intro to Git, GitHub, and BitBucket

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

Page 4: Intro to Git, GitHub, and BitBucket

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.

Page 5: Intro to Git, GitHub, and BitBucket

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

Page 6: Intro to Git, GitHub, and BitBucket

What is Git?Code management

tool

Version control

Distributed

Page 7: Intro to Git, GitHub, and BitBucket

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

Page 8: Intro to Git, GitHub, and BitBucket

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.

Page 9: Intro to Git, GitHub, and BitBucket

How Do I Work With

Git?

Command line

Using a GUI

GitHub client

SourceTree

Within your development IDE (PhpStorm, NetBeans, Eclipse, Sublime Text)

Page 10: Intro to Git, GitHub, and BitBucket

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:

sudo yum install git-all or sudo apt-get install git-all

Page 11: Intro to Git, GitHub, and BitBucket

The Git process

Page 12: Intro to Git, GitHub, and BitBucket

Demo

Page 13: Intro to Git, GitHub, and BitBucket

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’

Page 14: Intro to Git, GitHub, and BitBucket

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

Page 15: Intro to Git, GitHub, and BitBucket

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

Page 16: Intro to Git, GitHub, and BitBucket

Advanced Git

Page 17: Intro to Git, GitHub, and BitBucket

Using BranchesBy 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

Page 18: Intro to Git, GitHub, and BitBucket

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]

Page 19: Intro to Git, GitHub, and BitBucket

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’

Page 20: Intro to Git, GitHub, and BitBucket

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

Page 21: Intro to Git, GitHub, and BitBucket

GitHub & Bitbucket

Page 22: Intro to Git, GitHub, and BitBucket

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

Page 23: Intro to Git, GitHub, and BitBucket

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

Page 24: Intro to Git, GitHub, and BitBucket

GithubHome of many open source

projects

DLaw

Q & A markup

Learn the Law

Jonathan Pyle’s DocAssemble

Page 25: Intro to Git, GitHub, and BitBucket

Code Repository

Page 26: Intro to Git, GitHub, and BitBucket

Create or switch branches

Page 27: Intro to Git, GitHub, and BitBucket

Add new file, upload files

Page 28: Intro to Git, GitHub, and BitBucket

View, or edit files live in the browser

Page 29: Intro to Git, GitHub, and BitBucket

Manage Your Issues

Page 30: Intro to Git, GitHub, and BitBucket

Creating an issue

Page 31: Intro to Git, GitHub, and BitBucket

Email notifications

Page 32: Intro to Git, GitHub, and BitBucket

Pull Requests

Page 33: Intro to Git, GitHub, and BitBucket

GitHub Wiki

Page 34: Intro to Git, GitHub, and BitBucket

BitBucket

Page 35: Intro to Git, GitHub, and BitBucket

Source

Page 36: Intro to Git, GitHub, and BitBucket

Create or change branches

Page 37: Intro to Git, GitHub, and BitBucket

Online Editing…

Page 38: Intro to Git, GitHub, and BitBucket

Issue Tracking

Page 39: Intro to Git, GitHub, and BitBucket

Pull Requests

Page 40: Intro to Git, GitHub, and BitBucket

Wiki

Page 41: Intro to Git, GitHub, and BitBucket

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: