Bare Minimum Git

Pregame

  1. Sign up for an account at Bitbucket.org
  2. Send me (salcode) a message through Bitbucket
  3. Download GitHub App
    mac.github.com / windows.github.com


Sal Ferrarello / @salcode

ironco.de/bare-minimum-git/

Bare Minimum Git

Quick, dirty, and fast.

Sal Ferrarello / @salcode

ironco.de/bare-minimum-git/

The Value of Version Control

  1. Merging work without overwriting
  2. Easy backs up with restore points

Merging work without overwriting

Image From QuickMeme.com

Easy backs up with restore points

Image From cheezburger.com

Git, GitHub, and Bitbucket

  • Git is the generic "car"
  • GitHub is a BMW
  • Bitbucket is a Toyota


Bitbucket is cheap price, not cheap quality

We use GitHub's app to set things up

Install Git

The GitHub app is a quick way to install

mac.github.com / windows.github.com

Skip Setup, Go to Advanced Tab

Mac Preferences

GitHub App Mac Settings

Windows Settings

GitHub App Windows Settings

Close the GitHub App

Vocabulary

Repository (repo)
A project within git

Command line? Why?

  • Sets the stage for Sass, grunt, and a host of other tools
  • It is easier, seriously


Note: You will not break your computer

Mac Pro-Tip: Command line to your working directory

cd and drag-and-drop your current directory

Clone a repo

(Copy a project to your computer)


	git clone https://bitbucket.org/salcode/burbs.git
						

You can copy this line directly from Bitbucket

Move into the project directory


	cd burbs
						

Status of the Project

We use this A LOT


	git status
						

Modify index.html


26

Sal

27

28

29

30

December

Share Your Changes


							git add -A
						

							git commit -m "add Sal's birthday"
						

							git push
						

Rejected


error: failed to push some refs to
hint: Updates were rejected because
the remote contains work that you do
not have locally...
...first integrate the remote changes
hint: (e.g., 'git pull ...')
before pushing again
						

Share Your Changes (revised)


							git add -A
						

							git commit -m "add Sal's birthday"
						

							git pull
						

							git push
						

Conflict


...
CONFLICT (content): Merge conflict in index.html
Automatic merge failed; fix conflicts
and then commit the result.
					

Fixing Conflicts

Edit File - Resolve and remove special lines


<<<<<<<<<
(your version here)
=========
(server version here)
>>>>>>>>>
					

							git add -A
						

							git commit -m "fix merge conflict"
						

New Repository

  • Make repo on bitbucket.com, "Create"
  • Local project folder on your computer, make repo
  • Follow onscreen instructions (I have existing project)

Make repo on bitbucket.com, "Create"

Use the same Name as the folder name of your project locally

Local Project Folder


							git init
						

							git add -A
						

							git commit -m "initial commit"
						

One at time, run the command line entries from Bitbucket in the project directory

.gitignore

During a project there are often files you do NOT want to include in your repo.

Examples

  • Thumbs.db
  • php_error.log
  • ironcode.sublime-project
  • /node_modules
  • uploads directory
  • wp-config.php
  • core WordPress files

Adding Your .gitignore file

My WordPress .gitignore

ignores everything other than

  • /wp-content/themes/
  • /wp-content/plugins/
  • /wp-content/mu-plugins/

What Just Happened?

Why? Merging, Backups

How?
Refer to cheatsheet on ironco.de/bare-minimum-git/

Sal Ferrarello

I am available for team and individual trainings

Sal Ferrarello / @salcode

ironco.de/bare-minimum-git/