Okay, one more... Ever commit something only to immediately realize that you're on the wrong branch? Use "git move <branch>".
Interesting… I typically commit, cut a branch, reset current. Find it doesn't disrupt my workflow and avoids complex commands like stash.
That approach requires three checkouts if you want to end up on new branch, hence the stashing.
You need to collect these in a blog post or something, so they don't get lost in the depths of Twitter.
Agreed. They're in my .gitconfig so they're there whenever I get around to blogging again... I've got quite a backlog.
I would have thought cherry-pick then reset head would be a *lot* cleaner....
It's pick your poison, really. Here's the same end result using cherry-pick:
I personally just "git checkout -b NEWBRANCH" then go back to the previous branch and reset to the last good commit
So... three checkouts by the time you get back to the new branch to continue working?
Later in the thread we evolved it to a branch, rebase onto, checkout three step, though works only for existing branches.
Not so much. Here's the same end result using cherry-pick:
This feels good. Need to make this a lib or something.
It could use a graceful failure when omitting the new branch name, also should confirm branch creation if it doesn't exist. But, yeah. :)
If junio can trust it, why not try to push it to the project instead? If junio can trust it.
United States Trends
- 1. New York 35.7K posts
- 2. #questpit 19.4K posts
- 3. Van Jones 7,316 posts
- 4. Sauer 2,674 posts
- 5. $LMT $450.50 Lockheed F-35 N/A
- 6. #wednesdaymotivation 2,684 posts
- 7. $SENS $0.70 Senseonics CGM N/A
- 8. 5th of November 22.3K posts
- 9. #5SOS_SELFIEDAY N/A
- 10. IEEPA 2,175 posts
- 11. Good Wednesday 34K posts
- 12. $APDN $0.20 Applied DNA N/A
- 13. Balmain 3,220 posts
- 14. Hump Day 16.6K posts
- 15. #Wednesdayvibe 1,994 posts
- 16. Enhanced 12.4K posts
- 17. Socialism 120K posts
- 18. Miss Piggy 2,553 posts
- 19. The GOP 306K posts
- 20. Alastor 44.6K posts
Something went wrong.
Something went wrong.