mykoman
mykoman

Reputation: 1905

Committing local changes after branches are switched

I am supposed to work on git branch A, I however was unconsciously working on branch B. After noticing, my intention now is to switch to branch A without committing to branch B. After switching to branch A, I can do my commits. How do I achieve this using smart git?

PS: I have not committed to branch B at all

Upvotes: 1

Views: 62

Answers (1)

Brent Worden
Brent Worden

Reputation: 10974

If you have not committed your changes to branch-b, then stash should work:

> git stash
> git checkout branch-a
> git stash apply

Upvotes: 1

Related Questions