From de65ecb88612202978bc98f792df79d4f5d89ec7 Mon Sep 17 00:00:00 2001 From: Samar Panda Date: Fri, 31 Jul 2015 03:52:44 +0530 Subject: [PATCH 1/2] Help tips around git worktree one of git 2.5 features --- README.md | 12 ++++++++++++ tips.json | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index a4f0987..6f39693 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ * [Show all tracked files](https://github.com/git-tips/tips#show-all-tracked-files) * [Show all untracked files](https://github.com/git-tips/tips#show-all-untracked-files) * [Show all ignored files](https://github.com/git-tips/tips#show-all-ignored-files) +* [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) +* [Create new working tree from HEAD state](https://github.com/git-tips/tips#create-new-working-tree-from-head-state) @@ -257,5 +259,15 @@ git ls-files --others git ls-files --others -i --exclude-standard ``` +## Create new working tree from a repository (git 2.5) +```sh +git worktree add -b +``` + +## Create new working tree from HEAD state +```sh +git worktree add --detach HEAD +``` + diff --git a/tips.json b/tips.json index 915520f..ff90d60 100644 --- a/tips.json +++ b/tips.json @@ -147,5 +147,13 @@ { "title": "Show all ignored files", "tip": "git ls-files --others -i --exclude-standard" + }, + { + "title": "Create new working tree from a repository (git 2.5)", + "tip":"git worktree add -b " + }, + { + "title": "Create new working tree from HEAD state", + "tip": "git worktree add --detach HEAD" } ] From 4cdc87f48e255749feb46b4f42133a672eebcfe3 Mon Sep 17 00:00:00 2001 From: Samar Panda Date: Fri, 31 Jul 2015 16:13:57 +0530 Subject: [PATCH 2/2] Using revert and reset --- README.md | 12 ++++++++++++ tips.json | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 6f39693..e31f4b7 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ * [Delete local branch](https://github.com/git-tips/tips#delete-local-branch) * [Delete remote branch](https://github.com/git-tips/tips#delete-remote-branch) * [Undo local changes with the last content in head](https://github.com/git-tips/tips#undo-local-changes-with-the-last-content-in-head) +* [Revert: Undo a commit by creating a new commit](https://github.com/git-tips/tips#revert-undo-a-commit-by-creating-a-new-commit) +* [Resert: Discard commits, advised for private branch](https://github.com/git-tips/tips#resert-discard-commits-advised-for-private-branch) * [Reword the previous commit message](https://github.com/git-tips/tips#reword-the-previous-commit-message) * [Changing a remote's URL](https://github.com/git-tips/tips#changing-a-remotes-url) * [Get list of all remote references](https://github.com/git-tips/tips#get-list-of-all-remote-references) @@ -134,6 +136,16 @@ git push origin : git checkout -- ``` +## Revert: Undo a commit by creating a new commit +```sh +git revert +``` + +## Resert: Discard commits, advised for private branch +```sh +git reset +``` + ## Reword the previous commit message ```sh git commit -v --amend diff --git a/tips.json b/tips.json index ff90d60..e8b0739 100644 --- a/tips.json +++ b/tips.json @@ -64,6 +64,14 @@ "title": "Undo local changes with the last content in head", "tip": "git checkout -- " }, + { + "title":"Revert: Undo a commit by creating a new commit", + "tip":"git revert " + }, + { + "title":"Resert: Discard commits, advised for private branch", + "tip":"git reset " + }, { "title": "Reword the previous commit message", "tip": "git commit -v --amend"