Open main menu

Changes

694 bytes added ,  10:51, 11 August 2018
no edit summary
Using <code>reset</code> you can even go backwards several commits if you want.
The entire internet tells you not to <code>reset</code> if you've already pushed. But if you're just pushing (from machine A: your desktop) to a remote (machine B: eg. GitHub) so that you can then pull those changes into another space (machine C: development/staging/production/other machine) you can push your changes with <code>--force</code>; and pull them from that other environment. It may be quicker and easier though to identify the SHA of the n-1 commit and then <code>reset</code> on machine C<source lang="bash">git log -n 4# find the commit SHA, and use it on machine Cgit reset --hard d89c004cfe4bd67838fb41c7a6644bb15feee5cc</source> Credit: there's a clear explanation at https://www.git-tower.com/learn/git/faq/undo-last-commit
== Git Branch ==
4,558

edits