git - Attempting to rebase gives endless merge conflicts -


i accidentally ended creating duplicates of of projects commits , pushing remote, project jumped 500 commits 1000. i've checked links remove duplicate commits, none of these make sense me. if attempt rebase, merge conflicts every single commit , , i'm not spend couple hours resolving conflicts since beginning of time. history looks like:

enter image description here

is there anyway go in , forcefully delete duplicate commits? don't want spend hours rebasing ~1000 commits ago manually squashing every duplicate commit.

even better, there way can undo this? result of filter-branch command didn't realize duplicated every single commit

you can try rebasing said had issues it, or can try sort of undo git reflog. leave both options bellow:

undo git reflog

you mentioned undo results of filter command, can try run:

> $ git reflog  d363d7c head@{0}: commit: minor typo 87c9470 head@{1}: pull: fast-forward a74a14e head@{2}: checkout: moving clojure-script-begginer master ce79d4e head@{3}: commit: article review a74a14e head@{4}: checkout: moving master clojure-script-begginer a74a14e head@{5}: pull: fast-forward 14ec10b head@{6}: checkout: moving cors master e71cf74 head@{7}: commit: config url commented out 

if see list , can notice entry before filter command ran can reset branch point:

> git reset --hard <commit id> 

commit id number on first column of git reflog

 rebasing

1. create branch

don't execute of steps in branch have 100 commits, we're going go dangerous zone quite quite bit.

assuming you're @ master:

> git checkout -b fixing-duplicates 

 2. interactive rebase delete duplicates

run:

> git rebase -i head~1000 

a text editor (the default one) open , show previous 100 commits. delete lines of duplicated commits until have commits want. save , exit.

at point don't expect have rebase conflicts.

3. push branch

just push branch upstream:

> git push origin fixing-duplicates 

4. check if branch ok

give branch , check if want. if is, run:

> git push origin fixing-duplicates:master -f 

if github instance prevents force pushing default branch, change default branch fixing-duplicates , run command again. switch default branch master.

let me know if helped.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -