|
19 | 19 | * [Delete local branch](https://github.com/git-tips/tips#delete-local-branch)
|
20 | 20 | * [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch)
|
21 | 21 | * [Undo local changes with the last content in head](https://github.com/git-tips/tips#undo-local-changes-with-the-last-content-in-head)
|
| 22 | +* [Revert: Undo a commit by creating a new commit](https://github.com/git-tips/tips#revert-undo-a-commit-by-creating-a-new-commit) |
| 23 | +* [Resert: Discard commits, advised for private branch](https://github.com/git-tips/tips#resert-discard-commits-advised-for-private-branch) |
22 | 24 | * [Reword the previous commit message](https://github.com/git-tips/tips#reword-the-previous-commit-message)
|
23 | 25 | * [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url)
|
24 | 26 | * [Get list of all remote references](https://github.com/git-tips/tips#get-list-of-all-remote-references)
|
|
39 | 41 | * [Show all tracked files](https://github.com/git-tips/tips#show-all-tracked-files)
|
40 | 42 | * [Show all untracked files](https://github.com/git-tips/tips#show-all-untracked-files)
|
41 | 43 | * [Show all ignored files](https://github.com/git-tips/tips#show-all-ignored-files)
|
| 44 | +* [Create new working tree from a repository (git 2.5)](https://github.com/git-tips/tips#create-new-working-tree-from-a-repository-git-25) |
| 45 | +* [Create new working tree from HEAD state](https://github.com/git-tips/tips#create-new-working-tree-from-head-state) |
42 | 46 |
|
43 | 47 | <!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
44 | 48 | <!-- @doxie.inject end toc -->
|
@@ -132,6 +136,16 @@ git push origin :<remote_branchname>
|
132 | 136 | git checkout -- <file_name>
|
133 | 137 | ```
|
134 | 138 |
|
| 139 | +## Revert: Undo a commit by creating a new commit |
| 140 | +```sh |
| 141 | +git revert <commit-ish> |
| 142 | +``` |
| 143 | + |
| 144 | +## Resert: Discard commits, advised for private branch |
| 145 | +```sh |
| 146 | +git reset <commit-ish> |
| 147 | +``` |
| 148 | + |
135 | 149 | ## Reword the previous commit message
|
136 | 150 | ```sh
|
137 | 151 | git commit -v --amend
|
@@ -257,5 +271,15 @@ git ls-files --others
|
257 | 271 | git ls-files --others -i --exclude-standard
|
258 | 272 | ```
|
259 | 273 |
|
| 274 | +## Create new working tree from a repository (git 2.5) |
| 275 | +```sh |
| 276 | +git worktree add -b <branch-name> <path> <start-point> |
| 277 | +``` |
| 278 | + |
| 279 | +## Create new working tree from HEAD state |
| 280 | +```sh |
| 281 | +git worktree add --detach <path> HEAD |
| 282 | +``` |
| 283 | + |
260 | 284 | <!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
261 | 285 | <!-- @doxie.inject end -->
|
0 commit comments