L05-Version-Control-Gitcs480.yusun.io/slides/l04.pdf · • Popular. Git History B .KPWU 6QTXCNFU...
Transcript of L05-Version-Control-Gitcs480.yusun.io/slides/l04.pdf · • Popular. Git History B .KPWU 6QTXCNFU...
Version Control - A Brief Introduction to Git
CS480 Software Engineering
Yu Sun, Ph.D. http://yusun.io [email protected]
Why Version Control?
Maintain Multiple Versions
• Safe backup
• Change version
Collaboration The problem to avoid
Collaboration The lock-modify-unlock solution
Collaboration The copy-modify-merge solution
Collaboration The copy-modify-merge solution
Monitor and Track Progress
Code Difference
Code Contribution
Why Git?
Why Git?
• Performance
• Github
• Popular
Git History
Why Command-Line?
Why Git Command-Line?
• GraphicalclientsarebasedonCLT
• Graphicalclientscouldcauseproblems
• Integratedwithshellscripts
• Graphicalclientsnotalwaysavailable
Git Exercises
1. Create Git Repositories
• gitclone<repo>
• gitinit<repo>
local repository
remote repository
local repository
local repository
2. Add/Commit/Push
• gitadd<path>
• gitcommit
• gitpush
working directory
staging area
local repository
remote repository
git add
git commit
git push
localremote
3. Check Status
• gitstatus
• gitlog
• gitbranch
4. Sync Changes & Resolve Conflicts
• gitpull--rebase(referredapproach)
• gitpull
• gitstatus
• //cleanupconflicts
• gitadd<conflictedfile>
• gitrebase--continue
• gitpush
local repository
remote repository
git pull --rebase
localremote
5. Branches
• gitcheckout-b<branch>
• gitcheckout<branch>
• gitmerge<branch>
Feature Branch
Master
6. Git Undo
• Alwaysbackupfirst
• GooglethesoluAon
Git Learning Resources
• http://git-scm.com/
• https://www.youtube.com/user/GitHubGuides
• Google it!
Git Basics Overview