計算機科学のブログ

Git - Undoing: Fixing Your Mistakes - restore

Head First Git: A Learner’s Guide to Understanding Git from the Inside OutRaju Gandhi(著)、 O’Reilly Mediaの Chapter 4.(Undoing: Fixing Your Mistakes)、EXERCISEL(17/130)の解答を求めてみる。

入出力結果(Terminal, Zsh)

% git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   invitation-card.md

no changes added to commit (use "git add" and/or "git commit -a")
% git diff
diff --git a/invitation-card.md b/invitation-card.md
index 003927e..cbe8de9 100644
--- a/invitation-card.md
+++ b/invitation-card.md
@@ -8,6 +8,6 @@
 
     Gitanjali & Aref
 
-Saturday, June 25th
+Saturday, July 3rd
 
-R.S.V.P to Trinity by June 1st
+R.S.V.P to Trinity by June 7th
% git restore invitation-card.md
% git status
On branch master
nothing to commit, working tree clean
% git diff
%