Okay, one more... Ever commit something only to immediately realize that you're on the wrong branch? Use "git move <branch>".

coderabbi's tweet image. Okay, one more...
 
Ever commit something only to immediately realize that you&apos;re on the wrong branch?
 
Use &quot;git move &amp;lt;branch&amp;gt;&quot;.

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:

coderabbi's tweet image. &quot;proper&quot; 🤔
 
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
Loading...

Something went wrong.


Something went wrong.