Reputation: 4946
I have an automated Jenkins job which simply does the following:
remoteA
remoteB
remoteA
is the remote where developers actually push their code.
remoteB
is never touched manually, it only receives udates trough that automated Job.
It worked well for a while, but now I get Updates were rejected because the tip of your current branch is behind its remote counterpart.
when trying to push into remoteB
As far as I know, this happens when
remoteB
contains changes which remoteA
doesn't contain -> I think that's not possible because no human and no other Jenkins Job touches remoteBrebase
on remoteA. -> As I am no git professional, I am very unsure how to deal with that scenario. Hope someone here can help.Upvotes: 1
Views: 108
Reputation: 142094
If you did a rebase
which modified the history so you cannot push to the remote unless you wish to overwrite and change the content of your repository.
If you still wish to push the content you must use the -f
# FORCE overwrite of old content with the new result of you rebase
git push -f
In your case that the content is handled by Jenkins, a rebase can be a good reason to why it stopped working.
Check the diff between the 2 branches (local vs remote)
# fetch all remotes if you have multiple ones
git fetch --all
# check the diff between the 2 branches (2 ..)
git diff localBranch..origin/remoteBranch
# check the diff between the 2 branches (3 ..)
git diff localBranch...origin/remoteBranch
you can read more about git diff
How to show uncommitted changes in Git
Upvotes: 1