I was doing some work on a branch that comes from
git checkout develop
git branch -D branch1.0
git checkout -b branch1.0
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
This is because your local branch is not in sync with the remote branch. You can either force push the local branch by using:
git push -f origin <branch>
Use this with care. THIS WILL CAUSE THE REMOTE REPO TO LOSE THE CHANGES MADE BY OTHER COLLABORATORS.
If you want to preserve the commits made in the remote, (after saving your local commits) you sync your local branch with remote using the following:
git pull --rebase
This will place all your local commits on top of newly pulled changes. Following this a push to your remote repo won't raise any flags.
Recreating the branch with same name raises flags on push/pull, if you don't delete the remote tracking information. To fix it delete the remote tracking info by using
git branch -d -r origin/<branch> as well.