Skip to content

Commit b544b7f

Browse files
committed
Merge pull request #19 from samarpanda/usage_git_diff
Git diff usage!
2 parents 5c70490 + 309397e commit b544b7f

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
<!-- @doxie.inject start toc -->
55
<!-- Don’t remove or change the comment above – that can break automatic updates. -->
66
* [Overwrite pull](https://github.com/git-tips/tips#overwrite-pull)
7-
* [List of all files changed in a commit](https://github.com/git-tips/tips#list-of-all-files-changed-in-a-commit)
87
* [List of all files till a commit](https://github.com/git-tips/tips#list-of-all-files-till-a-commit)
98
* [Git reset first commit](https://github.com/git-tips/tips#git-reset-first-commit)
109
* [List all the conflicted files](https://github.com/git-tips/tips#list-all-the-conflicted-files)
10+
* [List of all files changed in a commit](https://github.com/git-tips/tips#list-of-all-files-changed-in-a-commit)
11+
* [Unstaged changes since last commit](https://github.com/git-tips/tips#unstaged-changes-since-last-commit)
12+
* [Changes staged for commit](https://github.com/git-tips/tips#changes-staged-for-commit)
13+
* [Show both staged and unstaged changes](https://github.com/git-tips/tips#show-both-staged-and-unstaged-changes)
1114
* [List all branches that are already merged into master](https://github.com/git-tips/tips#list-all-branches-that-are-already-merged-into-master)
1215
* [Quickly switch to the previous branch](https://github.com/git-tips/tips#quickly-switch-to-the-previous-branch)
1316
* [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 @@
4346
git fetch --all && git reset --hard origin/master
4447
```
4548

46-
## List of all files changed in a commit
47-
```sh
48-
git diff-tree --no-commit-id --name-only -r <commit-ish>
49-
```
50-
5149
## List of all files till a commit
5250
```sh
5351
git ls-tree --name-only -r <commit-ish>
@@ -63,6 +61,26 @@ git update-ref -d HEAD
6361
git diff --name-only --diff-filter=U
6462
```
6563

64+
## List of all files changed in a commit
65+
```sh
66+
git diff-tree --no-commit-id --name-only -r <commit-ish>
67+
```
68+
69+
## Unstaged changes since last commit
70+
```sh
71+
git diff
72+
```
73+
74+
## Changes staged for commit
75+
```sh
76+
git diff --cached
77+
```
78+
79+
## Show both staged and unstaged changes
80+
```sh
81+
git diff HEAD
82+
```
83+
6684
## List all branches that are already merged into master
6785
```sh
6886
git checkout master && git branch --merged

tips.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
"title": "Overwrite pull",
44
"tip": "git fetch --all && git reset --hard origin/master"
55
},
6-
{
7-
"title": "List of all files changed in a commit",
8-
"tip": "git diff-tree --no-commit-id --name-only -r <commit-ish>"
9-
},
106
{
117
"title": "List of all files till a commit",
128
"tip": "git ls-tree --name-only -r <commit-ish>"
@@ -19,6 +15,22 @@
1915
"title": "List all the conflicted files",
2016
"tip": "git diff --name-only --diff-filter=U"
2117
},
18+
{
19+
"title": "List of all files changed in a commit",
20+
"tip": "git diff-tree --no-commit-id --name-only -r <commit-ish>"
21+
},
22+
{
23+
"title":"Unstaged changes since last commit",
24+
"tip":"git diff"
25+
},
26+
{
27+
"title":"Changes staged for commit",
28+
"tip":"git diff --cached"
29+
},
30+
{
31+
"title":"Show both staged and unstaged changes",
32+
"tip":"git diff HEAD"
33+
},
2234
{
2335
"title": "List all branches that are already merged into master",
2436
"tip": "git checkout master && git branch --merged"

0 commit comments

Comments
 (0)