1

There are solutions to similar problems in stackoverflow. But I wanted to make sure my question falls in the same category: I did a git checkout master

I made some changes(uncommitted) and realized that the changes should be made by creating a new branch instead of master.

Is there a command where I can move the changes to a new branch and revert the master in my local branch to the state it was before I made those changes?

1
  • 2
    A comment rather than an answer, since there could be a better way... but "git stash" will store your changes and restore your modified files; then change to the new branch, then "git stash pop" will apply the stored changes and remove the change from the stash stack. Commented Mar 27, 2013 at 18:59

1 Answer 1

3

Since you didn't commit anything to master, there is nothing to "revert". Juste create a new branch with git checkout -b new_branch and commit your changes.

Sign up to request clarification or add additional context in comments.

2 Comments

Additionally, I would need to to do a git pull from master. merge my master with my that specific branch and then push it to master. Would that affect anything?
You don't merge two branches together, you merge a branch into another. Your sentence is ambiguous, but I think you meant "merge my master into that specific branch and then merge the result back into master". And yes, it should affect both branches, why?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.