YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* ステージングを取り消す(INDEXを戻す) [#l4334612]
** あるファイルのステージングを取り消す [#j1d905d6]
vi test.txt # (1) test.txtを修正する
git add test.txt # (2) test.txtをステージングする
git reset HEAD test.txt # (3) 上のステージングを取り消...
# test.txtは修正されたまま...
- git reset HEAD の代わりに git reset --mixed HEAD と省略...
** まとめて複数のファイルのステージングを取り消す [#d49ed...
*** ステージングしたファイルの一覧を取得する [#t04102b5]
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: 1.txt
modified: 2.txt
modified: 3.txt
$ git diff --cached --name-only
1.txt
2.txt
3.txt
*** ステージングしたファイルの一覧をまとめて取り消す [#vd...
PowerShell> git reset HEAD (git diff --cached --name-only)
Bash> git reset HEAD $(git diff --cached --name-only)
- https://stackoverflow.com/questions/2298047/git-ls-file...
** 修正したファイル戻す [#q7f621d6]
git checkout test.txt # test.txtは(1)で修正される前...
** 一度もコミットしてない状態でADDしたファイルのステージ...
git rm --cached test.txt
- 一度もコミットしていないと、git reset HEADしようとして...
>fatal: ambiguous argument 'HEAD': unknown revision or pa...
終了行:
* ステージングを取り消す(INDEXを戻す) [#l4334612]
** あるファイルのステージングを取り消す [#j1d905d6]
vi test.txt # (1) test.txtを修正する
git add test.txt # (2) test.txtをステージングする
git reset HEAD test.txt # (3) 上のステージングを取り消...
# test.txtは修正されたまま...
- git reset HEAD の代わりに git reset --mixed HEAD と省略...
** まとめて複数のファイルのステージングを取り消す [#d49ed...
*** ステージングしたファイルの一覧を取得する [#t04102b5]
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: 1.txt
modified: 2.txt
modified: 3.txt
$ git diff --cached --name-only
1.txt
2.txt
3.txt
*** ステージングしたファイルの一覧をまとめて取り消す [#vd...
PowerShell> git reset HEAD (git diff --cached --name-only)
Bash> git reset HEAD $(git diff --cached --name-only)
- https://stackoverflow.com/questions/2298047/git-ls-file...
** 修正したファイル戻す [#q7f621d6]
git checkout test.txt # test.txtは(1)で修正される前...
** 一度もコミットしてない状態でADDしたファイルのステージ...
git rm --cached test.txt
- 一度もコミットしていないと、git reset HEADしようとして...
>fatal: ambiguous argument 'HEAD': unknown revision or pa...
ページ名: