"The Local repository is out of date"....i have no branch how to solve this

11,127

Solution 1

that warning is because someone else would have pushed to your repo after the last time you pulled from it. you will need to pull from the repo, merge your code and then you will be able to push again

Solution 2

I had the same issue I solved it like that :

first go to the Project directory in your terminal

git init
git add .
git stash save
git branch --set-upstream-to=origin/master
git pull -r
git stash pop
git push 

let me know if it works

Solution 3

I had the same issue and it happened because I added the README.md file from the GitHub website by creating another branch to add it. Xcode does not pull changes made through the website automatically.

So you have to go to Xcode menu and select Source Control -> Pull.

enter image description here

And then I checked "Rebase local changes onto upstream changes", this applies local commits one at a time. I had many commits I didn't push, so I chose this.

enter image description here

Share:
11,127

Related videos on Youtube

SAXENA
Author by

SAXENA

iOS Developer

Updated on June 04, 2022

Comments

  • SAXENA
    SAXENA almost 2 years

    When we push the code to the remote server Xcode shows the below warning. Also see the attached screenshot

    The Local repository is out of date.

    Screenshot

    I have no branch or any other working copy.

  • Harry McGovern
    Harry McGovern over 5 years
    That was the answer for me. I couldn't find a way around the error on XCode.
  • Oleg991
    Oleg991 over 4 years
    This helped me too, though I do not like using terminal.
  • Jorge Zapata
    Jorge Zapata about 4 years
    I have this same problem. I tried pulling and it says I am already up to date. Should I force push?
  • Peter Schorn
    Peter Schorn over 3 years
    Doesn't git init create a completely new repository?
  • H.Epstein
    H.Epstein over 3 years
    git init is not creating a new repository it will just set up a git project, it will not affect your remotes or branches
  • Zack
    Zack almost 3 years
    How do I reverse this? I just lost all my work without any backup
  • JCutting8
    JCutting8 about 2 years
    Im a single developer team, I don't even know how this is possible!?