我的本地目录测试中有很多文件。
ls test
test1 test2 test3 test4 test5 tes6 test7
推送测试中的所有文件
cd test
sudo git init
git add *
git commit -am "push"
git push -f origin master
从file1
到file7
的所有文件都推送到我的 github 存储库中。
现在如何仅将test1
test4
test5
test7
推送到我的 github 存储库中?
这是我的wordpress目录。
ls /var/www/html/wp
index.php wp-blog-header.php wp-includes wp-signup.php
license.txt wp-comments-post.php wp-links-opml.php wp-trackback.php
readme.html wp-config.php wp-load.php xmlrpc.php
wc wp-config-sample.php wp-login.php
wp-activate.php wp-content wp-mail.php
wp-admin wp-cron.php wp-settings.php
推送所有目录而不是 wp 内容。
如果这些文件夹为空,则需要在其中添加一个文件(任何文件)。
例如,一个.gitkeep
空文件。
如果它们不为空,则 agit add test1 test4 test5 test7
就足够了。
或:
.gitginore
中添加其他文件夹(您不想添加)。test10/
然后你可以
git add .
(不需要*
),提交和推送。
这将添加除您不需要的文件夹之外的所有内容。
避免使用git add *
,因为"*"是由外壳解释的。