Search code examples
gitgit-flowgit-merge-conflict

gitflow: how to make local develop follow remote develop — again?


We use gitflow with pull requests so in theory the local and remote develop should always be identical. But in praxis there are merge conflicts.

I don't want to merge those conflicts as I would not be allowed to push them anyway.

Is there a way to just force the local develop branch to be the same as the remote develop branch?


Solution

  • if you want to discard the changes on the local develop branch you can do the following

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

    or delete the branch and pull it again

    git checkout master
    git branch -D develop
    git checkout develop
    

    If you want to force your changes to the remote develop

    git push -f
    

    This will Force push to the remote branch so be careful as all the remote changes will be deleted.

    If you want to apply your local changes on the remote that has been modified you can do the following

    git pull --rebase #This will bring your local commit on top of the remote. Then you can resolve the conflicts and push to the remote