mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-09-10 11:33:33 +02:00
git-reset: expand page (#1127)
As mentioned in https://github.com/tldr-pages/tldr/pull/1088#issuecomment-249368792
This commit is contained in:
parent
b2401cf0be
commit
05c63936ce
1 changed files with 21 additions and 4 deletions
|
@ -1,11 +1,28 @@
|
||||||
# git reset
|
# git reset
|
||||||
|
|
||||||
> Undo commits or unstage changes, by resetting the current git HEAD to the specified state.
|
> Undo commits or unstage changes, by resetting the current git HEAD to the specified state.
|
||||||
|
> If a path is passed, it works as "unstage"; if a commit hash or branch is passed, it works as "uncommit".
|
||||||
|
|
||||||
- Undo last commit, keep the changes in the local filesystem:
|
- Unstage everything:
|
||||||
|
|
||||||
`git reset HEAD~1`
|
`git reset`
|
||||||
|
|
||||||
- Undo last commit, permanently delete the changes, and discard staged changes:
|
- Unstage specific file(s):
|
||||||
|
|
||||||
`git reset --hard HEAD~1`
|
`git reset {{path/to/file(s)}}`
|
||||||
|
|
||||||
|
- Unstage portions of a file:
|
||||||
|
|
||||||
|
`git reset -p {{path/to/file}}`
|
||||||
|
|
||||||
|
- Undo the last commit, keeping its changes (and any further uncommitted changes) in the filesystem:
|
||||||
|
|
||||||
|
`git reset HEAD~`
|
||||||
|
|
||||||
|
- Undo the last two commits, adding their changes to the index, i.e. staged for commit:
|
||||||
|
|
||||||
|
`git reset --soft HEAD~2`
|
||||||
|
|
||||||
|
- Reset the repository to a given commit, discarding committed, staged and uncommitted changes since then:
|
||||||
|
|
||||||
|
`git reset --hard {{commit}}`
|
||||||
|
|
Loading…
Add table
Reference in a new issue