git - Branches diverged after pull instead of push -


i accidentally did git pull instead of git push , got merge conflict. surprised git tried merge @ all, because remote branch didn't receive commits since last pull/push. since didn't want pull/merge, did git reset --hard followed git merge --abort. tried push, got message:

on branch my_branch branch , 'origin/my_branch' have diverged, , have 17 , 1 different commit each, respectively.   (use "git pull" merge remote branch yours) nothing commit, working directory clean 

how can state before accidental pull able push local commits remote branch?

your remote did commit pushed. can have @ git tree using command:

git log --all --graph --decorate --oneline 

maybe did git commit --amend or on 1 commit on remote. analyse output of command above (and post maybe in question) see commit want keep.

since working on personal branch, might consider (note not ideal) crush (1) remote commit (17) local commits, using

git push -f 

warning: in case "lose" 1 remote commit.

if want keep 1 remote commit, might consider first rebasing local work onto commit, before pushing

git rebase origin/my_branch git push 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -