-
Notifications
You must be signed in to change notification settings - Fork 424
Unable to update develop branch from remote repository
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.
If you have tried a 'git pull upstream develop' and this has created a lot of merge conflicts that you have not resolved, it probably is best to do 'git reset --hard' to get you back to where you started before trying to do the 'git pull upstream develop'.
Your clone copy of github's libcoap will be one of 2 versions.
- A clone of the original (usually obgm) github libcoap repository
- 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
It is possible however that this may get rejected if the develop branch of the repository is protected against updates with a message such as
! [remote rejected] develop -> develop (protected branch hook declined)
In which case you will need to delete branch protection rule for develop (note how it is configured first), do the 'git push origin -f develop' again, and then add back in the branch protection rule (found under Settings -> Branches in github).