Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Git

Introduction to Git

An introduction to git and its basic concepts

Avatar for Nriagu Chidubem

Nriagu Chidubem

December 01, 2017
Tweet

Other Decks in Programming

Transcript

  1. Overview 1. Install GIT and create a github account 2.

    Version Control 3. What is Git ? 4. Git and how it works 5. More resources
  2. Install git and create a github account • Linux(Debian) ◦

    Command: sudo apt-get install git • Linux(Fedora) ◦ Command: sudo yum install git • Mac ◦ http://git-scm.com/download/mac • Windows ◦ http://git-scm.com/download/win Log on to https://github.com to create a github account
  3. Version Control System • Keeps records of changes made to

    source code • Allows for collaborative development • Allows you to know who made a particular change and when • Allows you to revert changes and go back to a previous/original state Eg: svn, git , mercurial, e.t.c
  4. Git and how it works (key Concepts) • Repositories •

    Commit • Snapshots • Cloning • Branch • Push • Pull
  5. Key Concepts (repositories) • A collection of files and their

    history • Can live on a local machine or a remote server • The act of copying a repository from a remote server is called cloning • The process of downloading commits that does not exists on your local machine from a remote server is called pulling • Adding local changes to a remote repository is called pushing
  6. Key Concepts (snapshot) • The way all files looks like

    at a given time • You decide when to take a snapshot and of what files • A file/source code can be returned to a specific snapshot
  7. Key Concepts (commit) git commit -m ‘name of the commit

    ’ This is the act of creating a snapshot Commits contains some of information • Information about how the files has changed from previously • Name of the commit • Username and email of person who made the commit • A hash code name (Generated by SHA-1 Algorithm)
  8. Key Concepts (cloning) git clone repository url • The act

    of making a local copy of a remote repository • After cloning, the default branch is the master • After cloning, we have to set the remote url • Remote is the url to our repository
  9. Key Concepts (branching/merging) git checkout -b branch-name, git merge branch-name

    • Branches are created to work on a new feature or play around with the source code without affecting the main branch • Merging is the process of bringing changed from two branches together • Moving from one branch to the other is called checkout
  10. Key Concepts (push / pull) git push remote-name branch, git

    pull remote-name branch • Git push is saving your commits to the remote repository(online) • Git pull is getting recent commits from the remote repository to your local machine NB: Set a remote name git remote set-url {remote-name} {remote-url}
  11. Additional resources • Official git site and tutorial ◦ http://git-scm.com

    • Github guides ◦ https://guides.github.com • Atlassian git tutorial ◦ https://www.atlassian.com/git • Git Immersion tutorials ◦ http://gitimmersion.com