diff --git a/README.md b/README.md index bd9412a..f2f856e 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,13 @@ * [Overwrite pull](https://github.com/git-tips/tips#overwrite-pull) -* [List of all files changed in a commit](https://github.com/git-tips/tips#list-of-all-files-changed-in-a-commit) * [List of all files till a commit](https://github.com/git-tips/tips#list-of-all-files-till-a-commit) * [Git reset first commit](https://github.com/git-tips/tips#git-reset-first-commit) * [List all the conflicted files](https://github.com/git-tips/tips#list-all-the-conflicted-files) +* [List of all files changed in a commit](https://github.com/git-tips/tips#list-of-all-files-changed-in-a-commit) +* [Unstaged changes since last commit](https://github.com/git-tips/tips#unstaged-changes-since-last-commit) +* [Changes staged for commit](https://github.com/git-tips/tips#changes-staged-for-commit) +* [Show both staged and unstaged changes](https://github.com/git-tips/tips#show-both-staged-and-unstaged-changes) * [List all branches that are already merged into master](https://github.com/git-tips/tips#list-all-branches-that-are-already-merged-into-master) * [Quickly switch to the previous branch](https://github.com/git-tips/tips#quickly-switch-to-the-previous-branch) * [Remove branches that have already been merged with master](https://github.com/git-tips/tips#remove-branches-that-have-already-been-merged-with-master) @@ -43,11 +46,6 @@ git fetch --all && git reset --hard origin/master ``` -## List of all files changed in a commit -```sh -git diff-tree --no-commit-id --name-only -r -``` - ## List of all files till a commit ```sh git ls-tree --name-only -r @@ -63,6 +61,26 @@ git update-ref -d HEAD git diff --name-only --diff-filter=U ``` +## List of all files changed in a commit +```sh +git diff-tree --no-commit-id --name-only -r +``` + +## Unstaged changes since last commit +```sh +git diff +``` + +## Changes staged for commit +```sh +git diff --cached +``` + +## Show both staged and unstaged changes +```sh +git diff HEAD +``` + ## List all branches that are already merged into master ```sh git checkout master && git branch --merged diff --git a/tips.json b/tips.json index c6b3a69..681a19f 100644 --- a/tips.json +++ b/tips.json @@ -3,10 +3,6 @@ "title": "Overwrite pull", "tip": "git fetch --all && git reset --hard origin/master" }, - { - "title": "List of all files changed in a commit", - "tip": "git diff-tree --no-commit-id --name-only -r " - }, { "title": "List of all files till a commit", "tip": "git ls-tree --name-only -r " @@ -19,6 +15,22 @@ "title": "List all the conflicted files", "tip": "git diff --name-only --diff-filter=U" }, + { + "title": "List of all files changed in a commit", + "tip": "git diff-tree --no-commit-id --name-only -r " + }, + { + "title":"Unstaged changes since last commit", + "tip":"git diff" + }, + { + "title":"Changes staged for commit", + "tip":"git diff --cached" + }, + { + "title":"Show both staged and unstaged changes", + "tip":"git diff HEAD" + }, { "title": "List all branches that are already merged into master", "tip": "git checkout master && git branch --merged"