如何从git master中提取新文件?

时间:2015-03-26 20:00:33

标签: git git-pull git-fetch

您好我一直在搜索所有论坛和搜索引擎,以便做我认为简单的事情。我试图将所有更改从我的主git repo拉到远程分支。它会这样做,但不会拉入创建的新文件。我怎样才能确保使用

将新文件添加到分支中
git pull

我试过了:

git checkout master newfile.html

git checkout HEAD -- newfile.html

我认为默认情况下'拉'只会更新master new或not new中的所有内容,但显然并非如此。我该怎么做?

2 个答案:

答案 0 :(得分:1)

我相信你必须这样做

git pull origin branch_name

答案 1 :(得分:0)

谢谢你的回复。它似乎适用于所有3:

git checkout master
Already on 'master'
git merge master
git pull


Enter passphrase for key '/home/seytunn/.ssh/id_dsa': 
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 10 (delta 7), reused 7 (delta 4), pack-reused 0
Unpacking objects: 100% (10/10), done.
From github.com:seytunn/my_rnnn
6fc621c..64afc61  master     -> origin/master
Updating 6fc621c..64afc61
Fast-forward
css/main.css |   21 +++++++-
require.html  |  152    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 172 insertions(+), 1 deletions(-)
 create mode 100644 require.html