I was being unable to push my commits into origin, then I did a "git push origin develop -f". The problem is my head is 3 commits ahead origin and I can't push it because it is saying Everything up to date. How do I deal with it without losing my changes?
Asked
Active
Viewed 131 times
0
-
3You have uncommited changes, so those will not be pushed. Run `git status` to see if things are staged that you want, then `git commit` when things are ready. – Cory Kramer Nov 06 '20 at 13:17
-
1I don't see `-f` in the push on that screenshot, but I do see a fatal error reported by `pull` which says that a `cherry-pick` operation is in-progress. Have you solved that already? – quetzalcoatl Nov 06 '20 at 13:22
-
I used the force before the print, here is my git status with nothing to commit: https://pastebin.com/jUksmauR – LF Ziron Nov 06 '20 at 13:24
-
2`git status` tells us: `You are currently rebasing branch 'develop' on '119d09a'.` So you have to finish your rebase or abort it and then you should have a clean state again. (Did you have a setting which [defaults to rebase](https://stackoverflow.com/a/13974638) when pulling?) – kapsiR Nov 06 '20 at 13:41
1 Answers
0
There is a subtle difference between the two commands :
git pull origin developwill fetch the remotedevelopbranch fromoriginand merge it into your active local branch ,git push origin developwill take your localdevelopbranch (not your current branch), and push it to its remote counterpart.
In your situation, as git log correctly shows : develop and origin/develop are already on the same commit, hence the Everything up-to-date message on your git push (even with the -f flag),
and apparently, you still have an unresolved cherry-pick pending, so git will not start the merge part of your git pull command.
It also looks like you are in the middle of something else :
- git mentions an undergoing
cherry-pick(did you by any chance fix conflicts on agit cherry-pickcommand you ran ?), - your
git logshows that you are currently in a detached HEAD state
so you probably need to sort this out before proceeding.
Run git status, it should give you some insights on what's going on, and if you are indeed in the middle of a cherry-pick.
[edit] it turns out the action in progress is a rebase. Complete the rebase first.
LeGEC
- 46,477
- 5
- 57
- 104
