S
S
Sergey2015-06-01 16:02:19
PHP
Sergey, 2015-06-01 16:02:19

How to work with branches in git?

Good afternoon. I worked with one branch until a task appeared that completely changes the entire structure of the application (adding a modular structure), I created a separate branch for this business and started working with it, I did everything, everything is fine - you need to switch to the master branch, switch, work there, then I try to switch to the second branch and suddenly I get an error:

Your local changes to the following files would be overwritten by checkout

As I understand it, it arose due to the fact that the same file was touched in both branches? You can get rid of this with a commit, that's clear, but aren't brunches separate workspaces from each other? Please clarify the situation. Thank you in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor, 2015-06-01
@Pjeroo

This error means that you have modified files in your working tree that will be overwritten (that is, the changes will be lost) when you switch to the correct branch. Git keeps you from losing your work.
You either need to commit to commit them and clean up the working tree before checkout, or stash to leave the work for later.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question