Git: from commit to merge João Marins
João Marins @jgcmarins @jgcmarins 2
History 3 Linus Torvalds
Writing an OS 4 - Multiple teams over the world - Lots of features - Lots of bug fixes - How to not overwrite anything?
Existing Tools 5 - CVS - BitKeeper
6 GIT Linus Torvalds “Source code control: the way it was meant to be.” https://www.youtube.com/watch?v =4XpnKHJAok8
7 Concurrency
8 Branch System
Distributed System 9 - Work on your local copy (branch) - Push your changes - Request approval - Get merged
Remotes 10 - Software source code - Also source of truth - Safe
Commit 11 - Do your work locally - Create a branch from another - Add your changes to the new branch - Commit your changes with a message
Push 12 From locally to remote o/
Pull Request 13 - Your branch is ready on remote - Open pull request - Review - Approved o/
Merge: get shit done 14 - Your branch to master branch - Do not be afraid - Make sure your code works - Congratulations o/
Resolving Conflicts 15 - Sometimes it happens - Same files - Move fast - Merge first
Writing a Software 16
Introducing features to a code base 17 - git clone x git remote add - git fetch - git pull - git branch - Git status - git checkout - git add - git commit - git push - Git diff
Team work 18 Pull before Push o/
Code Review 19 - You are responsible for your code - Be nice with your coworkers - Review what is to be reviewed - Just make sure it makes sense
Best Practices 20
7 rules 21 - Separate subject from body with a blank line - Limit the subject line to 50 characters - Capitalize the subject line - Do not end the subject line with a period - Use the imperative mood in the subject line (example: Create instead of Created or Creating) - Wrap the body at 72 characters - Use the body to explain what and why vs. how
7 rules 22 https://chris.beams.io/posts/git-commit/
Branch Naming 23 - [kind-of-change]/[what-is-being-changed] Examples: - fix/user-name-during-login - improvement/login-screen - feature/charge-customer-screen
Promote to production 24 - After everything get approved, merged, tested etc - Promote code to production
Tools 25
SSH 26 - Clone you repo with ssh instead of https - Easy - Safe - Fast
Alias 27
Hands on 28 - Presence List - Master vs Production - Multiple Remotes - Mono Repo
Challenge 29 - Choose a open source project you like - Fork it - Make your local changes - Open a Pull Request - Get your changes MERGED o/
Links 30 - https://github.com/sibelius/cmds/blob/master/README.md#git - https://stackoverflow.com/questions/492558/removing-multiple-files-from-a-git-repo-that-have-alrea dy-been-deleted-from-disk - https://git-scm.com/docs/git-cherry-pick - https://chris.beams.io/posts/git-commit/
Thanks!!! 31 We are hiring

git - from commit to merge - semcomp beta 2018 workshop