Browse Source

Afternoon workshops - part 1

Skia 3 years ago
  1. 51
      workshops/3 - Deep clean your Git repos (with LFS)/
  2. 54
      workshops/4 - Git Legit/

workshops/3 - Deep clean your Git repos (with LFS)/

@ -0,0 +1,51 @@
# Deep clean your Git repos (with LFS)
## Why cleaning
- Reduce repo size
- Speed up many git operations
- Seems a good thing to have many small repos (Octopus, etc...)
## A bit of theory
- hash, sha1, usual stuff
- A commit is:
- A commit message
- Author
- A file list with hashes
- A parent commit hash
- Deleting a file in an old commit lead to rewriting the whole repository
- This should be avoided at all cost!
## git LFS 101
- Adding huge binary blobs make a git repo to grow very large quickly
- git LFS stores references to big files, that will be stored aside the repo
- The big files are handled by LFS at checkout time
## practice time
- clone
- clone
- `git cat-file --batch-all-objects --batch-check`
- `git rev-list --all --objects`
## If you want to rewrite history
1. Colleagues: Push all in-progress work
2. Colleagues: Delete local repository
3. Colleagues: stop working
4. You: `git clone --mirror`
5. You: rewrite history
6. You: `git push --mirror`
7. Colleagues: git clone
## A few tools
- git-sizer
- git-repo-analysis
- Maybe reven2 could use a rewrite
## Personal feedback
Very clean, precise, deep, and interesting presentation. Both practice and
theory, real use-cases with `git lfs`. In short, awesome guys.

workshops/4 - Git Legit/

@ -0,0 +1,54 @@
# Git Legit
Exercices made on this repo:
## Atomic commits
- Single irreducible unit
- Simple to track every change, simple to rebase, simple to bisect
## History
- small commits with clean messages
- `rebase -i`
- check point commits at the end of the day, then **push** them for the colleagues!
## Fine workflow when working on a personal branch
- `git checkout -b my_feature`
- `git commit -m "blah"`
- `git commit -m "bleh"`
- `git commit -m "bluh"`
- `git commit -m "forgot something for blah"`
- `git commit -m "forgot something for bleh"`
- `git commit -m "forgot something for bluh"`
- `git rebase -i` -> put it like this:
pick 1ec3b8e0462f blah
f 49907910bd51 forgot something for blah
pick 44fa399c080b bleh
f 420ab26cbd4a forgot something for bleh
pick 8655b0f62763 bluh
f ab4ob01edf99 forgot something for bluh
- `git push -f`
## git bisect example
- `git bisect start`
- `git bisect good c0be65c`
- `git bisect bad fa21802`
- run your tests
- `git bisect good` or `git bisect bad`
- repeat two last steps
## Personal feelings
Nice workshop going through clear and simple practical examples, well explained
and illustrated.
She confirmed many things:
- squashed merges are not that good, better to use atomic commits
- personal branch like above is great
- bisect is very effective when using atomic commits, again
- specifying what is done clearly in the commit title, then the details in the body