Skip to content

Unable to update develop branch from remote repository

Jon Shallow edited this page Oct 6, 2023 · 4 revisions

The main and develop branches diverged with Release 4.3.3. It was decided to preserve the main branch with its commit history and re-align the develop branch with main. The consequence of this was that develop needed to be force pushed to the repository, even though none of the develop's commits were changed from a patch or commit documentation perspective, just the commit hashes were updated.

If you last updated your develop branch at Release 4.3.2 or prior to that, there should be no issues in updating your develop branch.

If you are getting issues with updating the develop branch as the code version is later than Release 4.3.2, then please follow the instructions below to make sure that your develop branch is correctly up to date before trying to 'git rebase develop' on any local branches you are working on.

Your clone copy of github's libcoap will be one of 2 versions.

  1. A clone of the original (usually obgm) github libcoap repository
  2. A clone of a fork of github libcoap which you forked

If you are working with a clone of the original github libcoap, then "upstream" in the commands below is replaced with "origin" (without the quotes!).

If you are working with a forked clone copy, and you have defined the original github repository (as set in "git remote add upstream https://github.com/obgm/libcoap.git"), then "upstream" refers to whatever you defined as the 4th parameter to "git add remote ..." and is to be used in the commands below.

# Make sure you are on develop branch
# If not, fix errors and try again
git checkout develop

# Take a copy of the current develop branch
# in case of any issues
git branch develop-save

# Get in all the latest heads / tags etc.
# Replace "upstream" as appropriate.
# Passwords may need to be entered at this point.
git fetch upstream

# Do this only after the 'git fetch' has completed,
# otherwise this line gets used as a bad password!
# Replace "upstream" as appropriate.
# WARNING: You must be on the develop branch
# if you don't want to trash other work.
git reset --hard upstream/develop

# Now develop branch should be correct

If you are working with a clone of a fork, you may (after determining that all is OK) want to update the develop branch of your fork. This is done with

git push origin -f develop