Presentation URL: https://gitpitch.com/devopsacademyau/academy?p=classes/01class/git/
- Pessimistic locking, code duplication
- Local versioning -> Copy and paste (Let's duplicate!)
- Version overwriting (Who deleted my version!?)
- Locked file (Can you please release file customers.xls, please!?)
- Are there other problems?
- Created by Linus Torvalds in 2005 for development of the Linux kernel
- Git is a distributed VCS
- Centralized vs Distributed VCS?
- Optimistic vs Pessimistic locking?
- Centralised:
- Centralised master version
- Code Check outs (one developer is allowed to work on that part of the code at any one time.)
- Locking controlled by the server
- Release records version numbers of all elements
- Distributed:
- Entire history of changes cloned by developers
- No locking
- Changes modify history (append or rewrite)
- Release is a history of changes
So, how git achieves optimistic locking so developers can work in parallel in the same file?
-
start a working area (see also: git help tutorial)
- clone Clone a repository into a new directory
- init Create an empty Git repository or reinitialize an existing one
-
work on the current change (see also: git help everyday)
- add Add file contents to the index
- mv Move or rename a file, a directory, or a symlink
- reset Reset current HEAD to the specified state
- rm Remove files from the working tree and from the index
-
examine the history and state (see also: git help revisions)
- bisect Use binary search to find the commit that introduced a bug
- grep Print lines matching a pattern
- log Show commit logs
- show Show various types of objects
- status Show the working tree status
-
grow, mark and tweak your common history
- branch List, create, or delete branches
- checkout Switch branches or restore working tree files
- commit Record changes to the repository
- diff Show changes between commits, commit and working tree, etc
- merge Join two or more development histories together
- rebase Reapply commits on top of another base tip
- tag Create, list, delete or verify a tag object signed with GPG
-
collaborate (see also: git help workflows)
- fetch Download objects and refs from another repository
- pull Fetch from and integrate with another repository or a local branch
- push Update remote refs along with associated objects
Let's add a folder to hold exercises for classes
- Check README.md in the root for instructions.
- Add, commit and push it to your remote dev branch 🎉
- Create a Pull Request (PR)
How can we have a standard approach to work as one team?
Short lived branches simplify a lot of things! https://trunkbaseddevelopment.com/
git checkout feature
git merge master
git checkout feature
git rebase master
Merging and Rebasing
- Access https://learngitbranching.js.org/
- Merging exercise:
- type
level intro3
- type
- Rebasing exercise:
- type
level intro4
- type
OMG, I don't know what I did!