what the git? - wordcamp atlanta

Post on 01-Jun-2015

495 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Nathaniel Schweinberg @nathanielks

FightTheCurrent.org

What the git?

It keeps track of your code!

git is a Source Control Management application

git stores only the changes you make

git allows you to focus on the feature you’re

writing

http://hades.name/blog/2010/01/22/git-your-friend-not-foe-vol-2-branches/

git allows multiple developers to work on the same project

http://git-scm.com/about/distributed

How to get started!

Step 1: Install git

http://git-scm.com/book/en/Getting-Started-Installing-Git

Step 2: OPEN TERMINAL

Step 3: Get it set up

http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup

How git works

http://git-scm.com/about/staging-area

Initializes a git repository in current folder

git init

Adds file . to the staging area ( . means current folder and all files inside )

git add .

Commits files added to staging area ( -m adds commit message )

git commit –m ‘initial commit’

Shows current status of working directory

git status

http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository

BRANCHING

Branching encourages a few things

Frictionless Context Switching Feature Based Workflow

Disposable Experimentation

http://git-scm.com/about

Create new branch to work from

git branch name

Sets working tree to branchname

git checkout branchname

Create and checkout into branchname

git checkout –b branchname

Merges committed changes made in branchname with current branch

git merge branchname

Repositories!

Let’s add a remote repository

Two basic actions

git push Pushes changes to

remote repo

git pull Pulls changes from

remote repo

Let’s integrate with WordPress!

Use git clone to duplicate a remote repository locally

git clone

Submodules allow you to keep separate sections of your code under source control

( repos within repos )

Submodules!

Adds submodule located at repository to path/to/location within project

git submodule add repository

path/to/location

Use .gitignore to prevent files from being added to the repo

.gitignore

Let’s Talk strategy

Commit early, Commit Often

Use descriptive commit messages!

Always develop on a separate branch

Master branch is stable ONLY.

ns/some-cool-feature

Branch naming: initials/feature-name

Working with multiple Devs

Updates current branch with changes made in another

git rebase branchname

http://bit.ly/WhatTheGit

Resources:

Nathaniel Schweinberg @nathanielks

FightTheCurrent.org

top related