We are using Gerrit for our Git repository. On a project that has been active for several months, we are suddenly unable to push any changes. When we execute git pus
I deleted my master branch and created once again. Its working . git branch -D master, git checkout master Luckily it working
Weird, the --no-thin
argument didn't work for me. What worked was a git pull
(so probably git fetch
.
This generally happens when time of commit and push is different and which ultimately creates a mismatch between both the trees. Given a remote branch upstream and local branch foo
Firstly throw away all the uncommitted changes using
git reset --hard foo
Then track the remote branch using
git branch --set-upstream-to=upstream/foo
And finally
git pull
In my case it turned out I forgot to git fetch before git rebase -i origin/master. Thus when I tried to push to gerrit, I got the above error.
I am getting this same error on my tortiuse git. I finally get the root cause of this error.
The steps which causes this error;
This error will occur if a local branch is created and not pushed until some modifications ara made in head branch. This is a normal thing, since remote head branch do not know anything about your local branch until a push action.
To solve this error, switch the head branch get a full pull action. Then switch your branch and try a push.
Try a git pull --rebase
.
I saved the diff (git show > ~/mychanges.txt
, took out the commit msg at the top of the file). The checked out a new branch (git checkout -b newbranch
) applied the changes (git apply ~/mychanges.txt
), and then did a git pull --rebase
. Then everything worked.