1

I've work that I think now should really have been in its own branch.

I want to work on something else for now, but work isn't in a shape that i want to commit yet.

I created new branch and all uncommited works shows there great.

But it still shows in master branch.

How can I make it so all work, although not committed yet, shows only in new branch and not at master.

Muhammad Umer
  • 17,263
  • 19
  • 97
  • 168
  • 3
    Possible duplicate of [Move existing, uncommitted work to a new branch in Git](https://stackoverflow.com/questions/1394797/move-existing-uncommitted-work-to-a-new-branch-in-git) – phd Apr 24 '18 at 04:32
  • 1
    You can either stash it for the time being or just commit it on the new branch (as a work in progress) and later use `git reset` to revoke the commit and continue working as if the commit never happened. The latter one always seems the best solution for me, since you got your changes save, no matter what. – kowsky Apr 24 '18 at 04:47

1 Answers1

1

One way to take all uncommitted changes to a different branch is using stash. While you are in master, stash all the changes made in working/staging directory, create a new branch or checkout already created branch and apply the stashed changes in the newly checked out branch.

$ git stash //This command will stash all the changes

$ git checkout -b newBranch or git checkout existingBranch //checks out another branch

$ git stash apply //applies all the uncommitted changes