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.
Would it not be better to cherry pick at that point ?
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 Xu hướng
- 1. Good Wednesday 24K posts
- 2. Hump Day 11.2K posts
- 3. #NationalCatDay N/A
- 4. #MAYATVAWARDS2025 768K posts
- 5. Huda 14.5K posts
- 6. Happy Hump 6,748 posts
- 7. #wednesdaymotivation 2,619 posts
- 8. South Korea 103K posts
- 9. ZNN AT MAYA25 413K posts
- 10. #PutThatInYourPipe N/A
- 11. #Wednesdayvibe 1,561 posts
- 12. Jay Z 6,974 posts
- 13. Tapper 29.6K posts
- 14. Wayne 94K posts
- 15. Clippers 15K posts
- 16. Namjoon 213K posts
- 17. Don Lemon 10.7K posts
- 18. Bill Gates 68.6K posts
- 19. Harden 11K posts
- 20. Eminem 12.3K posts
Something went wrong.
Something went wrong.