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. Cowboys 26.6K posts
- 2. Jets 88.8K posts
- 3. Jonathan Taylor 6,692 posts
- 4. Bengals 52.5K posts
- 5. Eagles 119K posts
- 6. Caleb 38.4K posts
- 7. Giants 98.9K posts
- 8. Riley Moss 1,106 posts
- 9. Saints 28.8K posts
- 10. Bo Nix 4,506 posts
- 11. Shough 2,984 posts
- 12. Zac Taylor 5,551 posts
- 13. Falcons 39.8K posts
- 14. Rattler 5,252 posts
- 15. Browns 50.1K posts
- 16. Sutton 5,298 posts
- 17. #BroncosCountry 2,910 posts
- 18. Myles Garrett 9,997 posts
- 19. Blaney 4,335 posts
- 20. Bears 67.6K posts
Something went wrong.
Something went wrong.