A
A
Artur Karapetyan2019-10-01 14:32:16
git
Artur Karapetyan, 2019-10-01 14:32:16

How to merge branches without losing uncommitted changes?

Good day.
I've been struggling with the problem of the correct solution to the following situation for a long time:
There are 2 branches: master and developer, some changes were committed to the developer, for example, 3 commits. There are uncommitted files in the development, which should be left in the development and not transferred to the master.
When checking out to the master, uncommitted files are transferred, which is undesirable. If you commit them to the development, go to the master and merge, then this commit will get into the master. You can roll it back, but the commit with the merge is rolled back along with it.
What is the best way to solve such a problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2019-10-01
@architawr

  1. git stashin the development branch
  2. merge to master
  3. git stash applyin the development branch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question