Introduction to GIT
Distributed version control
Session mechanics
- Given as a classroom lecture with live demonstrations
- Please feel free to ask questions during the presentation.
- Links to resources will be provided both at the end of the presentation and the presentation can be found here:
Who am I?
Jørn Ølmheim, GBS IT SUB, Well Planning and Integrity
- More than 20 years experience
- Software craftsman
- Polyglot programmer
- Data and Solution Architecture, EITA
History
- Initially written by Linus Thorvalds in 2005
- Some of the goals of the new system was:
- Speed
- Simple Design
- Strong support for non-linear development (branching)
- Fully distributed
- Able to handle large projects like the Linux kernel efficiently
Good practices
Merge Before New Changes
Commit Related Changes
Commit Often
Don't Commit Half-Done Work
Test Before You Commit
Use Branches
Agree on a Workflow
Common commands
- git init: Initialize a new git repository.
- git status: Shows the status of the local workspace.
- git add: Add changes to the index.
- git commit -m: Commit local changes.
- git clone: Make a local copy of a git repository.
- git pull: Pull changes from remote repository.
- git push: Push changes to remote repository.
Other useful commands
- git fetch: Fetch changes from remote repository.
- git diff: View the differences between workspace and index.
- git checkout [-b]: Switches to a new branch or creates a branch (-b).
- git rm: Remove file from workspace and index.
- git mv: Move file in the workspace and index.
- git reset [--hard]: Reset local workspace and repository to match the remote.
- git add -p (--patch): Cherry pick changes to add.
Distributed version control
Centralized version control
Distributed version control
Resources and further reading