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 趨勢
- 1. #UFC321 109K posts
- 2. Gane 122K posts
- 3. Aspinall 109K posts
- 4. Jon Jones 9,435 posts
- 5. Liverpool 161K posts
- 6. Ryan Williams N/A
- 7. $SWC 2,948 posts
- 8. Mizzou 4,248 posts
- 9. Mateer 5,772 posts
- 10. Kirby Moore N/A
- 11. Iowa 15.9K posts
- 12. Slot 107K posts
- 13. Brentford 67.6K posts
- 14. June Lockhart 4,148 posts
- 15. Ole Miss 13.7K posts
- 16. Dern 61.9K posts
- 17. Pribula N/A
- 18. Matt Zollers N/A
- 19. Aaron Henry N/A
- 20. McCabe 1,421 posts
Something went wrong.
Something went wrong.