Skip to content

Commit 5566a52

Browse files
committed
Merge pull request #22 from samarpanda/worktree
Git Worktree!
2 parents 328e594 + 4cdc87f commit 5566a52

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* [Delete local branch](https://github.com/git-tips/tips#delete-local-branch)
2020
* [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch)
2121
* [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)
2224
* [Reword the previous commit message](https://github.com/git-tips/tips#reword-the-previous-commit-message)
2325
* [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url)
2426
* [Get list of all remote references](https://github.com/git-tips/tips#get-list-of-all-remote-references)
@@ -39,6 +41,8 @@
3941
* [Show all tracked files](https://github.com/git-tips/tips#show-all-tracked-files)
4042
* [Show all untracked files](https://github.com/git-tips/tips#show-all-untracked-files)
4143
* [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)
4246

4347
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
4448
<!-- @doxie.inject end toc -->
@@ -132,6 +136,16 @@ git push origin :<remote_branchname>
132136
git checkout -- <file_name>
133137
```
134138

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+
135149
## Reword the previous commit message
136150
```sh
137151
git commit -v --amend
@@ -257,5 +271,15 @@ git ls-files --others
257271
git ls-files --others -i --exclude-standard
258272
```
259273

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+
260284
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
261285
<!-- @doxie.inject end -->

tips.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@
6464
"title": "Undo local changes with the last content in head",
6565
"tip": "git checkout -- <file_name>"
6666
},
67+
{
68+
"title":"Revert: Undo a commit by creating a new commit",
69+
"tip":"git revert <commit-ish>"
70+
},
71+
{
72+
"title":"Resert: Discard commits, advised for private branch",
73+
"tip":"git reset <commit-ish>"
74+
},
6775
{
6876
"title": "Reword the previous commit message",
6977
"tip": "git commit -v --amend"
@@ -147,5 +155,13 @@
147155
{
148156
"title": "Show all ignored files",
149157
"tip": "git ls-files --others -i --exclude-standard"
158+
},
159+
{
160+
"title": "Create new working tree from a repository (git 2.5)",
161+
"tip":"git worktree add -b <branch-name> <path> <start-point>"
162+
},
163+
{
164+
"title": "Create new working tree from HEAD state",
165+
"tip": "git worktree add --detach <path> HEAD"
150166
}
151167
]

0 commit comments

Comments
 (0)