git essentials
DESCRIPTION
Originally presented at the Northeast PHP 2013 conference. Git is hard to learn, but that's not a good excuse to ignore it. This presentation aims to teach the bare essentials for operating a git repository.TRANSCRIPT
![Page 1: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/1.jpg)
Git Essentials
By Matthew Barlocker
![Page 2: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/2.jpg)
The Barlocker
● Chief Architect at Lucid Software Inc
● Used Subversion and Git since 2006
● Graduated with B.S. from BYU in 2008
● Developed software for the following industries:
– Network Security
– Social Gaming
– Financial
– Productivity
![Page 3: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/3.jpg)
Creating a Repo, Staging, and Committing(terminal)
![Page 4: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/4.jpg)
Creating, Staging, and Committing
● Git repos can be created anywhere.● Only the staging area will be committed.● Every commit is identified by an md5 hash
generated by git.
![Page 5: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/5.jpg)
Commit Graph
![Page 6: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/6.jpg)
Log, Diff, Reset and Revert(terminal)
![Page 7: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/7.jpg)
Log, Diff and Revert
● Reverting in Subversion is NOT the same as reverting in Git. Reverting in Git is reversing a commit.
● `git revert` will keep the bad commit in the history. `git reset --hard` will not.
![Page 8: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/8.jpg)
Tagging, Branching, and Checkout
● HEAD is the working directory.● Everything happens on HEAD – committing,
merging, rebasing, cherry-picking, etc.● Branching is easy. Use them for everything!
![Page 9: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/9.jpg)
Tagging, Branching, and Checkout
![Page 10: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/10.jpg)
Tagging, Branching, and Checkout(terminal)
![Page 11: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/11.jpg)
Tagging, Branching, and Checkout
![Page 12: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/12.jpg)
Stash(terminal)
![Page 13: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/13.jpg)
Merge vs Rebase
● Merge will create a merge commit.● Rebase will rewrite history since the last
commit in common.
![Page 14: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/14.jpg)
Merge
![Page 15: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/15.jpg)
Rebase
![Page 16: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/16.jpg)
Merge vs Rebase
● Merge history cannot be reverted!● Rebasing ruins sharing!● In a fast-forward, these do the same thing.
![Page 17: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/17.jpg)
Merge & Rebase(terminal)
![Page 18: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/18.jpg)
Remotes
● Every repository has a full clone of every commit, tag, and branch.
● “Remotes” are other clones of the same repository.
● The repository you cloned from is always called 'origin'.
![Page 19: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/19.jpg)
Remotes & Clone(terminal)
![Page 20: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/20.jpg)
Fetch, Pull and Push(terminal)
![Page 21: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/21.jpg)
Fun Commands to Research
● `git cherry-pick`● `git bisect`● `git add -i`● `git merge-base`● `git rebase -i`
![Page 22: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/22.jpg)
Any Questions?
![Page 23: Git essentials](https://reader033.vdocument.in/reader033/viewer/2022052522/554f9351b4c905435d8b51c2/html5/thumbnails/23.jpg)
Lucid Software Inc● Building the next generation of collaborative web
applications
● VC funded, high growth, profitable
● Graduates from Harvard, MIT, Stanford
● Team has worked at Google, Amazon, Microsoft
https://www.lucidchart.com/jobs