Reset to previous commit and push [message #1798943] |
Tue, 27 November 2018 17:40 |
David M. Karr Messages: 802 Registered: July 2009 |
Senior Member |
|
|
Another developer recently asked me for help reverting an inadvertent commit. I'd never done that before. After some quick searching, I thought that the best approach was as described here: https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-a-git-reset-and-push-to-remote-works-on-previous-local-commits .
This page is similar to others I've seen, but of course this uses the git command line, as opposed to egit in eclipse.
I tried following this approach on the other developer's workstation, but using egit instead of the git command line. When we tried to push the commit, it was rejected, saying it wasn't "fast forward". It's not clear to me whether this happened because of a mistake we made in the process, or whether the process is inherently flawed.
I'm aware of the different "revert" command in egit, but I believe that does something slightly different, by creating a new commit that essentially repeats the commit before the commit (or set of commits?) we want to revert. I haven't tried that yet, but after our push was rejected, we decided to punt and redo the work on a new branch.
Should that process of resetting to a previous commit and pushing work?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03781 seconds