Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put uncommitted changes on a new branch in SourceTree?

This question and others deal with this problem in Git, but I generally work only in the SourceTree IDE. I've done some work, but before committing it, I realizes it should be on its own branch. How do I do that without losing the work I've done?

like image 852
HeyHeyJC Avatar asked Jan 09 '19 10:01

HeyHeyJC


People also ask

How do you bring uncommitted changes to a new branch?

Using the git checkout Command The git checkout -b <BranchName> command will create a new branch and switch to it. Moreover, this command will leave the current branch as it is and bring all uncommitted changes to the new branch.

How do I push changes to a new branch in SourceTree?

using SourceTree: Double-click on develop in the BRANCHES list. Switch to the develop branch, so you can merge the change. Click the "Push" icon in the toolbar.

What happens to uncommitted changes when you switch branches?

If you have uncommitted changes when you switch branches, they will be lost.


1 Answers

Just click on Branch Icon
Give Name to your branch
Click OK
Your code will automatically will sync on your new branch.
then, If you want to commit your code on that branch
just commit it on your newly created branch. (The one with BOLD)

like image 88
H45H Avatar answered Nov 01 '22 08:11

H45H