A presentation at Women Who Code NYC Lightning Talks in in New York, NY, USA by Monica Powell
git is hard but time travel in git is easy. PRESENTATION BY MONICA POWELL @waterproofheart 🔗 www.aboutmonica.com/
Hi, I’m Monica Powell! I’m a Full Stack Engineer at Meetup and organizer of the React Ladies Meetup group. I’ve written about git and other tech adventures in publications such as FreeCodeCamp, Hacker Noon and Code Like A Girl. @waterproofheart 🔗 www.aboutmonica.com/
Talk Outline 1. Introduction 2. How to write git commits dated in the future 3. Changing the languages that GitHub auto-detects in a repository 4. Automating git workflow 5. Resources @waterproofheart 🔗 www.aboutmonica.com/
What is git? A distributed version-control system for tracking changes in source code during software development. @waterproofheart 🔗 www.aboutmonica.com/
What is the relationship between GitHub/BitBucket/GitLab and git?? @waterproofheart 🔗 www.aboutmonica.com/
TIME TRAVEL IN GIT It’s not a bug! It’s a feature. @waterproofheart 🔗 www.aboutmonica.com/
DEBUGGING The marketing mix is a business tool used in marketing and by marketers, originally can be used @waterproofheart 🔗 www.aboutmonica.com/
CREATE FUTURE COMMIT Checkout new branch Change computer time & replicate issue locally Squash bug and fix issue Commit and push fix Oops! @waterproofheart 🔗 www.aboutmonica.com/
Is that the only way to commit in the future? @waterproofheart 🔗 www.aboutmonica.com/
OTHER WAYS TO MODIFY COMMIT DATES
What does this look like on GitHub? Write here a list of features, textboxes easy to edit Here you can write more More about your project. Statistics, analysis and content export GIT_AUTHOR_DATE=”Wed Mar 20 15:12:30 2019 -0700” export GIT_COMMITTER_DATE=”Wed Mar 20 15:12:30 2019 -0700” git commit -m “future commit” @waterproofheart 🔗 www.aboutmonica.com/
@waterproofheart 🔗 www.aboutmonica.com/
Reclassify Language With One Line of Code @waterproofheart 🔗 www.aboutmonica.com/
Linguist library Python Application + CSS = 98.9% CSS and 1.1% Other??? @waterproofheart 🔗 www.aboutmonica.com/
Linguist library “This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs.” https://github.com/github/linguist#my-repository-isnt-showing-my-la nguage @waterproofheart 🔗 www.aboutmonica.com/
Linguist library 1 2 3 @waterproofheart 🔗 www.aboutmonica.com/
GIT HOOKS Automate your git workflow @waterproofheart 🔗 www.aboutmonica.com/
1 TIME TRAVEL IN GIT Build better presentations in less time @waterproofheart 🔗 www.aboutmonica.com/
1 TIME TRAVEL IN GIT Build better presentations in less time @waterproofheart 🔗 www.aboutmonica.com/
What is a git hook? Bash scripts that are executed at specific points within the git workflow. precommit, postcommit, prepush, postpush, etc…. Git Hooks Documentation: https://git-scm.com/docs/githooks @waterproofheart 🔗 www.aboutmonica.com/
Where do they live? Every Git repository has a hidden .git/hooks directory with a script for each hook you can bind to. These can be modified. @waterproofheart 🔗 www.aboutmonica.com/
How can git hooks be used? ● Warn when committing to master ● Run linting and tests before committing ● Warn or abort when committing code with: console.logs(), sensitive credentials, merge conflict strings or large files. ● Send notifications after a commit is pushed ● Sending intl objects to be translated ● And 1270824+ other ways. @waterproofheart 🔗 www.aboutmonica.com/
Git Hook Package.json Example @waterproofheart 🔗 www.aboutmonica.com/
Git Hooks Bash Script Example Warn when committing to master Run linting and tests before committing Warn or abort when committing code with: console.logs(), sensitive credentials, merge conflict strings or large file Send notifications after a commit is pushed Sending intl objects to be translated And 1270824+ other ways. @waterproofheart 🔗 www.aboutmonica.com/
How can git hooks be used? @waterproofheart 🔗 www.aboutmonica.com/
Limitations of Git Hooks ● Limited enforcement - can easily be overridden —no-verify or forced pushes ● Local hooks != shared hooks as .git/hooks not in version control ● Doesn’t replace CI, server-side branch protection or code reviews @waterproofheart 🔗 www.aboutmonica.com/
Helpful Git Resources • Git Lens Plugin https://gitlens.amod.io/ • Git Books https://git-scm.com/book/en/v2 • git-together — better attribution https://github.com/kejadlen/git-together • Husky https://github.com/typicode/husky • Git Attributes templates https://github.com/alexkaratarakis/gitatt ributes • Git Hook Templates https://github.com/pre-commit/pre-commit -hooks Git Hooks 101 Website https://githooks.com/ @waterproofheart 🔗 www.aboutmonica.com/
Thanks! Any questions? Feel free to reach out: monica@aboutmonica.com https://www.meetup.com/React-Ladies @waterproofheart 🔗 www.aboutmonica.com/
This talk will cover how I accidentally discovered time travel in git, how to tell GitHub what languages a repository is composed of & other Git/GitHub hacks to make working with it more delightful (or maybe just make your commit history less embarrassing) with git hooks.