感謝のプログラミング 10000時間

たどり着いた結果(さき)は、感謝でした。

Introduction of Git (2)

<スポンサーリンク>

How to commit all files under the current directory

you can use

git add .

this command will copy all the file under the current directory to index.

About git -a option

-a option means that will do "git add" and then will commit the files on the index automatically.
But this command can add the file which is only on the index.

[sysmgr@localhost demo]$ git commit -a -m "want to add fuga.txt"
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       fuga.txt
nothing added to commit but untracked files present (use "git add" to track)

See this.
fuga.txt didn't commit. So, the files which will commit are under the index.

If you want to abort git commit

To abort the commit, you terminated the vi editor which leave conservation undone.

To call back some change from index

use this command below.

git reset HEAD sometext.txt

I will show you the example

[sysmgr@localhost demo]$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   fuga.txt
#

I want to call back this fuga.txt.

$ git reset HEAD fuga.txt

confirm the result.

[sysmgr@localhost demo]$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       fuga.txt
nothing added to commit but untracked files present (use "git add" to track)

I can call back the change of index.