Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in DevOps and Agile by (29.3k points)
edited by

I started some work on a new feature and after coding for a bit, I decided this feature should be on its branch.

How do I move the existing uncommitted changes to a new branch and reset my current one?

I want to reset my current branch while preserving existing work on the new feature.

closed

1 Answer

0 votes
by (50.2k points)
selected by
 
Best answer

First, go to the new branch using

git checkout -b <new-branch-name> 

This will checkout to a new branch or existing branch from your current there you can add files using 

git add <files>

And commit the files using

git commit -m”your commit message”

Thus we can move existing uncommitted work to a new branch and there you can commit. 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...