Getting Started on distributed version control with git
-
Upload
anoop-thomas-mathew -
Category
Engineering
-
view
540 -
download
3
description
Transcript of Getting Started on distributed version control with git
![Page 1: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/1.jpg)
ANOOP THOMAS MATHEWCTO @ Profoundis Inc.
Getting Started with git
![Page 2: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/2.jpg)
A Little Story
April 2005
Linux Kernel
BitKeeper issue
Linus Torvalds 36% professional developers
@atmb4u
![Page 3: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/3.jpg)
Need for Distributed Version Control
Meet Smarty!
He works as a Software Developer.
@atmb4u
![Page 4: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/4.jpg)
Need for Distributed Version Control
● His job– Create– Save– Edit– Repeat.
● Smarty's friends want to collaborate?
@atmb4u
![Page 5: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/5.jpg)
Need for Distributed Version Control
@atmb4u
![Page 6: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/6.jpg)
git Basics
● Distributed● Collaborative History Tracking● Merge● Flexible● Fast
@atmb4u
![Page 7: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/7.jpg)
git workflow
@atmb4u
![Page 8: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/8.jpg)
git workflow
@atmb4u
1. You MODIFY files in your working directory.
2. You STAGE the files, adding snapshots of them to your staging area.
3. You do a COMMIT, which takes the files as they are in the staging area and stores that snapshot permanently to your git directory.
![Page 9: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/9.jpg)
git Basics
@atmb4u
![Page 10: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/10.jpg)
@atmb4u@atmb4u
git commands
![Page 11: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/11.jpg)
● git config --global user.name "UserName"● git config --global user.email “[email protected]”
git config
@atmb4u@atmb4u
![Page 12: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/12.jpg)
initialize a git repository on current folder
git init
@atmb4u
![Page 13: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/13.jpg)
Retrives the status of the git repository
git status
@atmb4u
![Page 14: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/14.jpg)
● Adds the file to the version control● git add <filename>
git add
@atmb4u
![Page 15: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/15.jpg)
● Commit the added changes to the repo● git commit -m “commit message”
git commit
@atmb4u
![Page 16: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/16.jpg)
● Add a remote server location for the repo● git remote add origin <remote url>● git remote rm origin
git remote
@atmb4u
![Page 17: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/17.jpg)
● Push changes to the destination● git push origin master
remote branch
git push
@atmb4u
![Page 18: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/18.jpg)
● Shows the history of commits of the current branch
git log
@atmb4u
![Page 19: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/19.jpg)
● Shows the difference between two commits in git● git diff 23f4af3 09fb5f2● Writing this to a file gives you a patch
git diff
@atmb4u
![Page 20: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/20.jpg)
● Include all changes specified in a patch file● git apply <patch file>
git apply
@atmb4u
![Page 21: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/21.jpg)
● download new branches and data from a remote repository
git fetch
@atmb4u
![Page 22: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/22.jpg)
● fetch from a remote repo and try to merge into the current branch
● git pull <remote location> <branch>
git pull
@atmb4u
![Page 23: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/23.jpg)
● list, create and manage working contexts● git branch● git branch <branch name>
(create new branch)
git branch
@atmb4u
![Page 24: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/24.jpg)
● switch to a new branch context● git checkout <branch name>● git checkout -b <branch name>
(create branch and checkout)
git checkout
@atmb4u
![Page 25: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/25.jpg)
● merge a branch context into your current one
● git merge
git merge
@atmb4u
![Page 26: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/26.jpg)
Merge conflicts !
@atmb4u
![Page 27: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/27.jpg)
● tag a point in history as important● git tag -a v1.0
git tag
@atmb4u
![Page 28: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/28.jpg)
● remove files from the staging area● git rm <file name>● git rm –cached <file name>
git rm
@atmb4u
![Page 29: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/29.jpg)
● save changes in the current index and working directory for later
● git stash● git stash apply● git stash list● git stash drop
git stash
@atmb4u
![Page 30: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/30.jpg)
● save changes in the current index and working directory for later
● git reset HEAD <file name>● git reset --soft● git reset HEAD --hard
git reset
@atmb4u
![Page 31: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/31.jpg)
● copy a git repository so you can add to it● git clone <remote repo url>
git clone
@atmb4u
![Page 32: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/32.jpg)
● github● Learn a language of choice● Commit once a day
Live Projects
@atmb4u
![Page 33: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/33.jpg)
Code Explorer's Guideto the Open Source Jungle
https://leanpub.com/opensourcebook/
My new Book
@atmb4u
FREE
![Page 34: Getting Started on distributed version control with git](https://reader033.fdocuments.us/reader033/viewer/2022052504/5549a1d4b4c905a6758b4e90/html5/thumbnails/34.jpg)
● @atmb4u● We are looking for interns.
Thank You !
@atmb4u