On Github Landric / version-control
Tom Blount
Sildes available at: http://tomblount.co.uk/version-control
Overview:
Setting up git:
Tom@ECS ~/Documents/SEG_Project $ git config --global user.name "Tom" $ git config --global user.email tb12g09@ecs.soton.ac.uk
Initialising a (local) repository:
Tom@ECS ~/Documents/SEG_Project $ git init Initialized empty Git repository in C:/Users/Tom/Documents/SEG_Project/.git/
Accessing an existing project:
Tom@ECS ~/Documents $ git clone git@sourcekettle.ecs.soton.ac.uk:projects/SEG_Project.git Cloning into 'SEG_Project'... remote: Counting objects: 4051, done. remote: Compressing objects: 100% (2824/2824), done. remote: Total 4051 (delta 1170), reused 4051 (delta 1170) Receiving objects: 100% (4051/4051), 2.10 MiB | 314.00 KiB/s, done. Resolving deltas: 100% (1170/1170), done. Checking connectivity... done. Checking out files: 100% (1384/1384), done.
(You might need a Public Key to be able to do this)
Checking the status:
Tom@ECS ~/Documents/SEG_Project (master) $ git status # On branch master # # Initial commit # nothing to commit (create/copy files and use "git add" to track)
Creating and adding a file:
Tom@ECS ~/Documents/SEG_Project (master) $ touch README $ git add README $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: README #
Committing a file:
Tom@ECS ~/Documents/SEG_Project (master) $ git commit -am "Added README file" [master (root-commit) d616bbe] Added a README 1 file changed, 0 insertions(+), 0 deletions(-) create mode 10064 README
Connecting to a remote repository:
Tom@ECS ~/Documents/SEG_Project (master) $ git remote add origin git@sourcekettle.ecs.soton.ac.uk:projects/SEG_Project.git
(You might need a Public Key to be able to do this too)
Pulling/pushing changes from/to the remote server:
Tom@ECS ~/Documents/SEG_Project (master) $ git pull -u origin master Already up-to-date $ git push Counting objects: 3, done. Writing objects: 100% (3/3), 215 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To git@sourcekettle.ecs.soton.ac.uk:projects/SEG_Project.git * [new branch] master -> master Branch master set up to track remote branch master from origin
Hint: always do a pull before you push!
Overview (again):
Make sure you use a private repository!
Make sure you use a private repository!