Search code examples
gitatlassian-sourcetree

How to remove a commit from Sourcetree github project


I just renamed a field in my project that later I understood that caused my app to crash now. I want to reverse my commit to an earlier commit and edit and write my code from there. Now, the problem is when I reset the branch to that commit and I want to make new pushes, it tells me that I have to pull first because the branch is behind. I can't push. I am working on Sourcetree in Windows. Any idea how to fix that? https://i.sstatic.net/y08cb.jpg I added the image to better understand here. I want to reset to df.

before changed naming


Solution

  • If you don't care about the commits after df, you can do an hard reset in SourceTree to df commit.

    Right-click on df, and select "reset current branch to this commit".
    Note that this will implies to force push, which is OK if you are the only one working on that project.