1

コンソールに入ると:

$   git add .

私は得る:

何も追加されていません 何も指定されていません。'git add.' と言いたかったのでしょうか?

4

5 に答える 5

2

試してみてくださいgit add -A。これにより、すべてがステージング領域に追加されます (新しいファイルなど)。

マニュアルから:

-u と同様ですが、インデックスに加えて作業ツリー内のファイルと照合します。つまり、新しいファイルを見つけるだけでなく、変更されたコンテンツをステージングし、作業ツリーに存在しなくなったファイルを削除します。

于 2013-08-26T11:31:01.483 に答える
2

コミットするものは何もありません

git add .何もしない場合は、次の 2 つの可能性があります。

  • あなたがいるディレクトリは空です
  • フォルダー内のすべてが既に追跡され、変更されていないか、無視されます

たとえば、空のフォルダーの場合:

$ git add .
$ git status
# On branch master
#
# Initial commit
#
$ ls -la
drwxrwxr-x  3 andy andy 4096 Aug 26 11:34 .
drwxrwxrwt 11 andy andy 4096 Aug 26 11:34 ..
drwxrwxr-x  7 andy andy 4096 Aug 26 11:34 .git

または、すべてがすでに追跡され、変更されていない場合:

$ touch foo
$ git add foo
$ git commit -m "adding foo"
[master (root-commit) d27092b] adding foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo
$ git add .
$ git status
# On branch master
nothing to commit, working directory clean
$ ls -la
drwxrwxr-x  3 andy andy 4096 Aug 26 11:34 .
drwxrwxrwt 11 andy andy 4096 Aug 26 11:34 ..
-rw-rw-r--  1 andy andy    0 Aug 26 11:35 foo
drwxrwxr-x  7 andy andy 4096 Aug 26 11:34 .git

git status は変更を報告していないことに注意してください。

無視?

ファイル/フォルダーが無視された場合、gitはそれを無視します:)

ただし、明示的に追加することもできます。

$ echo "bar" > .gitignore
$ touch bar
$ git add bar
The following paths are ignored by one of your .gitignore files:
bar
Use -f if you really want to add them.
fatal: no files added
$ git add -f bar
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   new file:   bar
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .gitignore
$
于 2013-08-26T09:42:10.680 に答える
0

順序は次のようになります。

1)ブランチを開始します: git checkout -b my_cool_branch
2)そのブランチで何かを行います
3)変更したものをコミット キューに追加します: git add .
4)キューに追加したものをコミットします:git commit -m "i'm adding stuff!"

(オプション)
5)マスター (またはメインブランチが何であれ) に戻ります: git checkout master
6)ローカルコミットを github にプッシュします:git push origin master

表示されているエラーから、手順 2 をスキップしたと思われます。本当に変更を加えましたか? 実行git statusして、追跡された/追跡されていない変更を確認します。

于 2013-08-26T09:37:04.393 に答える