内容へ移動
とあるエンジニアの闇歴史帳
コピペで使える便利Wiki ※現在構築中です。
ユーザ用ツール
ログイン
トレース:
git:git_add_cancel
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== [Git] git addを取り消す ====== ~~socialite~~ ''git add''を無かったことにします。 ===== コマンド ===== <code> $ git reset foo.txt </code> ===== 実行例 ===== ''git reset [ファイルのパス]'' でキャンセルすることができます。 <code> $ git add foo.txt $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: foo.txt </code> ''git reset''するとUntracked fileとなり、''git add''する前の状態に戻りました。 <code> $ git reset foo.txt $ git status On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) foo.txt </code> なお、''git reset [ファイルのパス]'' は ''git reset HEAD [ファイルのパス]'' と同じ意味になります。 ===== 参考 ===== * [[https://git-scm.com/docs/git-reset|(公式)Git - git-reset Documentation]] * [[https://www.atlassian.com/ja/git/tutorial/undoing-changes#!reset|(Atlassian) The git reset Command]] ===== 関連書籍 ===== <html> <div class="amazlet-box" style="margin-bottom:0px;"><div class="amazlet-image" style="float:left;margin:0px 12px 1px 0px;"><a href="http://www.amazon.co.jp/exec/obidos/ASIN/477415184X/ichikorocom-22/ref=nosim/" name="amazletlink" target="_blank"><img src="http://ecx.images-amazon.com/images/I/51I5ZLcWDaL.jpg" alt="Gitポケットリファレンス" style="border: none;" /></a></div><div class="amazlet-info" style="line-height:120%; margin-bottom: 10px"><div class="amazlet-name" style="margin-bottom:10px;line-height:120%"><a href="http://www.amazon.co.jp/exec/obidos/ASIN/477415184X/ichikorocom-22/ref=nosim/" name="amazletlink" target="_blank">Gitポケットリファレンス</a><div class="amazlet-powered-date" style="font-size:80%;margin-top:5px;line-height:120%">posted with <a href="http://www.amazlet.com/" title="amazlet" target="_blank">amazlet</a> at 16.04.25</div></div><div class="amazlet-detail">岡本 隆史 武田 健太郎 相良 幸範 <br />技術評論社 <br />売り上げランキング: 103,005<br /></div><div class="amazlet-sub-info" style="float: left;"><div class="amazlet-link" style="margin-top: 5px"><a href="http://www.amazon.co.jp/exec/obidos/ASIN/477415184X/ichikorocom-22/ref=nosim/" name="amazletlink" target="_blank">Amazon.co.jpで詳細を見る</a></div></div></div><div class="amazlet-footer" style="clear: left"></div></div> </html> {{tag>git}} ~~socialite~~
関連ページ
git/git_add_cancel.txt
· 最終更新: 2020/06/23 14:10 (外部編集)
ページ用ツール
文書の表示
バックリンク
文書の先頭へ