WiFi Login: "VML Guest" | Username: Guest | PW: vmlguest
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
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.
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
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.
Add / Commit / Push
Your browser does not support the video tagForking
- 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.