Skip to content

Commit 50e52a7

Browse files
committed
初步完成,TODO:检查、优化排版
1 parent c8d0093 commit 50e52a7

File tree

1 file changed

+22
-137
lines changed

1 file changed

+22
-137
lines changed

README.md

Lines changed: 22 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,19 @@ git ls-files --others -i --exclude-standard
233233
```
234234

235235
## 强制删除untracked的文件
236-
清空工作区untracked的文件
236+
可以用来删除新建的文件。如果不指定文件文件名,则清空所有工作的untracked文件。`clean`命令,**注意两点**
237+
1. clean后,删除的文件无法找回
238+
2. 不会影响tracked的文件的改动,只会删除untracked的文件
239+
237240
```sh
238-
git clean -f
241+
git clean <file_name> -f
239242
```
240243

241244
## 强制删除untracked的目录
242-
清空工作区untracked的目录
245+
可以用来删除新建的目录,**注意**:这个命令也可以用来删除untracked的文件。详情见上一条
246+
243247
```sh
244-
git clean -df
248+
git clean <directory_name> -df
245249
```
246250

247251
## 重命名分支
@@ -265,62 +269,31 @@ git bundle create <file> <branch-name>
265269
git clone repo.bundle <repo-dir> -b <branch-name>
266270
```
267271

268-
## Ignore one file on commit (e.g. Changelog).
269-
```sh
270-
git update-index --assume-unchanged Changelog; git commit -a; git update-index --no-assume-unchanged Changelog
271-
```
272-
273-
## Stash changes before rebasing
272+
## 执行rebase之前自动stash
274273
```sh
275274
git rebase --autostash
276275
```
277276

278-
## Fetch pull request by ID to a local branch
277+
## 从远程仓库根据ID,拉下某一状态,到本地分支
279278
```sh
280279
git fetch origin pull/<id>/head:<branch-name>
281280
```
282281

283-
284-
__Alternatives:__
285-
```sh
286-
git pull origin pull/<id>/head:<branch-name>
287-
```
288-
289-
## Show the most recent tag on the current branch.
282+
## 展示当前分支的最近的tag
290283
```sh
291284
git describe --tags --abbrev=0
292285
```
293286

294-
## Show inline word diff.
287+
## 详细展示一行中的修改
295288
```sh
296289
git diff --word-diff
297290
```
298291

299-
## Don’t consider changes for tracked file.
300-
```sh
301-
git update-index --assume-unchanged <file_name>
302-
```
303-
304-
## Undo assume-unchanged.
305-
```sh
306-
git update-index --no-assume-unchanged <file_name>
307-
```
308-
309-
## Clean the files from `.gitignore`.
292+
## 清除`.gitignore`文件中记录的文件
310293
```sh
311294
git clean -X -f
312295
```
313296

314-
## Restore deleted file.
315-
```sh
316-
git checkout <deleting_commit>^ -- <file_path>
317-
```
318-
319-
## Restore file to a specific commit-hash
320-
```sh
321-
git checkout <commit-ish> -- <file_path>
322-
```
323-
324297
## 展示所有alias和configs.
325298
```sh
326299
git config --list
@@ -336,31 +309,6 @@ git status --ignored
336309
git log Branch1 ^Branch2
337310
```
338311

339-
## reuse recorded resolution, record and reuse previous conflicts resolutions.
340-
```sh
341-
git config --global rerere.enabled 1
342-
```
343-
344-
## Open all conflicted files in an editor.
345-
```sh
346-
git diff --name-only | uniq | xargs $EDITOR
347-
```
348-
349-
## Count unpacked number of objects and their disk consumption.
350-
```sh
351-
git count-objects --human-readable
352-
```
353-
354-
## Prune all unreachable objects from the object database.
355-
```sh
356-
git gc --prune=now --aggressive
357-
```
358-
359-
## Instantly browse your working repository in gitweb.
360-
```sh
361-
git instaweb [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
362-
```
363-
364312
## 在commit log中显示GPG签名
365313
```sh
366314
git log --show-signature
@@ -377,104 +325,41 @@ git config --global --unset <entry-name>
377325
git checkout --orphan <branch_name>
378326
```
379327

380-
## Extract file from another branch.
328+
## 展示任意分支某一文件的内容
381329
```sh
382330
git show <branch_name>:<file_name>
383331
```
384332

385-
## List only the root and merge commits.
386-
```sh
387-
git log --first-parent
388-
```
389-
390-
## Change previous two commits with an interactive rebase.
391-
```sh
392-
git rebase --interactive HEAD~2
393-
```
394-
395-
## List all branch is WIP
396-
```sh
397-
git checkout master && git branch --no-merged
398-
```
399-
400-
## Find guilty with binary search
401-
```sh
402-
git bisect start # Search start
403-
git bisect bad # Set point to bad commit
404-
git bisect good v2.6.13-rc2 # Set point to good commit|tag
405-
git bisect bad # Say current state is bad
406-
git bisect good # Say current state is good
407-
git bisect reset # Finish search
408-
409-
```
410-
411-
## Bypass pre-commit and commit-msg githooks
412-
```sh
413-
git commit --no-verify
414-
```
415-
416-
## List commits and changes to a specific file (even through renaming)
417-
```sh
418-
git log --follow -p -- <file_path>
419-
```
420-
421-
## Clone a single branch
333+
## clone下来指定的单一分支
422334
```sh
423335
git clone -b <branch-name> --single-branch https://github.com/user/repo.git
424336
```
425337

426-
## Create and switch new branch
338+
## 创建并切换到该分支
427339
```sh
428340
git checkout -b <branch-name>
429341
```
430342

431-
432-
__Alternatives:__
433-
```sh
434-
git branch <branch-name> && git checkout <branch-name>
435-
```
436-
437-
## Ignore file mode changes on commits
343+
## 关闭Ignore文件的功能
438344
```sh
439345
git config core.fileMode false
440346
```
441347

442-
## Turn off git colored terminal output
443-
```sh
444-
git config --global color.ui false
445-
```
446-
447-
## specific color settings
448-
```sh
449-
git config --global <specific command e.g branch, diff> <true, false or always>
450-
```
348+
## 展示本地所有的分支的commit
349+
最新的放在最上面
451350

452-
## Show all local branches ordered by recent commits
453351
```sh
454352
git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/
455353
```
456354

457-
## Find lines matching the pattern (regex or string) in tracked files
458-
```sh
459-
git grep --heading --line-number 'foo bar'
460-
```
355+
## 在commit log中查找相关内容Search Commit log across all branches for given text
356+
通过grep查找,given-text:所需要查找的字段
461357

462-
## Clone a shallow copy of a repository
463-
```sh
464-
git clone https://github.com/user/repo.git --depth 1
465-
```
466-
467-
## Search Commit log across all branches for given text
468358
```sh
469359
git log --all --grep='<given-text>'
470360
```
471361

472-
## Get first commit in a branch (from master)
473-
```sh
474-
git log master..<branch-name> --oneline | tail -1
475-
```
476-
477-
## 把暂存区的内容放到工作区中
362+
## 把暂存区的指定file放到工作区中
478363
```sh
479364
git reset <file-name>
480365
```

0 commit comments

Comments
 (0)