master
xueweihan 2016-07-18 23:21:22 +08:00
parent f9f9eabf18
commit d6318caf1d
1 changed files with 4 additions and 40 deletions

View File

@ -217,47 +217,26 @@ git stash clear
git checkout <stash@{n}> -- <file_path> git checkout <stash@{n}> -- <file_path>
``` ```
## Show all tracked files ## 展示所有tracked的文件
```sh ```sh
git ls-files -t git ls-files -t
``` ```
## Show all untracked files ## 展示所有untracked的文件
```sh ```sh
git ls-files --others git ls-files --others
``` ```
## Show all ignored files ## 展示所有忽略的文件
```sh ```sh
git ls-files --others -i --exclude-standard git ls-files --others -i --exclude-standard
``` ```
## Create new working tree from a repository (git 2.5)
```sh
git worktree add -b <branch-name> <path> <start-point>
```
## Create new working tree from HEAD state ## Create new working tree from HEAD state
```sh ```sh
git worktree add --detach <path> HEAD git worktree add --detach <path> HEAD
``` ```
## Untrack files without deleting
```sh
git rm --cached <file_path>
```
__Alternatives:__
```sh
git rm --cached -r <directory_path>
```
## Before deleting untracked files/directory, do a dry run to get the list of these files/directories
```sh
git clean -n
```
## 强制删除untracked的文件 ## 强制删除untracked的文件
清空工作区untracked的文件 清空工作区untracked的文件
```sh ```sh
@ -275,16 +254,6 @@ git clean -df
git branch -m <new-branch-name> git branch -m <new-branch-name>
``` ```
## rebases 'feature' to 'master' and merges it in to master
```sh
git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1}
```
## Archive the `master` branch
```sh
git archive master --format=zip --output=master.zip
```
## Modify previous commit without modifying the commit message ## Modify previous commit without modifying the commit message
```sh ```sh
git add --all && git commit --amend --no-edit git add --all && git commit --amend --no-edit
@ -402,7 +371,7 @@ git checkout <commit-ish> -- <file_path>
git config --global branch.autosetuprebase always git config --global branch.autosetuprebase always
``` ```
## List all the alias and configs. ## 展示所有alias和configs.
```sh ```sh
git config --list git config --list
``` ```
@ -417,11 +386,6 @@ git config --global core.ignorecase false
git config --global core.editor '$EDITOR' git config --global core.editor '$EDITOR'
``` ```
## Auto correct typos.
```sh
git config --global help.autocorrect 1
```
## Check if the change was a part of a release. ## Check if the change was a part of a release.
```sh ```sh
git name-rev --name-only <SHA-1> git name-rev --name-only <SHA-1>