Code & Coffee - 4/29/2022
Topic: "Git Tips & Tricks"
- The first tip came even before we started:
- "I won't be able to make it tomorrow but I'm sure Dave will bring up many of my favorites, but in case he doesn't, git worktree, git restore, patch mode, git add -N/--intent-to-add ........"
- git worktree:
- Manages multiple working trees attached to the same repo
- Docs: https://git-scm.com/docs/git-worktree
- It can be used as a more sophisticated stash
- See the example for a usage scenario: https://git-scm.com/docs/git-worktree#_examples
- Use caution, or don't use it when working on a repository with submodules, see note at the end.
- ** Uses the same set of objects **
- git restore:
- This is part of the switch/restore split up of the checkout command.
- Use this command to selectively pluck files from another branch.
- Docs: https://git-scm.com/docs/git-restore
- Warning from the docs:
- "THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE."
- Yup it is just like that in the docs, must be kinda important.
- Differences between Reset, Restore and Revert from the docs:
- Patch mode:
- git add -N/--intent-to-add ......
- Inform git that you will be adding a path in the future, this allows you to see the files in the directory when running git status and seeing diffs with git diff.
- Docs: https://git-scm.com/docs/git-add#Documentation/git-add.txt--N
- Squashing commits
- it is part of git merge, dig up docs
- Signing commits
- why and how
- git bisect
- use case and how to use it
- it has a mode where you can pass in a script and it will automatically find the issue
- "Arlo's git notation"
- find a link
- commit message prefix indicates the nature of the commit
- Git log
- show only merges
- Git garbage collection
- what it is for and how it works
- oops checked in node_modules again
- oops that password shouldn't have been in there.
- Pre-commit hooks/hooks in general
- vulgarity checker.... or maybe just runs the tests and linter
- Interactive add
- see git add -N
- -P will get straight to patch mode without the menu
- many commands that change the index support patch mode
- git reset -tests
- git diff
- dave's rebase strategy...
- heard only part of it, was in the other meeting already
- git rerere - setting to help with repeated rebase resolution
No comments:
Post a Comment