Geting git
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6216/logo_2x.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6348/branching-illustration_2x.png)
Mojtaba Shahi Senobari --- Amirehsan Davoodi
What is Git?
Distributed (Decentralized)
version control system
VCS Types
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6235/SCM-taxonomy.png)
CENTRALIZED VCS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6237/18333fig0102-tn.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6237/18333fig0102-tn.png)
Distributed VCS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6238/18333fig0103-tn.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6238/18333fig0103-tn.png)
Delta Base Repository
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6240/delta-commit-5.png)
DAg Base repository
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6242/dag-commit-5.png)
GIT DESIGN GOALS
• Speed
• Simple design
• Strong support for thousands of parallel branches
• Fully distributed
• Able to handle larges projects like Linux kernel effectively
GIT DOESN'T DELETE
• Git generally only adds data
• If you mess up, you can usually recover your stuff
• Recovery can be tricky though
WorkFlow
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6249/18333fig0106-tn.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6251/Screen_Shot_2013-05-15_at_2.26.38_AM.png)
CONFIGURATION
IDENTITY
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
CREATING A REPOSITORY
$ git init
CLONING A REPOSITORY
$ GIT CLONE HTTPS://GITHUB.COM/DBRGN/FAHRPLAN
$ GIT CLONE HTTPS://GITHUB.COM/DBRGN/FAHRPLAN
Common Commands (1)
ADD NEW FILE
$ git add README.rst
REMOVE FILE
$ git rm file.py
COMMIT CHANGES
$ git commit -am 'First commit'
COMMON COMMANDS (2)
SHOW LOG
$ git log
SHOW COMMITS
$ git show
SHOW DIFFS
$ git diff
UNDOING THINGS
UNMODIFY MODIFIED FILE
$ git checkout -- file.py
REVERT A COMMIT
$ git revert 1776f5
BRANCHES
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6274/18333fig0319-tn.png)
BRANCH MANAGEMENT
Create new Branch
$ git branch iss53
$ git checkout -b iss53 master
Switch Branch
$ git checkout iss53
Delete Branch
$ git branch -d iss53
Show All Branch
$ git branch -d iss53 iss53
* master
testing
Remote Repository
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6343/deploy3.png)
Remote Command
Push To remote
$ git push origin branch_name
Fetch & Merge
$ git pull
Fetch
$ git fetch origin
Merge
$ git merge origin master
Merge conflicts
$ git merge iss53 Auto-merging index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6286/image.png)
NOW GIT TO WORK!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6293/image__1_.png)
Where is the Place of Review?
workFlow
- initial (clone = copy)
- fetch & merge (pull)
- branching your local repository [optional]
- modify (improve)
- commit to local repository
- push to your branch on origin
- Diff File = File for showing changes
We do Review At this stage
PROFESSIONALS review code to FIND OUT errors
Riview Tools
![](https://s3.amazonaws.com/media-p.slid.es/uploads/moji3000/images/6322/Screen_Shot_2013-05-15_at_4.10.55_AM.png)
-
Web-based Collaborative Code Review
- Free software
- Integrated with most VCS
- Install on any server
resources:
many
Thanks
Git presentation
By Mojtaba Shahi
Git presentation
Git Presentation for Software Engineering 2 Course
- 25,211