A
A
Amir Gafurov2015-08-15 11:50:57
git
Amir Gafurov, 2015-08-15 11:50:57

How to move uncommitted changes from one branch to another in git?

In the process of work, I forgot to create a branch and switch to it and continued working in the already completed branch. There is a lot of work, how to create a branch and transfer all changes from the current one without loss? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Sosnovsky, 2015-08-15
@amir73911

just make a branch without making a checkout at the same time and being in this branch make a commit

D
D', 2015-08-15
@Denormalization

You can also use git stash for this.
Especially if you need to switch to another branch, do something there and then come back.

S
Sergey, 2018-06-03
@SaXXuM

You can use branch forcing :

git commit -m "Begin implementing the feature"
git checkout -b feature
git branch -f master HEAD~1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question