lagos github meetup - what is git?
DESCRIPTION
Presentaion done at the Lagos GitHub MeetupTRANSCRIPT
Celestine OminSoftware Engr @ KongaMaintainer of NSEFinance@cyberomin@nnekaukpanah's husband.
What is git?
Git is a distributed revision control and source code management (SCM) system with an emphasis on speed, data integrity, and
support for distributed, non-linear workflows.Wikipedia
Uses
l (Documet) Version management
Who is using it?
History
l Started by Linus Torvaldsl Launched in '05l Replacement for BitKeeper to manage Linux kernel
source code
Statistics
Github launched in 2008 to host Git repositories2009: over 50,000 repos, over 100,000 users2011: over 2 million repos, over 1 million users
Let us begin
Installation http://git-scm.com
Configuration
l $ git config –global user.name Fistname Surnamel $ git config –global user.email [email protected]
$ git init
l Make changesl Add the changes to staging indexl git add [filename]
l Commit it to the repositoryl git commit -m „This is an initial commit“
Enough Talk
DEMO
Best Practises
l Write meaningful commit messagesl Fixed redirection issue. This happens when a user does not select
Remember Me
l Keep commit messages short. 70 words should be just fine. Write as though you were tweeting :-)
$ git logcommit 330ec85cb900530edbfa0ac73519f29b4150e436
Author: Firstname Surname <[email protected]>Date: Wed Apr 23 02:15:47 2014 +0530
Fixed login redirection issue
More of - git log
l git log – [(init) limit] – git log -3 – Return last 3 commits
l git log –since=“2013-04-05“l git log –until=“2013-04-05“l git log –author=“author name“l git log –grep=“Init“ - Every commit with the word Init
Git's Underlying Concept
Ignoring files
.gitignore
l Images/ - Everything under the image directory
l *.log – Ignore all my log filesl * ? [aeiou] [0-9] – Even regular expression
Branches
What are branches?
Type of branches
l Masterl Your branch
Creating a branch
$ git branch admin$ git checkout admin
Compact method
git checkout -b admin
Merging Branches
$ git checkout master$ git merge admin
All my branches
$ git branchadmin
* masterNotice the * on the master branch?
Pruning branches
$ git branch -d admin
Stashes
What are stash?
Stash Operations
$ git stash save “message”Notice we don't provide -m option
Stash Operations – List Stashes
$ git stash liststash@{0}:On branch_name: message
Stash Operations - Show
$ git stash show stash@{0}
Stash Operations - Pop
$ git stash pop stash@{0}
Stash Operations - Delete
$ git stash drop stash@{0}
l Questions?
Remotes
GitHubhttp://github.com
What is GitHub?
l GitHub is a Git repository web-based hosting service which
offers all of the distributed revision control and source
code management (SCM) functionality of Git as well as
adding many of its own features.
Working with remotes
l Go to http://github.com, l create a new repository and that's it.
Adding remotes
git remote add origin [email protected]:user/repo.git
Adding remotes
git remote add origin [email protected]:user/repo.git
Checking Remotes
git remote -v
Pushing to GitHub
$ git push origin masterAssuming you have multiple branches. In Git 2.0 you
can use git push alone
Pulling from GitHub
$ git pull origin master – Assuming you have multiple branches
Typical Workflow
$ git checkout master $ git fetch$ git merge origin/master$ git checkout -b contact_page$ git add feedback.html$ git commit -m “Added feedback form”
Questions?
Thank You
The WifeCcHubGitHub
Ciara, Luke, DanishFarouq, Jerry, Zainab, Jide, Jim
Audience