Now i git it!!!
Upcoming SlideShare
Loading in...5
×
 

Now i git it!!!

on

  • 580 views

 

Statistics

Views

Total Views
580
Views on SlideShare
579
Embed Views
1

Actions

Likes
1
Downloads
1
Comments
1

1 Embed 1

https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Now i git it!!! Now i git it!!! Presentation Transcript

  • Now I get it!!!> git config --global -l | grep useruser.name=Yoram Michaeliuser.email=yorammi@tikalk.comhttp://www.tikalk.com
  • Version Control System (VCS)Now I GIT it!!!
  • GIT origins and start-points● Created by Linus Torvalds (created Linux aswell)● Linux kernel project● Meant to be○ Fast distributed system○ Capable of handling large projects● Command line interface● Official GIT site: http://git-scm.com● There are many available GUI tools> git helpusage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p|--paginate|--no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>][-c name=value] [--help]<command> [<args>]Now I GIT it!!!
  • Lets GIT started● Installation - depends on the OS● Initial global configuration> git config --global user.name "Bill Gates"> git config --global user.email bill.gates@microsoft.com> git config --global color.ui trueNow I GIT it!!!
  • Lets GIT going● Start a new empty local repository> mkdir NowIGitIt> cd NowIGitIt> git initInitialized empty Git repository in ~/Documents/Tikal/git_demo/NowIGitIt/.git/> git status# On branch master## Initial commit#nothing to commit (create/copy files and use "git add" to track)Now I GIT it!!!
  • Common workflow - new fileNow I GIT it!!!Step Command Output of git status commandCreate file locally echo start > First.txt # On branch master## Initial commit## Untracked files:# (use "git add <file>..." to include in what will be committed)## First.txtnothing added to commit but untracked files present (use "git add"to track)Add file to stagingareagit add First.txt # On branch master## Initial commit## Changes to be committed:# (use "git rm --cached <file>..." to unstage)## new file: First.txt#Commit changes git commit First.txt -m "Firstcommit"output of command:master (root-commit) 30e3004] First commit1 file changed, 1 insertion(+)create mode 100644 First.txt# On branch masternothing to commit (working directory clean)
  • Common workflow - modified fileNow I GIT it!!!Step Command Output of git status commandChange file locally echo changed > First.txt # On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes inworking directory)## modified: First.txt#no changes added to commit (use "git add" and/or "gitcommit -a")Commit changes git commit First.txt -m "Secondcommit"output of command:[[master f1d433f] Second commit1 file changed, 1 insertion(+), 1 deletion(-)# On branch masternothing to commit (working directory clean)
  • GIT basic file flowNow I GIT it!!!
  • GIT log - view historyNow I GIT it!!!> git logcommit f1d433f5b79a10b9a12dc8277bc9aae62bff0cfaAuthor: Yoram Michaeli <yorammi@tikalk.com>Date: Fri May 3 14:58:51 2013 +0300Second commitcommit 30e30041fdb8f97751ddc3f99da25a960b6d3b74Author: Yoram Michaeli <yorammi@tikalk.com>Date: Fri May 3 14:41:44 2013 +0300First commit
  • GIT diff - where things matters...> echo change2 > First.txt> git diffdiff --git a/First.txt b/First.txtindex 5ea2ed4..39c5733 100644--- a/First.txt+++ b/First.txt@@ -1 +1 @@-changed+change2Now I GIT it!!!
  • Regretting what Ive done...Now I GIT it!!!Action Command Output of git status commandUnstaging a file git reset HEAD First.txtoutput of command:Unstaged changes after reset:M First.txt# On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes inworking directory)## modified: First.txt#no changes added to commit (use "git add" and/or "gitcommit -a")Discard changes git checkout -- First.txt # On branch masternothing to commit (working directory clean)Undoing a commit git reset --soft HEAD^ # On branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## modified: First.txt#
  • GIT collaborationNow I GIT it!!!
  • GIT Repository clone> git clone https://github.com/tikalk/NowIGitIt.git● Clone an existing repository as a localrepository● Clones into current folder● Can be named differently than the originrepositoryNow I GIT it!!!
  • Add remote GIT repository> git remote add origin https://github.com/tikalk/NowIGitIt.git● Clone command add origin remoteautomatically● More than one remote is possible● Use git remote remove <name> to remove aremoteNow I GIT it!!!
  • Push to a remote repository> git push -u origin master● Push changes on local repository into aremote repository● Will fail if there are conflicts● Fast-forward push is the best!Now I GIT it!!!
  • Pull from remote repository> git pull● Pull changes from remote repository into thelocal repository● Will fail if there are conflicts● Fast-forward pull is the best!Now I GIT it!!!
  • GIT Branching> git branch unofficial> git branch* masterunofficial> git checkout unofficialSwitched to branch unofficial> git branchmaster* unofficialNow I GIT it!!!
  • GIT Merging> git checkout unofficial> echo "Now I GIT it" > README.txt> git add README.txt> git commit -m "Add README file"> git checkout master> git merge unofficialNow I GIT it!!!
  • Add GIT tag> git tag -a tag1 -m "first tag"> git tag -a tag2 -m "second tag"> git tagtag1tag2> git tag -d tag2> git tagtag1Now I GIT it!!!
  • And if you still dont GIT it...● Git introduction● GIT real● Linus talks about gitNow I GIT it!!!
  • Now I GIT it!!!