Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
capnsoup2438yThese are all very good so I think I'll add my personal favorite powertool to your list (I know you mentioned rebase already but I think this one deserves special mention):
git rebase -i
It's like rebase with 290% more magic since you can change how each commit is applied (including changing individual commits!). Oh how I love that command when I have to follow the Gerrit workflow. -
I used cherry pick very often when i was on a team that handled production issues. Often times other team members would commit fixes to feature branches that were nowhere near ready, but we needed the fix ASAP.
So much cleaner than duplicating the work in a new branch.
Related Rants
!rant.
Here's some useful git tricks. Use with care and remember to be careful to only rewrite history when noones looking.
- git rebase: powerful history rewriting. Combine commits, delete commits, reorder commits, etc.
- git reflog: unfuck yourself. Move back to where you were even if where you were was destroyed by rebasing or deleting. Git never deletes commits that you've seen within at least the last 50 HEAD changes, and not at all until a GC happens, so you can save yourself quite often.
- git cherry-pick: steal a commit into another branch. Useful for pulling things out of larger changesets.
- git worktree: checkout a different branch into a different folder using the same git repository.
- git fetch: get latest commits and origin HEADs without impacting local braches.
- git push --force-with-lease: force push without overwriting other's changes
undefined
git
version control