我刚刚提交了我的工作树,首先添加到索引,使用"$ git commit -m'test'"我将stdout-put从此保存到文件中,我在顶部看到它说
# On branch master  
# Changed but not updated:  
# (use "git add/rm ..." to update what will be commited)  
# (use "git checkout -- ..." to discard changes in working directory)"  
问题是我的工作树没有被提交给回购,我觉得这与它有关
谢谢
d33*_*tah 28
git push -u origin master
您最有可能尝试将提交推送到尚未创建的分支 - 例如,在没有自动创建README文件的新创建的Github存储库中.通过调用git push -u origin master,您可以指定需要推送到的远程(origin,通常是git默认值)和分支(master,在典型情况下也是默认值).根据git文档:
-u, - set-upstream 对于每个最新或成功推送的分支,添加上游(跟踪)引用,由无参数git-pull(1)和其他命令使用.有关更多信息,请参阅git-config(1)中的branch..merge.
这意味着在成功运行此命令之后,从那时起您将能够使用git push并且git pull它将默认为origin master(有一些例外).
在提交更改之前,必须先将其添加到索引:
git add myfile
git commit -m "test"
或者,您可以使用更像SVN的样式并提交更改的所有内容:
git commit -a -m "test"
或者您只需添加并提交单个文件:
git commit myfile -m "test"