Can someone explain what could happend.
I pushed first commit to server. Was ok. I created second commit. In other bash window I started git add -p
, but that window froze, so I moved to other window and continued git add -p
, git commit --amend
, git push
and wierd thing happend. Btw. it was first push (no -f was needed)
$ git status
On branch feature-1
Your branch and 'origin/feature-1' have diverged,
and have 1 and 1 different commit each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
I did git push
,
$ git push
! [rejected] feature-1 -> feature-1 (non-fast-forward)
error: failed to push some refs to ...
then git pull
$ git pull
remote: Counting objects: 136, done.
remote: Compressing objects: 100% (136/136), done.
remote: Total 136 (delta 65), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (136/136), 33.88 KiB | 0 bytes/s, done.
Resolving deltas: 100% (65/65), done.
From github.com:.../...
444444..444444 other-feature-1 -> origin/other-feature-1
222222..222222 other-feature-2 -> origin/other-feature-2
+ 333333...333333 other-feature-3 -> origin/other-feature-3 (forced update)
Merge made by the 'recursive' strategy.
then
$ git status
On branch feature-1
Your branch is ahead of 'origin/feature-1' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
Why this happend?
On server are all changes I need(both commits are correct). No idea why this poped up: Your branch is ahead of 'origin/feature-1' by 2 commits.
Note about forced update (of other-feature-3): the owner of the branch did force push. What I worry about is if I did not break anything. And how can I keep on working on this branch?
I was thinking about removing local feature-1 branch and checkout again from the server (origin/feature-1) branch.
Thanks.