LoginSignup
0
0

More than 5 years have passed since last update.

『独習Git』7章メモ

Posted at

試したコマンド

  • git rm
  • git mv
  • git reset
  • git checkout

メモ

git reset

ubuntu# git ls-files
ubuntu#
ubuntu# vim file1
ubuntu#
ubuntu#
ubuntu# git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        file1

nothing added to commit but untracked files present (use "git add" to track)
ubuntu# git add .
ubuntu# git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   file1

ubuntu# git diff
ubuntu# git diff --staged
diff --git a/file1 b/file1
new file mode 100644
index 0000000..bda0724
--- /dev/null
+++ b/file1
@@ -0,0 +1,2 @@
+file1

git checkout

ubuntu# vim file1
ubuntu#
ubuntu#
ubuntu# git status; git diff; git diff --staged
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   file1

no changes added to commit (use "git add" and/or "git commit -a")
diff --git a/file1 b/file1
index bda0724..2cfbed9 100644
--- a/file1
+++ b/file1
@@ -1,2 +1,2 @@
 file1
-
+file111111111111
ubuntu# git checkout -- file1
ubuntu#
ubuntu#
ubuntu# git status; git diff; git diff --staged
On branch master
nothing to commit, working directory clean
ubuntu# cat file1
file1
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0