除了一个文件,我如何Git提交所有(。)?

时间:2015-02-09 15:09:33

标签: git

大家好我已经在几个文件上完成了git rm并修改了一个文件。我想知道如何git commit .提交已删除的文件并排除修改后的文件。

是否有类似

的内容
git commit -m "Files deleted" . -exclude scripts/process_old_FBA_orders.php

以下是我的git状态

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    deleted:    help/he_about.html
    deleted:    help/he_glossary.html
    deleted:    help/he_index.html
    deleted:    help/he_jadmin/ad_index.html
    deleted:    help/he_jadmin/ad_server_info.html
    deleted:    help/he_jadmin/ad_users.html
    deleted:    help/he_orders/or_index.html
    deleted:    help/he_products/pr_index.html
    deleted:    help/he_reports/re_index.html
    deleted:    help/he_setup/se_index.html
    deleted:    help/he_stock/st_index.html
    deleted:    help/he_stock/st_needed_items.html
    deleted:    help/he_stock/st_purchase_orders.html
    deleted:    help/he_stock/st_stock_orders.html
    deleted:    help/he_stock/st_stocked_items.html
    deleted:    help/he_stock/st_suppliers.html
    deleted:    help/he_stock/st_suppliers_items.html

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:   scripts/process_old_FBA_orders.php

2 个答案:

答案 0 :(得分:3)

如果只有一两个文件,我看到它很容易添加所有文件,然后重置不需要的文件。

$ cd /path/to/repo
$ git add .
$ git reset /path/to/unwanted/file 
$ git commit -m 'commit message'

您可以重置整个目录$ git reset /path/to/directory/

答案 1 :(得分:2)

只需运行git commit -m "Files deleted"。 未提交未提交的更改(在git status中指定)。