I am working on my own branch, b. I rebased it to one of the more current branches "dev_x" which everyone is working on and pushed it to the origin. All good. Now I have done a week's work and want to push my branch b updates to the origin as I am traveling and my laptop could get stolen.
The problem is I get the error "Updates were rejected because the tip of your current branch is behind". I looked in the bitbucket commit history, and no one has committed to my branch. Obviously, "dev_x" branch has moved on, but that should not stop me from pushing. I could do a git pull, but there is nothing to pull as no one except me has touched branch b?
git status says: On branch b Your branch and 'origin/b' have diverged, and have 196 and 1 different commits each, respectively. (use "git pull" to merge the remote branch into yours)
This seems to be saying that someone has committed one thing to my branch, but a) I would like to see what it is before pulling it, and b) according to bitbucket, no one has committed to this branch.
I decided to bite the bullet a do "git pull".
It now says there are 30 merge conflicts - it's showing every file I have worked on in the last week and committed locally to my branch.
Help! How do I undo what pull has done, and how do I rescue my work (e.g. pushing to a different branch).