从目录和主分支的顶部:
git status
表示已成功添加所有内容git commit显示创建了3个文件,这是有意义的,因为2个被修改,3个是新的
> git commit -m 'viewervalidation'
[master f73f0bc] viewervalidation
5 files changed, 289 insertions(+), 6 deletions(-)
create mode 100644 viewervalidation/file1.py
create mode 100644 viewervalidation/file2.py
create mode 100644 viewervalidation/file3.py
我推动掌握,因为我没有在当地工作而被拒绝
> git push origin master
To github.com:groupflix/data-science.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:xxx.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
所以我决定创建一个名为vv_exp1的新分支并推送到那个:
> git checkout -b 'vv_exp1'
M general_scripts/data_munging/neo4j_query.py
D general_scripts/data_munging/remove_bad_users.py
M nlp_api/summarizer/classes/review.py
M nlp_api/summarizer/modeling/pull_openend_sentiment_dataset.py
Switched to a new branch 'vv_exp1'
> git push origin 'vv_exp1'
Counting objects: 749, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (722/722), done.
Writing objects: 100% (749/749), 833.12 KiB | 0 bytes/s, done.
Total 749 (delta 374), reused 3 (delta 0)
remote: Resolving deltas: 100% (374/374), done.
To github.com:groupflix/data-science.git
* [new branch] vv_exp1 -> vv_exp1
这是事情变得非常奇怪的地方。我去运行scrapy(我在这个目录中使用)和我用了几周成功scrapy crawl NameSearch -a filename=12.csv
的命令产生以下结果:
Scrapy 1.0.3 - no active project
Unknown command: crawl
Use "scrapy" to see available commands
最重要的是,我去查看目录,发现所有“创建”的新文件现在都已消失。当我切换到掌握它们仍然消失,scrapy仍然无法正常工作。如果我继续使用github,它们就在我推动的分支上,但是如果我尝试拉它,那么即使我错过了那些文件,我仍然是最新的。知道我的文件发生了什么,以及为什么Scrapy只是创建一个新的分支并推动?
答案 0 :(得分:1)
你可以尝试:
git branch -a
git remote show origin
第一个命令将列出所有分支。第二个命令可以获取远程分支。尝试: git pull 在你推向原点之前。
答案 1 :(得分:0)
我弄清楚问题是什么,我正在使用稀疏检查来只提取一些repo,但是我的稀疏检出文件还没有包含我试图拉到这里的viewervalidation目录。当我添加文件路径时,它解决了问题。