git: why and how to
DESCRIPTION
Show you what can we do with git, not only push and pull.TRANSCRIPT
GIT: Why And How to
Presenter: Huong Nguyen
Skype: lan_huong_a3
CONTENT• What is Git
• Basic Use & How to
• Advance Use
• Useful Reference
Oops, I need this
And this
And this
And this
A contributor to work with
But don’t break the rules
And, Finally...
Somebody tell me what did I do with my source?
Too much requirements?
Let me answer• A Source code management system (SCMS):
• Allows you to track and undo changes.• Allows multiple people to work on the same code at once.• Allows you to make changes to multiple versions of a your
software.• Allows you to deploy software to multiple servers.• Makes Code Development Social through • Notifications, Comments, Wiki & Graphs
SVN STORAGE
GIT STORAGE
Nearly Every Operation Is Local
Git Status
Git Config & HelpConfig:
● $ git config --global user.name "John Doe"
● $ git config --global user.email [email protected]
Help:
● $ git help <verb>
● $ git <verb> --help
● $ man git-<verb>
Example:
$ git help config
Git BasicsWorking with existsing directory
● $ git init
● $ git add README
● $ git commit -m 'initial project version'
● $ git remote add origin https://github.com/schacon/grit.git
● $ git pull
● $ git status
● $ git commit //If neccessary
● $ git push -u origin master
Git Basics
Clone from directory: SSH Key
$ git clone [email protected]:/opt/git/my_project.git
Create SSH Key:
https://help.github.com/articles/generating-ssh-keys
VERSION CONTROL
GIT TAG: used for creating stable release
$ git tag version1.1
Create tag
$ git push --tags
Push tag to server
Good to know● $ git fetch
//Shows what will come down with a pull
● $ git reset HEAD README
//Unstage the last commit
● $ git checkhout --README
//Revert file README
● $ git revert
//Commit changes to undo last commits
● $ git commit -amend
//Modify the last commit
● $ git blame
//Determine who made a specific change
GIT Branches
Use Branch$ git checkout -b newBranch
create new branch
$ git branch
List all branch
$ git checkout newBranch
Move HEAD to new branch
$ git branch -d iss53
Delete branch iss53
$ git merge iss53
Merge current branch with iss53
TOOL
GitXDev
SmartGit
…
Tool are listed here
Some web-based hosting
Reference
Git guide from github.io
Set up Git with bitbucket
Pro Git book
THANK YOU!