Xcode warning when switching branches in git

Paul Patterson

I've lost more work as a result of failing to understand git than I have any other way. I'm now in the familiar position of being presented with a two-option warning from Xcode, which has come about as a result of my switching to a different branch in git (I did the switch at the command line - I don't use Xcode's built-in vc support). The last time I was here I guessed wrong and lost work. This time I'd like to understand what the two choices mean. Here's what I did:

// On branch master
$ git checkout images_sidebar

Here's what I got:

enter image description here

All I want to do is have Xcode present me with the project as it was when I last commited on the branch that I'm switching to.

kubilay

If I'm not mistaken, here's the scenario of your situation:
1. You are on the branch named branch1
2. You open the project with Xcode
3. While the project is opened, you checkout branch2

So Xcode remains branch1's .xcworkspace file but you have checked out branch2 so the .xcworkspace file on the disk has changed.

Here, Xcode detects that change and asks you to open this changed file or remain with the current (which will cause to override branch2's .xcworkspace file).

If you want to open the files of the branch you are switching to, then you should go with the Revert option.

There is one thing that I mostly realise by experiencing is that Xcode works a little bit dirty, like most of the other IDEs. So, you have to remain a well organised .gitignore file in your repository. I personally recommend to take a look at the schemes here: Git ignore file for Xcode projects

It won't actually affect your situation if you are just checking out between branches but when you merge with other branches, Xcode's specific files might get overridden as well and you should take care of that.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I deal with vim buffers when switching git branches?

From Dev

Switching branches in Git with external dependencies

From Dev

Switching Git branches and disregarding changes

From Dev

Git correct switching between branches

From Dev

Switching branches in Git doesn't remove directories

From Dev

Switching Git branches inside an Android Repo project

From Dev

state of git is confused by switching branches in a script

From Dev

state of git is confused by switching branches in a script

From Dev

How can I setup Eclipse to avoid missing library projects when switching git branches?

From Dev

Date modified in file system does not change when switching branches in Git repo

From Dev

Git Ambiguous warning, while switching branch

From Dev

Git Ambiguous warning, while switching branch

From Dev

MATLAB does not recognize".m" file changes after switching branches in git

From Dev

The warning when "git fetch"

From Dev

Xcode 6.0.1 crashes when merging 2 branches

From Dev

Warning when installing Git with Homebrew

From Java

When does Git refresh the list of remote branches?

From Dev

git buggy modified files when changing branches

From Dev

git buggy modified files when changing branches

From Dev

Are git branches squashed or replayed when merging?

From Dev

Git, when renaming on both branches, not detected as rename

From Dev

Xcode 7 doesn't show new remote branches using Git

From Dev

Why Git allows switch branches and (!!!) doesn't update the working tree after this switching?

From Dev

When is it safe to rewrite git history when local branches are present?

From Dev

Switching branches prompts to save file

From Dev

Switching branches each with local changes

From Dev

Switching branches prompts to save file

From Dev

Xcode 7.2.1 keeps crashing when switching to main.storyboard

From Java

How to deal with this git warning? "Pulling without specifying how to reconcile divergent branches is discouraged"

Related Related

  1. 1

    How do I deal with vim buffers when switching git branches?

  2. 2

    Switching branches in Git with external dependencies

  3. 3

    Switching Git branches and disregarding changes

  4. 4

    Git correct switching between branches

  5. 5

    Switching branches in Git doesn't remove directories

  6. 6

    Switching Git branches inside an Android Repo project

  7. 7

    state of git is confused by switching branches in a script

  8. 8

    state of git is confused by switching branches in a script

  9. 9

    How can I setup Eclipse to avoid missing library projects when switching git branches?

  10. 10

    Date modified in file system does not change when switching branches in Git repo

  11. 11

    Git Ambiguous warning, while switching branch

  12. 12

    Git Ambiguous warning, while switching branch

  13. 13

    MATLAB does not recognize".m" file changes after switching branches in git

  14. 14

    The warning when "git fetch"

  15. 15

    Xcode 6.0.1 crashes when merging 2 branches

  16. 16

    Warning when installing Git with Homebrew

  17. 17

    When does Git refresh the list of remote branches?

  18. 18

    git buggy modified files when changing branches

  19. 19

    git buggy modified files when changing branches

  20. 20

    Are git branches squashed or replayed when merging?

  21. 21

    Git, when renaming on both branches, not detected as rename

  22. 22

    Xcode 7 doesn't show new remote branches using Git

  23. 23

    Why Git allows switch branches and (!!!) doesn't update the working tree after this switching?

  24. 24

    When is it safe to rewrite git history when local branches are present?

  25. 25

    Switching branches prompts to save file

  26. 26

    Switching branches each with local changes

  27. 27

    Switching branches prompts to save file

  28. 28

    Xcode 7.2.1 keeps crashing when switching to main.storyboard

  29. 29

    How to deal with this git warning? "Pulling without specifying how to reconcile divergent branches is discouraged"

HotTag

Archive