skip to Main Content

1.Pull the latest code[Xcode code push1
2.Commit the new code
3. When tried to push the code to bitbucket repository getting message "Local repository out of date[![enter image description here]
**

tried bothway Xcode push and cmd based push but no luck still getting this weird message

Note:
Xcode 12.4,
bit bucket

3

Answers


  1. Chosen as BEST ANSWER

    Finally resolved it by push the commits to the new PR and then merged the code with old PR


  2. There are changes in your local repository that are not on the remote and vice versa, causing a conflict in your history.

    You could try the following in your local repository (assuming your remote is called origin):

    • Make sure your local changes are committed (git commit -am "Some commit message")
    • Create a new branch (git branch new-branch-name)
    • Fetch the remote branch (git fetch origin)
    • Reset the target branch to the version on the remote (git reset --hard origin/target-branch-name)
    • Merge your newly created branch (git merge new-branch-name)
    • Push your changes to the remote (git push origin target-branch-name)
    Login or Signup to reply.
  3. I don’t understand, the image shows after the "pull"? If not, please edit your question and place the image in the correct place.

    That message can be because someone else have pushed to your repo after the last time you pulled from it. You will need to revert all the X commits that you have done after your last succed push (save the work in another branch or whatever):

    git reset --hard HEAD~X
    

    Or reset your local branch to directly match your remote branch:

    git reset --hard origin/remote-branch-name
    

    Pull from the repo, make your commits and then you will be able to push again.

    You have another option: PULL FORCE!!!

    If you alredy known the "push –force" command, then pull force will sound you familiar, but in reality doesn’t exist something like "pull –force", but exist a way to replicate that functionality in pull requests:

    git fetch --all
    git reset --hard origin/master
    git pull origin master
    

    (Replace "master" by your branch name)
    With that command you overwrite your git history to match exactly the history of your remote repository branch. That will overwrite local changes (the ones that you have not pushed yet) and then you can make your commits and push them.

    You can avoid this ackward situation by always working in a new branch only for your work, and when you need to integrate your changes you can make rebase or merge.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search