nebffa
nebffa

Reputation: 1549

Git edits in one branch are causing edits in another branch without merge/push/pull

I have my git master - a local repo on my computer - no remote repos anywhere.

Say I'm in the dir maths.

I do:

git branch relative_imports
git checkout relative_imports
... do some work, add a file, make a file, etc.

Running git status at this point shows the changes you would expect.

If I do (without doing any merging, pulling or pushing):

git checkout master
git status

It shows the exact same output of the previous git status. Am I doing something wrong? I thought I wasn't supposed to see the changes of relative_imports until I did git merge relative_imports.

Upvotes: 1

Views: 55

Answers (1)

user149341
user149341

Reputation:

If you're seeing these files in git status, you haven't added and committed them yet. As such, they aren't part of any commit, nor any branch, so git checkout won't touch them.

Make them part of a commit and you'll start seeing the behavior you expect.

Upvotes: 4

Related Questions