1
0
mirror of https://github.com/k88hudson/git-flight-rules.git synced 2025-06-16 21:01:45 -03:00

Update reflog shortname with an ancestry reference (#345)

This commit is contained in:
apastan
2023-02-01 05:17:10 +03:00
committed by GitHub
parent 18c656604b
commit 3ff35c8642
9 changed files with 9 additions and 15 deletions

View File

@ -414,8 +414,7 @@ $ git push --force-with-lease [remote] [branch]
If you haven't pushed, to reset Git to the state it was in before you made your last commit (while keeping your staged changes):
```
(my-branch*)$ git reset --soft HEAD@{1}
(my-branch)$ git reset --soft HEAD^
```
This only works if you haven't pushed. If you have pushed, the only truly safe thing to do is `git revert SHAofBadCommit`. That will create a new commit that undoes all the previous commit's changes. Or, if the branch you pushed to is rebase-safe (ie. other devs aren't expected to pull from it), you can just use `git push --force-with-lease`. For more, see [the above section](#deleteremove-last-pushed-commit).