Geting git
Mojtaba Shahi Senobari --- Amirehsan Davoodi
What is Git?
Distributed (Decentralized)
version control system
VCS Types
CENTRALIZED VCS
Distributed VCS
Delta Base Repository
DAg Base repository
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
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
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
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.
NOW GIT TO WORK!
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
-
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,086