git diff multiple usage

This commit is contained in:
Samar Panda 2015-07-28 22:08:59 +05:30
parent 5c7049059c
commit 309397e0c9
2 changed files with 40 additions and 10 deletions

View File

@ -4,10 +4,13 @@
<!-- @doxie.inject start toc -->
<!-- Dont remove or change the comment above that can break automatic updates. -->
* [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 <commit-ish>
```
## List of all files till a commit
```sh
git ls-tree --name-only -r <commit-ish>
@ -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 <commit-ish>
```
## 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

View File

@ -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 <commit-ish>"
},
{
"title": "List of all files till a commit",
"tip": "git ls-tree --name-only -r <commit-ish>"
@ -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 <commit-ish>"
},
{
"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"