1
0
mirror of https://github.com/k88hudson/git-flight-rules.git synced 2025-06-17 05:21:35 -03:00

104 Commits

Author SHA1 Message Date
40a542d31a English language edits 2019-09-30 08:50:18 -04:00
f1a2195372 add note about git stash pop --index 0 2019-09-20 05:43:05 +00:00
4252773598 fix git stash push 2019-09-12 01:12:30 +00:00
260a140bda fix case: switch stage & unstage files 2019-09-11 05:01:59 +00:00
5c57fb5ea5 fix typo 2019-09-10 03:37:36 +00:00
896006ff4d Optimize and fill operation about git stash 2019-09-09 06:09:11 +00:00
241437d1fe Fixes some spelling mistakes. (#283)
* url -> URL

https://dictionary.cambridge.org/dictionary/english/url

* Added article

* Added article

* Remove comma before and

* other -> another

* Add missing determiner

* lastet -> latest

https://dictionary.cambridge.org/dictionary/english/latest

* succeeeds -> succeeds

https://dictionary.cambridge.org/dictionary/english/succeed

* commited -> committed

* Update toc via doctoc
2019-09-06 12:30:46 -04:00
Wei
1cef8c2032 Improve the first sentence in Zh translation (#281) 2019-09-06 12:30:06 -04:00
16f81ed7b0 Added a nasa book (#278) 2019-09-06 12:28:09 -04:00
79c67f674e Fixes to #274 (#275)
* added contribute other people repositories section

* fix: Edits to #274

* Update README.md

Co-Authored-By: Diego Sanchez <diegogsann@gmail.com>

* Update README.md

Co-Authored-By: Diego Sanchez <diegogsann@gmail.com>

* Update README.md

Co-Authored-By: Diego Sanchez <diegogsann@gmail.com>
2019-06-20 11:40:46 +02:00
ad141eeeb6 Added a guide to removing large files from repo history using bfg (#249)
* Explanation of removing large files using bfg

* doctoc applied to removing large files guide

* Remove large files: clean up wording

* Add subheadings to the large file removal section in preparation for git-filter-branch explanation

* large file removal: clean up headings

* large file removal: force push considerations note

* Add word "private" to sensitive data section for searchability

* Finish git-filter-branch instructions

* Minor grammatical changes and simplifications.
2019-06-05 10:53:00 -04:00
a545b0851d Remove broken link to nasa pdf doc. (#271) 2019-05-31 23:53:50 -04:00
ff548e28d8 Updates TOC (#273) 2019-05-31 23:53:34 -04:00
d3ac210fe4 Add "Debugging with Git" (#266)
* Add "Debugging with Git"

* Fix spelling error
2019-05-28 21:45:17 -04:00
b14710acdf Update Russian translation (#270) 2019-05-28 10:22:04 -04:00
d4cf0fb88a Allows SSL errors in links (#265)
Fixes #264
2019-01-30 10:11:55 +02:00
8e697833ae Add shortcuts information for Windows PowerShell (#263) 2018-12-11 12:29:13 -05:00
73547ca942 Add pcottle/learnGitBranching (#262) 2018-12-06 14:12:33 -05:00
3d6c00dded Git shortcuts (#261)
* I committed and pushed a merge that shouldn't have happened

* git shortcuts

* remove extra commands in git shortcut section
2018-12-06 14:12:13 -05:00
8b09e3fb58 Slight wording changes 2018-12-06 09:55:45 -05:00
5cfcca513c Add section on reset -p to unstage edits
Expanded  explanation & corrected bad grammar.
2018-12-06 09:55:42 -05:00
b67b184d8a Merge branch 'nzachow-master' 2018-11-29 14:17:40 -05:00
ee10f43326 Adding a period. 2018-11-29 14:17:35 -05:00
0d109a7f9c Merge branch 'm007-master' 2018-11-29 14:12:12 -05:00
1877d108b0 Small wording changes 2018-11-29 14:12:07 -05:00
42b5519891 Wording improvements due to review comments
Like discussed in the PR this commit improves the quested section
regarding lesser spelling mistakes and improved wording. The discussion
about --no-edit lead to no changes required, so it is not altered.

See https://github.com/k88hudson/git-flight-rules/pull/256
2018-11-29 20:00:27 +01:00
9d16c95ee1 Adds a few useful git aliases (#258)
Addresses #225
2018-11-29 11:28:21 -05:00
c9cfb71843 README_fr.md - replacing weird characters (#259)
Thanks for the translation!
2018-11-29 11:26:58 -05:00
4b5cad207a Use npm scripts for travis commands 2018-11-28 09:07:46 -05:00
db69499594 Ran doctoc again 2018-11-28 09:07:38 -05:00
7cb8c1a105 Merge branch 'grantslone-master' 2018-11-28 08:56:04 -05:00
bbcb8f6704 Small grammar edits 2018-11-28 08:56:01 -05:00
8854c326b9 Merge branch 'retiform-master' 2018-11-28 08:48:05 -05:00
d6e98fd537 Small spelling and style changes 2018-11-28 08:47:50 -05:00
bd388a89c5 Update README.md 2018-11-27 23:01:22 -05:00
ca49abe067 Update README.md 2018-11-27 23:00:21 -05:00
8809567e7a Update README.md 2018-11-27 22:59:54 -05:00
9b54d14dff Update README.md 2018-11-27 22:57:52 -05:00
066cf428e1 Update README.md 2018-11-27 22:56:06 -05:00
a3ece44263 add french (fr) translation (#252) 2018-11-27 14:43:27 -05:00
911089c406 Update README_kr.md (#257)
edit typo 🇰🇷
2018-11-27 12:12:13 -05:00
ebfe5dae13 Add section on how to modify an arbitrary commit
Explain how to solve situations where you want to modify a commit which
is not your last by using interactive rebase.
2018-11-20 18:16:58 +01:00
4b6e19a5ea Fix typo (#254) 2018-11-14 18:28:44 -05:00
f4037ec5c1 Fix option to amend commit message (#255) 2018-11-14 18:28:28 -05:00
20e4b2c10d Merge branch 'hoannc54-master' 2018-11-14 07:42:46 -05:00
23e4b8d4f3 run doctoc 2018-11-14 07:42:26 -05:00
bd9af24828 update 2018-11-14 01:47:05 +07:00
bbbead4bcd add test 2 2018-11-12 23:52:23 +07:00
065ce6e742 add test 2018-11-12 23:48:53 +07:00
9d11cb4e9b update git readme vi 2018-11-12 22:57:45 +07:00
2e8a756862 update git 2018-11-11 00:09:55 +07:00
4e96f71c28 Fix typo in README_kr.md (#251)
글로버 -> 글로벌
2018-11-08 10:45:18 -05:00
ba88c82f94 added a section for unstaging a staged file. (#243)
I have accidentally staged many files in my working copy, and was looking for a way to unstage them by filename as I had some staged files that I wanted to keep. Didn't see anything that addressed my specific issue on the README, so thought of adding it here.
2018-11-04 16:35:56 -05:00
9e15db0d59 Update spanish README (#246) 2018-11-01 16:04:04 -04:00
57c4e3bc59 Corrected link label in the TOC for fixing Travis-CI (#239) 2018-10-30 04:20:29 -04:00
913e8285aa Update readme en (#242)
* added guide for amending sensitive data that was committed/pushed

* added formatting and more solutions for amending sensitive data

* added a few sentences to explain why any sensitive data should be considered compromised once it's been committed
2018-10-30 04:19:23 -04:00
9102de6186 Update Russian translation (#240) 2018-10-26 14:03:55 +02:00
efb35a9607 Telling Git to ignore a local change without unversioning the file (#219)
Ignoring local changes can be really handy for creds/credfile templates, I've found it particularly handy with Discord bot development where the configuration file can have an expected structure and expects you to add tokens to that config file
2018-10-24 19:15:19 +02:00
c767e4b22a Add rebase --onto details (#231) 2018-10-24 10:09:06 +02:00
f8257b615b Add guide to fix refspec multiple match error (#223)
* Add guide to working with tags and branches that share the same name.

Add the error scene when trying to push a tag/branch that share the same name and the commands to fix that problem.

* Fix formatting of an error statement.
2018-10-24 10:04:59 +02:00
8f4ec811b3 Added SublimeMerge client (#221)
Creators of Sublime Text recently launched a Git client, it has a lot of potential !

I think it has its place in this list 😃 

Please tell me if my phrasing is wrong
2018-10-23 17:02:23 +02:00
3339385cdb Fix typo in README_kr.md (#228)
* Fix typo in README_kr.md

fix following typo in korean readme:

Mecury -> Mercury
꺼에요 -> 거에요
꺼구요 -> 거구요
썻어 -> 썼어
썻고 -> 썼고
텍스트르 에디터 -> 텍스트 에디터
리에비스 -> 리베이스
쓼 수 -> 쓸 수
때떄로 -> 때때로
받을려면 -> 받으려면

* Update Doctoc ToC
2018-10-23 14:44:00 +02:00
02d9745c00 Add note about Git version (#217)
See #216. @ramiro how does this look?
2018-10-23 14:43:49 +02:00
965b320695 Add more resources to the list (#227)
* Add more tutorials to the list

* Add another book to the list
2018-10-23 14:42:23 +02:00
661024bc32 Fix links markdown formats in Spanish translation (#220) 2018-10-23 14:26:08 +02:00
1eb620d54c Make amend commands more specific (#218)
Previously, this document the same command for "I wrote the wrong thing in a commit message" and "I need to add staged changes to the previous commit". These are different operations! Now, the former has a command that only changes the commit message (without adding staged changes), and the latter has commands to add staged changes with or without updating the commit message.

I also added "reword" and "extend" aliases to the sample gitconfig for using the two pieces of `git commit --amend` separately.
2018-10-23 14:24:26 +02:00
0b7921c8d5 I want to view the evolution of a function 2018-10-17 23:07:16 -03:00
9bc656bdcc Added cred helper info 2018-10-17 15:28:13 -04:00
d988a3ab10 add instructions for what to do if you add the wrong remote 2018-10-17 13:42:42 -04:00
83261c5b7a Translate and add Korean (#215)
* make a readme

make a new readme for Korean

* git-flight-rule 번역 중간과정 01

브랜치 부분에서 한번 커밋

* git-flight-rule 번역 중간과정 02

머지 시작

* git-flight-rule 번역 1차 종료후 점검

* 점검 후 첫 완료

* 오타 수정 몇가지 수정

* 네비게이션 링크 추가

* 표현 수정
2018-09-13 14:20:07 -04:00
c2ffba97eb I committed and pushed a merge that shouldn't have happened (#213) 2018-07-17 17:59:17 -04:00
8cfa8e476a Translate README_ru.md via GitLocalize (#210) 2018-07-09 16:50:20 -04:00
df439158b4 fix link 2018-06-14 10:40:04 -04:00
29a9c7cbca Rename README-es.md and add link to it from README.md (#212)
When viewing the git-flight-rules repository under gitlab, it lists the first README*.md file, which for some reason it sorts `-` before `.`.  This changes the Spanish README's filename to match the other two translations already in this repository.
2018-06-14 10:35:18 -04:00
a06bef415e Add spanish translation (#119) 2018-05-14 12:40:45 -04:00
42472aaa94 Remove unnecessary tag 2018-05-14 12:37:08 -04:00
0f16ad1e2d Issue #194 - Snippet to list changes (diff) of a specific file between two commits (or branches) 2018-05-14 12:37:08 -04:00
4f3582494d Incorporate Git Cheatsheet (#174)
* Adding Git Cheatsheet commands

This is an example of how #90 should be done.

* Move other configuration commands

* Move configuration
2018-05-14 12:35:33 -04:00
4d42bb9070 Fix rule "i-want-to-create-a-new-remote-branch-from-current-local-one" (#208)
* Add missing HEAD argument in 2 Git commands

These commands had been inserted in #148 and (over)simplified in #163.

The issue is that `git push <remote>` and `git push -u <remote>` will
typically raise the error below (unlike `git push <remote> HEAD`):

--8<---------------cut here---------------start------------->8---
fatal: The current branch new-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new-branch
--8<---------------cut here---------------end--------------->8---

* Add doc URL & Avoid triple backquotes
2018-02-20 15:14:13 -04:00
d8c55ae8c5 Fix misspelling (#206) 2018-02-05 09:01:13 -04:00
14ea0820c8 Added test for TOC to .travis.yml (#205)
Runs doctoc for README*.md.
If in newly doctoc'ed README*.md there are any diffs against
ones commited in git HEAD then the test failes.
The script are using the latest anchor-markdown-header from repo
to avoid the bug with non-ASCII headers.
2018-01-13 22:00:59 -05:00
ea40bf75ca Translate README_ru.md via GitLocalize (#203) 2018-01-11 08:57:04 -05:00
fb27b20f1f Remove unnecessary anchor tags (#200) 2018-01-07 10:47:23 -05:00
e0513d81c2 I made changes to the wrong branch (#202)
* I made changes to the wrong branch

* Missed from last commit

* Fixing links

* Making changes

* Another change

* Moving section
2018-01-07 10:46:31 -05:00
be480c4c35 Merge pull request #201 from carusogabriel/patch-1
Possible mistake
2018-01-02 09:19:18 -03:00
3f85b185de Possible mistake 2018-01-02 07:30:25 -02:00
f9792e9c68 Clean up READMEs (#198)
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-01 11:40:52 -06:00
590f63c7e6 Add colon 2017-12-30 12:26:44 -06:00
5de8869df2 Add a way to find tags containing specific commit (#195)
* Add a way to find tags containing specific commit

* fixup! Add a way to find tags containing specific commit
2017-12-30 13:21:53 -05:00
4dcb631734 Including snippet to list commits containing specific files (#197) 2017-12-30 12:57:11 -05:00
e4e6ee08b1 Add "I want to delete multiple branches" (#196) 2017-12-30 12:25:11 -05:00
26138f0f10 Fixed typo in git branch -rr invocation (#190) 2017-12-29 09:52:07 -05:00
68820c1dc3 Auto-check for translated pages README_*.md with Travis CI (#188) 2017-12-23 10:51:19 -05:00
84322067fe Updated Russian translations (#187) 2017-12-23 10:50:23 -05:00
7dc4eedb17 Removing -x on git clean tip to avoid unintentional use (#186)
* Removing -x on git clean to avoid unintentionally use

* Removing ! on git clean tip
2017-12-22 10:43:25 -05:00
697dbb404f Update CONTRIBUTE.md (#185)
gitlocalize repository url
2017-12-22 09:41:14 -05:00
423eaf0ede Merge pull request #183 from sotayamashita/feature/validate-links
Add travis config to validate links
2017-12-21 14:07:29 -05:00
ae8459b6da Missed this grammar bit 2017-12-20 20:39:16 -05:00
3966d41462 Add translation section to contributing (#179)
* Add translation section to contributing

* Update CONTRIBUTE.md

* Update CONTRIBUTE.md

* Update CONTRIBUTE.md
2017-12-20 20:38:10 -05:00
ca04c4bfb4 Added the Atlassian Git tutorial site (#181) 2017-12-20 16:08:19 -05:00
58fab97420 Fixed the typo for Sourcetree and updated the description (#180) 2017-12-19 22:12:56 -05:00
c91d1081c4 Add travis config to calidate links 2017-12-20 11:34:49 +09:00
e5039cc2b9 Rename zh-CN translation to be compatible with GitLocalize (#178) 2017-12-19 19:47:46 -05:00
f462bad54d Add examples from the common screwups resource in #40 (#175)
* Adding submodule section

* Add the rest of the commands
2017-12-19 19:47:30 -05:00
11 changed files with 7712 additions and 178 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
package-lock.json

11
.travis.yml Normal file
View File

@ -0,0 +1,11 @@
language: ruby
rvm:
- 2.2
before_script:
- gem install awesome_bot
- npm install
script:
- awesome_bot README.md --allow-dupe --allow-redirect --allow-ssl
- awesome_bot README_*.md --allow-dupe --allow-redirect --allow-ssl
- npm run toc
- npm run diff

View File

@ -26,3 +26,21 @@ This is a community built document. Dive in and help out!
```sh
(relevant branch)$ git blah blah
```
## Translation
We use a translation tool called [GitLocalize][gl]. Please follow these steps to get started with your contributions:
1. Go to [GitLocalize's k88hudson/git-flight-rules repository][gl-repo].
1. Sign up using your GitHub account :octocat:.
1. Find the document you are going to translate.
1. Happy translating :sparkles: .
1. When you are done, send the translation for reviews.
1. The reviewed translation will be sent as a Pull Request to GitHub by the language moderator in the community.
To learn more about how GitLocalize works, visit their [help page][gl-help]. If you find any issues or feature requests, please file them in [GitLocalize's issue tracker][gl-issue-tracker].
[gl]: https://gitlocalize.com
[gl-help]: https://docs.gitlocalize.com/
[gl-issue-tracker]: https://github.com/gitlocalize/feedback
[gl-repo]: https://gitlocalize.com/repo/598

662
README.md

File diff suppressed because it is too large Load Diff

1453
README_es.md Normal file

File diff suppressed because it is too large Load Diff

1642
README_fr.md Normal file

File diff suppressed because it is too large Load Diff

1588
README_kr.md Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1645
README_vi.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
# Git飞行规则(Flight Rules)
🌍
*[English](README.md) ∙ [Русский](README_ru.md) ∙ [简体中文](README_zh-cn.md)*
*[English](README.md) ∙ [Español](README_es.md) ∙ [Русский](README_ru.md) ∙ [简体中文](README_zh-CN.md)∙ [한국어](README_kr.md) ∙ [Tiếng Việt](README_vi.md) ∙ [Français](README_fr.md)*
#### 前言
@ -10,7 +10,7 @@
#### 什么是"飞行规则"?
一个 [宇航员指南](http://www.jsc.nasa.gov/news/columbia/fr_generic.pdf) (现在, 程序员们都在使用GIT) 是关于出现问题过后应该怎么操作
这是一篇给宇航员这里就是指使用Git的程序员们的指南用来指导问题出现后的应对之法
> *飞行规则(Flight Rules)* 是记录在手册上的来之不易的一系列知识,记录了某个事情发生的原因,以及怎样一步一步的进行处理。本质上, 它们是特定场景的非常详细的标准处理流程。 [...]
@ -67,6 +67,12 @@
- [交互式rebase(interactive rebase)可能出现的问题](#%E4%BA%A4%E4%BA%92%E5%BC%8Frebaseinteractive-rebase%E5%8F%AF%E8%83%BD%E5%87%BA%E7%8E%B0%E7%9A%84%E9%97%AE%E9%A2%98)
- [这个rebase 编辑屏幕出现'noop'](#%E8%BF%99%E4%B8%AArebase-%E7%BC%96%E8%BE%91%E5%B1%8F%E5%B9%95%E5%87%BA%E7%8E%B0noop)
- [有冲突的情况](#%E6%9C%89%E5%86%B2%E7%AA%81%E7%9A%84%E6%83%85%E5%86%B5)
- [Stash](#stash)
- [暂存所有改动](#%E6%9A%82%E5%AD%98%E6%89%80%E6%9C%89%E6%94%B9%E5%8A%A8)
- [暂存指定文件](#%E6%9A%82%E5%AD%98%E6%8C%87%E5%AE%9A%E6%96%87%E4%BB%B6)
- [暂存时记录消息](#%E6%9A%82%E5%AD%98%E6%97%B6%E8%AE%B0%E5%BD%95%E6%B6%88%E6%81%AF)
- [使用某个指定暂存](#%E4%BD%BF%E7%94%A8%E6%9F%90%E4%B8%AA%E6%8C%87%E5%AE%9A%E6%9A%82%E5%AD%98)
- [暂存时保留未暂存的内容](#%E6%9A%82%E5%AD%98%E6%97%B6%E4%BF%9D%E7%95%99%E6%9C%AA%E6%9A%82%E5%AD%98%E7%9A%84%E5%86%85%E5%AE%B9)
- [杂项(Miscellaneous Objects)](#%E6%9D%82%E9%A1%B9miscellaneous-objects)
- [克隆所有子模块](#%E5%85%8B%E9%9A%86%E6%89%80%E6%9C%89%E5%AD%90%E6%A8%A1%E5%9D%97)
- [删除标签(tag)](#%E5%88%A0%E9%99%A4%E6%A0%87%E7%AD%BEtag)
@ -87,7 +93,6 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## 编辑提交(editting commits)
<a name="diff-last"></a>
@ -111,12 +116,12 @@ $ git log -n1 -p
如果你的提交信息(commit message)写错了且这次提交(commit)还没有推(push), 你可以通过下面的方法来修改提交信息(commit message):
```sh
$ git commit --amend
$ git commit --amend --only
```
这会打开你的默认编辑器, 在这里你可以编辑信息. 另一方面, 你也可以用一条命令一次完成:
```sh
$ git commit --amend -m 'xxxxxxx'
$ git commit --amend --only -m 'xxxxxxx'
```
如果你已经推(push)了这次提交(commit), 你可以修改这次提交(commit)然后强推(force push), 但是不推荐这么做。
@ -132,7 +137,6 @@ $ git commit --amend --author "New Authorname <authoremail@mydomain.com>"
如果你需要修改所有历史, 参考 'git filter-branch'的指南页.
<a href="#i-want-to-remove-a-file-from-a-commit"></a>
### 我想从一个提交(commit)里移除一个文件
@ -242,25 +246,28 @@ $ git add -N filename.x
然后, 你需要用 `e` 选项来手动选择需要添加的行,执行 `git diff --cached` 将会显示哪些行暂存了哪些行只是保存在本地了。
<a href="stage-in-two-commits"></a>
### 我想把在一个文件里的变化(changes)加到两个提交(commit)里
`git add` 会把整个文件加入到一个提交. `git add -p` 允许交互式的选择你想要提交的部分.
<a href="unstaging-edits-and-staging-the-unstaged"></a>
### 我想把暂存的内容变成未暂存,把未暂存的内容暂存起来
这个有点困难, 我能想到的最好的方法是先stash未暂存的内容 然后重置(reset)再pop第一步stashed的内容, 最后再add它们
多数情况下你应该将所有的内容变为未暂存然后再选择你想要的内容进行commit
但假定你就是想要这么做这里你可以创建一个临时的commit来保存你已暂存的内容然后暂存你的未暂存的内容并进行stash。然后reset最后一个commit将原本暂存的内容变为未暂存最后stash pop回来。
```sh
$ git stash -k
$ git reset --hard
$ git stash pop
$ git add -A
$ git commit -m "WIP"
$ git add .
$ git stash
$ git reset HEAD^
$ git stash pop --index 0
```
注意1: 这里使用`pop`仅仅是因为想尽可能保持幂等。
注意2: 假如你不加上`--index`你会把暂存的文件标记为为存储.这个[链接](https://stackoverflow.com/questions/31595873/git-stash-with-staged-files-does-stash-convert-staged-files-to-unstaged?answertab=active#tab-top) 解释得比较清楚。不过是英文的其大意是说这是一个较为底层的问题stash时会做2个commit其中一个会记录index状态staged的文件等东西另一个记录worktree和其他的一些东西如果你不在apply时加indexgit会把两个一起销毁所以staged里就空了
## 未暂存(Unstaged)的内容
<a href="move-unstaged-edits-to-new-branch"></a>
@ -492,7 +499,6 @@ HEAD is now at a13b85e
这时候, 这里可能会产生冲突, 参见[交互式 rebasing 章](#interactive-rebase) [**冲突节**](#merge-conflict) 解决冲突.
再者, 我们为bug #14 创建一个新的分支, 也基于`master`分支
```sh
@ -507,7 +513,6 @@ HEAD is now at a13b85e
(14)$ git cherry-pick 5ea5173
```
<a name="delete-stale-local-branches"></a>
### 我想删除上游(upstream)分支被删除了的本地分支
一旦你在github 上面合并(merge)了一个pull request, 你就可以删除你fork里被合并的分支。 如果你不准备继续在这个分支里工作, 删除这个分支的本地拷贝会更干净,使你不会陷入工作分支和一堆陈旧分支的混乱之中。
@ -850,6 +855,82 @@ Changes not staged for commit:
(my-branch)$ git rebase --abort
```
<a name="stashing"></a>
## Stash
### 暂存所有改动
暂存你工作目录下的所有改动
```sh
$ git stash
```
你可以使用`-u`来排除一些文件
```sh
$ git stash -u
```
### 暂存指定文件
假设你只想暂存某一个文件
```sh
$ git stash push working-directory-path/filename.ext
```
假设你想暂存多个文件
```sh
$ git stash push working-directory-path/filename1.ext working-directory-path/filename2.ext
```
<a name="stash-msg"></a>
### 暂存时记录消息
这样你可以在`list`时看到它
```sh
$ git stash save <message>
```
```sh
$ git stash push -m <message>
```
<a name="stash-apply-specific"></a>
### 使用某个指定暂存
首先你可以查看你的`stash`记录
```sh
$ git stash list
```
然后你可以`apply`某个`stash`
```sh
$ git stash apply "stash@{n}"
```
此处, 'n'是`stash`在栈中的位置,最上层的`stash`会是0
除此之外,也可以使用时间标记(假如你能记得的话)。
```sh
$ git stash apply "stash@{2.hours.ago}"
```
<a href="stage-and-keep-unstaged"></a>
### 暂存时保留未暂存的内容
你需要手动create一个`stash commit` 然后使用`git stash store`
```sh
$ git stash create
$ git stash store -m "commit-message" CREATED_SHA1
```
<a name="miscellaneous-objects"></a>
## 杂项(Miscellaneous Objects)
@ -985,7 +1066,6 @@ $ git reset --hard 0254ea7
([摘自](https://www.atlassian.com/git/tutorials/rewriting-history/git-reflog)).
# 其它资源(Other Resources)
## 书(Books)

14
package.json Normal file
View File

@ -0,0 +1,14 @@
{
"private": true,
"name": "git-flight-rules",
"version": "1.0.0",
"description": "Flight rules for git",
"scripts": {
"toc": "doctoc --github README.md README_*.md",
"diff": "test -z \"`git diff -- README.md`\" && test -z \"`git diff -- README_*.md`\""
},
"devDependencies": {
"doctoc": "^1.3.0",
"anchor-markdown-header": "thlorenz/anchor-markdown-header#master"
}
}