Version Control
Let there be collaboration
Joey Freund, CSC301, Fall 2014
The Problem
Collaboration
Requirements
Very Simple Solution
New Requirements
Simple Solution
New Requirements
Solution - Version Control System
New Requirements
Solution - Distributed VCS
VCS vs. DVCS
VCS | Distributed VCS |
|
|
Advantages of DVCS
Contribute to OSS with SVN
Contribute to OSS with SVN
Contribute to OSS with SVN
Contribute to OSS with DVCS
Git
GitHub
Learning Git
Many resources on the web, for example:
Learning Git
# Clone a remote repository
> git clone https://github.com/csc301-fall2014/test-repo.git
> cd test-repo
# Two useful commands
> git status
> git log
# Add (and commit) a new file
> echo "hello" > a.txt
> git add a.txt
> git commit -m "Adding a file"
# Try these now ...
> git status
> git log
# Push the changes to the remote repository
> git push origin master
> git status
# Workflow example
# ----------------
# Make local changes …
# Pull changes from the remote repository
> git pull
# Resolve conflicts manually, if necessary …
> git commit -a -m "Resolved conflicts"
> git push origin master
Branching
# Create (and switch to) a new branch
> git checkout -b feature_branch
# Commit some changes to this branch
> echo "foo" > b.txt
> git add b.txt
> git commit -m "Adding another file"
# Let’s see the status and log …
> git status
> git log --graph
# Switch between branches
> git checkout master
> ls
> git checkout feature_branch
> ls
# Create the branch at the remote repository,
# and push the changes
> git push origin feature_branch
# Merge the branch back with the master branch
> git checkout master
> git merge feature_branch
# Push the changes to the remote repo’s master
> git push origin master
Git Terminology
Git Terminology
Git in practice
Usage Scenarios
Using Git
Usage Scenarios
Using Git
Usage Scenarios
Using Git
Usage Scenarios
Using Git
Usage Scenarios
Using Git
Usage Scenarios
Using Git
Let’s stop here
Your Homework