B.G. - Before Git – Git vs. GitHub



B.G. - Before Git – Git vs. GitHub

1 0


GitBasics

Coding & Cocktails Introduction to Git

On Github KansasCityWomeninTechnology / GitBasics

WiFi Login: "VML Guest" | Username: Guest | PW: vmlguest

Version Control Basics Using Git

Slides available at: http://bit.ly/CnCGitBasics

Last Month

In February we learned how to navigate our computer using the command line:

  • changing directories using the CD command
  • creating new folders using MKDIR
  • building basic text documents using ECHO
We are going to build on last month's skills tonight!

What we'll cover

  • What is version control?
  • How does version control help development teams?
  • Distinguish between Git, GitHub, and Git Bash/iTerm2
  • Build your first repository (a.k.a. 'repo')
  • Discuss forking and branching
  • Practice collaborating using Git

But First . . .

Let's Meet Our Mentors!

And

A Special Announcement

Meet The Olas

Django Girls

Here We Go!

What is Version Control?

At it's core, version control is simply an organized way of tracking changes or variations of a project built over time.

Functionally, the beauty of a distributed version control system like Git is that it allows multiple people to work on the same code at the same time without stepping on each other's toes or overwriting one another's work.

Version control is not the same thing as backing up a file. In version control you are specifically tracking changes made throughout the development of a project. Backing up stores a copy of the fully functioning file in case it is lost.

B.G. - Before Git

Image Credit: Smashing Magazine
Centralized system - the main working copy of the program exists in a centralized location. Developers have to check out the code and push up to a central location. If the main server goes down the developers can’t save versioned changes (single point of failure). If the hard disk of the central database becomes corrupted the entire history could be lost

Linus Torvold

A.G. (After Git)

Image Credit: Smashing Magazine

Early versions included Mercurial and Bazaar, but Git, is widely used and more recognized.

Git vs. GitHub

Git is the distributed version control concept and system.

Git Bash/iTerm2 and Git Desktop are tools that help you interact with Git.

GitHub is the place that hosts the repository in the Cloud.

Time to pull out your handouts!

Exploring the Interfaces

Your browser does not support the video tag. Git Bash does not universally recognize commands from other frameworks. You can execute git commands from your Command Line prompt, but you cannot always execute other commands (like Meteor) from Git Bash. Functionally, however, one command prompt is much like another.

Exploring the Interfaces - Git Desktop

Exploring the Interfaces - GitHub

GitHub Profile Have students open GitHub. Useful for searching repositories, copying links to be cloned, and reviewing changes. We will come back to this later in the evening.

Initialize and Clone Your First Repo

Your browser does not support the video tag.

Git Workflow

Image Credit: https://GitHub.com/gaui/git

Git Workflow

  • Stage (track) your changes with
    git add -A
  • Commit your changes using
    git commit -m'Message'
  • Push the changes to your GitHub repository using
    git push origin master
  • Cheat sheets can be helpful. Here are a couple we liked:
Git Cheat Sheet by Tobias GüntherGitHub's Official Git Cheat Sheet

Add / Commit / Push

Your browser does not support the video tag

Forking

  • You are copying someone else's repository
  • Use it to propose changes to someone else's work using a pull request, or
  • Use their code as a jumping off point for your own project (being mindful of use licenses!)

###

Let's Practice Forking a Repo

Forking a Repository

Your browser does not support the video tag.

Branching

  • You are part of the project team
  • Each branch can be a single feature (aka 'user story' or 'requirement', developed independently from other features
  • Each developer works on her own feature and then merges her changes into the master
  • In this method, pull requests become a way of asking for a peer code review.

###

Let's Practice Branching

Branching Video

Your browser does not support the video tag.

Resolving Merge Conflicts

Your browser does not support the video tag.Example: Jennifer and Sarah and Tamara are all working on unique features of the KCWiT Web site. We have eached cloned the central repository down into our local computers as a unique branch. Jennifer's is "NavBar", Sarah's is "CSS" and Tamara's is "images\Assets". Jennifer gets her changes done first and pushes her branch changes. Since she is the first, she has no problems pushing to the master. Sarah gets done second, but she checks to see if there's a newer version of the central repo than the one she pulled down. There is - the changes JEnnifer just pushed. So Sarah pulls down a fresh copy of the updated changes to the repository and tweaks her code as needed. Then, she pushes her branch changes to the master. When Tamara gets done with her changes, she uses git status and finds out that she is a couple of commits behind the master because of Jennifer and Sarah's changes. She pulls the latest version and modifies her code to resolve any conflicts and then pushes to the master repository.

The Morning After...What's next?

Play a Game to Learn GitHub: PCottle's Git Branching Game

Publish Your Web Page on GitHub Pages using these step by step instructions: Pages by GitHub

Please tell us how we did:

Take Our Survey

Questions?

?

Thank You!

Join us April 9th for an evening discussing CSS Compilers!