Can anyone of you help me.
I couldnt find anything on the internet, on how to remove that one branching commit, or how it got there in the first place.
(that commit and the one above it, introduce exactly the same changes)

  • 2
    Use the git reset command. I use this command very often to correct my mistakes 😅
    Edit: git reset --hard <commitId>
    This resets the branch pointer to the specified commit
  • 1
    @Sumafu lol I use it sometimes to hide some stupid commits 🤣
  • 0
    OP just like the first comment, rest your branch to that commit either hard or soft rest then force push to override it in the origin branch
  • 1
    OK, I think i found out where I fucked up.
    I renamed a file, but not with git mv, but with normal mv, inside a new branch.
    Which resulted in this fuckery once I merged it.
  • 0
    With the assumption that you have up to date local branches dev and master

    @dev git reset --hard <bad commit>^
    @dev git rebase master
    @dev git checkout master
    @master git rebase dev

    1. Remove bad commit from dev
    2. Rebase correct history from master
    3. Switch to master
    4. Fast forward rebase master to same history as dev (this should be no-op, but to be sure)
Add Comment