Git Training

Who the hell is this guy?

One Last thing Before WE start

As you learn Git, try to clear your mind of the things you may know about other VCSs, such as Subversion and Perforce; doing so will help you avoid subtle confusion when using the tool.

 

 

 

 

 

Why SHOULD I Use Git?

QUICK HISTORY

The Linux kernel is an open source software project of fairly large scope. For most of the lifetime of the Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and archived files. In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.

In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down, and the tool’s free-of-charge status was revoked. This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool based on some of the lessons they learned while using BitKeeper.

Chapter 1: Getting Started from Pro Git, Second Edition by Ben Straub, Scott Chacon

Why Use Git

  • Speed (Nearly Every Operation Is Local)

  • Work offline

  • Strong support for non-linear development (thousands of parallel branches)

  • Fully distributed

  • Able to handle large projects

  • undo mistakes

  • Visual Interfaces (Stash, Github, bitbucket)

  • Pull request (Forced code reviews)

command Line Time

Why command Line?

  • If you know how to run the command line version, you can probably also figure out how to run the GUI version, while the opposite is not necessarily true.
  • the command line is the only place you can run all Git commands – most of the GUIs only implement a subset of Git functionality for simplicity

configure git

who are you?

$ git config --global user.name "[name]"
$ git config --global user.email "[email address]"

Lets create a Repo

$ cd test
$ git status
$ git init
$ mkdir test
$ git status
$ echo "test" > README.md
$ git status
$ git add README.md
$ git status
$ git commit -m "Initial Commit"
$ git status

Lets create a Repo

$ git remote add origin http://{{username}}@stash.stt-internal.local:7990/scm/~{{username}}/{{repo_name}}.git
$ git push origin master
$ git status

Merging Time

What should we work on?

What's going on Here!

  • Developer 1
    • Created a repo
    • Added a basic webpage to master
  • Developer 2
    • branched off master (feature/add-contact-page)
    • Added a contact page
  • Developer 1
    • branched off master (feature/add-gitflow-page)
    • Added a Gitflow page

What's going on Here!

  • Developer 2
    • branched off feature/add-contact-page (bugfix/contact-page-nav-fix)
    • fixed some bugs

Pull Request Time

Git Training resources

Git Training

By Chris Haley

Git Training

  • 1,086