0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Git] 動作を試す 実行例4:addとcommitでコミットする

Last updated at Posted at 2023-04-28

Gitの動作を理解するために、Gitのコマンドを実際に試して、結果を見てみました。

1つの記事内で一連のGitコマンドが完結しているので、これら一連のコマンドを順に実行させて結果を見ることで、一連のGitの動作を実際に体感でき、一通り独習することが可能です。

※前回記事のリポジトリ状態からの続きになっています。

前回記事へ 目次へ:Git関連記事のまとめページ 次回記事へ

実行例

echo Sample-Added-11 > test1.txt
git add test1.txt
git commit -m "message1"
↓
結果: 
[master (root-commit) 4ace194] message1
 1 file changed, 1 insertion(+)
 create mode 100644 test1.txt

-----

echo Sample-Added-12 >> test1.txt
echo Sample-Added-21 > test2.txt
git add .
git commit -m "message2"
↓
結果: 
[master 00cad71] message2
 2 files changed, 2 insertions(+)
 create mode 100644 test2.txt

-----

echo Sample-Added-13 >> test1.txt
echo Sample-Added-**21 > test2.txt
git commit -m "message3"
↓
結果: 
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:   test1.txt
        modified:   test2.txt

no changes added to commit (use "git add" and/or "git commit -a")

git commit -a -m "message3"
↓
結果: 
[master 20bbab7] message3
 2 files changed, 2 insertions(+), 1 deletion(-)

環境

Windows 10、PortableGit-2.40.0-64-bitを使用、全てローカルPC上で実施、GitHub等は不使用。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?