Level Up: Git – Agenda – Who Am I?



Level Up: Git – Agenda – Who Am I?

0 1


levelUp-git

A workshop on leveling up with git

On Github sirjessthebrave / levelUp-git

Level Up: Git

Created by Jessica Bell / @SirJessTheBrave

Agenda

  • Who Am I?
  • Who are you?
  • A Team of One
  • Working in Teams
  • GIT... Oh Shit!
  • Make your first page with GitHub
  • QA Time

Who Am I?

  • Jessica Bell
  • Web Developer at Deloitte Digital
  • Self taught: Degree in International Relations, General Assembly Bootcamp for Front End Web Development
  • Community Leadership: DC FemTech, DC Tech Meetup
  • GitHub: SirJessTheBrave
  • Twitter: @sirJessTheBrave
Spirit Animal

Who Are You?

  • Name
  • Occupation/grade/thing that occupies most of your time
  • Why you are hear and what you want to learn
  • What is your Spirit Animal/persona/thing you love

Lets Go!

Team of One

Best Practices

  • Commits should be small and frequent
  • Use 'Diff' to check changes
  • Keep commit messages semantic
  • Branch!!
  • Always push at the end of the day!
DIFF: git diff --staged(if you already have staged changes) git diff -v (bring up vim editor)

Working in Teams

Git Team Workflows

  • Stick to one process/workflow
  • Enforce Standards
  • Integrate build processes/development cycles into your git workflow
  • Reference Guide

Feature Branch workflow

Rebase vs Merge

- git rebase: clean, linear history free of unnecessary merge commits - git merge: preserve the complete history of the project and avoid the risk of re-writing public commits

Merge: Takes the Master branch, and merges the code into the feature branch like normal, a non-desctructive operation but can pollute the feature branch if master is very active

Rebase: Move entire feature branch to tip of master - which re-writes the project history.

Interactive Rebase, Squash, and Ammend

  • Ammend: Rewrite your git history
  • Interactive Rebase: 'git rebase' re-applies commits, in order, from your current branch to another. 'interactive' opens an editor with a list of the commits to be changed
  • Squash: melds commit into previous one - one big commit
  • Fixup: acts as a 'squash' but discards the commit's messages

Article and Commands

Reference

Rebase or Merge?

Merging vs Rebasing Article

Git.... Oh Shit!

What Next

  • Don't panic! This is why we are using git!
  • If you get stuck - use a GUI to visualize! (I reccomend SourceTree)

Reset

- git reset: undo changes that haven’t been shared with anyone else - alters the history “Oh crap, what am I doing? I should just start over.” --soft – The staged snapshot and working directory are not altered in any way. --hard – The staged snapshot and the working directory are both updated to match the specified commit.

Revert

Reverting undoes a commit by creating a new commit - no chance of re-writing the commit history. You can also think of git revert as a tool for undoing committed changes, while git reset HEAD is for undoing uncommitted changes. For example, the following command will figure out the changes contained in the 2nd to last commit, create a new commit undoing those changes, and tack the new commit onto the existing project.

Stashing

Running 'git stash' will take your current changes, packacge them up with a date and ID and store them for later use - taking them out of your current repo/project. When you are ready to call them up again run 'git stash list' to see your stashed items. Use 'git stash apply' to apply the stashed files.

Hosting your first page with GitHub

Getting Started

  • Create a free GitHub Account
  • Create your first Repository on GitHub
  • "Clone" your new repository onto your local machine
  • CODE!!
  • Using either your command line or a GitHub GUI (SourceTree is my reccomended one) "Push" your code to your online GitHub Account
  • Create a "Branch" and name is gh-pages on GitHub
  • Look in your repository settings to find the URL of your newly published site!
  • Profit!

Stop! Question-time!

References/Guides

Fin

@sirJessTheBrave | GitHub: SirJessTheBrave
Level Up: Git Created by Jessica Bell / @SirJessTheBrave