Okay, one more... Ever commit something only to immediately realize that you're on the wrong branch? Use "git move <branch>".
Again, only one is necessary if you use proper commands like branch and reset.
"proper" 🤔 But, yes, branch instead of checkout -b, avoids the three checkout dance. branch/reset/checkout indeed works... like this:
Why the "soft" checkout? My assumption would be the "incorrect" commit is not supposed to be on current branch and as such can be removed.
It's going to be removed when you checkout the other branch (it's gone if you return), but otherwise it unstages everything.
Hmmm. Should be able to include optional second argument to specify number of commits to "move", too. Bonus.
United States Trends
- 1. #NationalCatDay 3,081 posts
- 2. #SaveSudan 1,283 posts
- 3. Hutch 1,325 posts
- 4. FOMC 40.5K posts
- 5. Azure 12.6K posts
- 6. Huda 24.5K posts
- 7. NBA Street 1,758 posts
- 8. #SpaceMarine2 1,500 posts
- 9. South Korea 160K posts
- 10. Jay Z 1,359 posts
- 11. #SellingSunset N/A
- 12. Mandy 17.3K posts
- 13. Jennifer Welch 9,224 posts
- 14. Jake Browning N/A
- 15. #wednesdaymotivation 5,669 posts
- 16. Snek for the Cure N/A
- 17. Brad Holmes N/A
- 18. Marshawn Lloyd N/A
- 19. Andretti N/A
- 20. Gabe Davis N/A
Something went wrong.
Something went wrong.