我正在一个网站上工作,我正在使用React create应用程序和它的webpack配置。我一直在推动Github回购,没有任何问题。几天前,我把我正在制作的网站变成了GithubPages网站(即mygithubname.Github.io(
在将这个repo变成Github Pages网站后,我的项目的repo结构发生了变化。看起来它为了把代码放到网上而最小化了代码。有一次我推送了这个回购,并将其变成了一个实时的Github页面网站,突然之间我再也推不到回购了。
如果我推送回购,我会收到一个错误:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Nicknyr/New_Portfolio.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我已经在网上进行了一些搜索,并尝试进行git pull origin master
来更正该问题。如果我尝试这样做,它会删除我项目的75%,并且我的大部分组件都会丢失。这是git pull origin master
:的结果
git pull origin master
From https://github.com/Nicknyr/New_Portfolio
* branch master -> FETCH_HEAD
Removing yarn.lock
CONFLICT (modify/delete): src/styles/_Projects.scss deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/styles/_Projects.scss left in tree.
CONFLICT (modify/delete): src/styles/_Info.scss deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/styles/_Info.scss left in tree.
Removing src/styles/_Header.scss
CONFLICT (modify/delete): src/styles/_Global.scss deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/styles/_Global.scss left in tree.
Removing src/styles/_Footer.scss
Removing src/styles/_ContactForm.scss
Removing src/styles/_Contact.scss
Removing src/registerServiceWorker.js
Removing src/logo.svg
Removing src/index.js
Removing src/index.css
Removing src/images/tic-tac-toe-medium.png
Removing src/images/steem-medium.png
Removing src/images/resume-new.png
Removing src/images/resume-medium.png
Removing src/images/redo.png
Removing src/images/pomodoro-small.png
Removing src/images/placeholder.png
Removing src/images/nodes-no-color.jpg
Removing src/images/name-logo.png
Removing src/images/name-logo-small.png
Removing src/images/euro-small.png
Removing src/images/euro-large.png
Removing src/images/euro-250.png
Removing src/images/centered.png
Removing src/images/blue-nodes-opacity.jpg
Removing src/images/background-2462434_1920.jpg
CONFLICT (modify/delete): src/Projects.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Projects.js left in tree.
Removing src/NodeMailer.js
CONFLICT (modify/delete): src/Menu.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Menu.js left in tree.
Removing src/Info.js
CONFLICT (modify/delete): src/Header.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Header.js left in tree.
Removing src/Footer.js
Removing src/ContactForm.js
CONFLICT (modify/delete): src/Contact.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/Contact.js left in tree.
Removing src/App.test.js
Removing src/App.scss
CONFLICT (modify/delete): src/App.js deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/App.js left in tree.
CONFLICT (modify/delete): src/App.css deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of src/App.css left in tree.
Removing public/index.html
CONFLICT (modify/delete): package.json deleted in 5977716b3eb3a9424a9efdbf835a0a2ae9cf6f88 and modified in HEAD. Version HEAD of package.json left in tree.
Removing README.md
Removing .gitignore
Automatic merge failed; fix conflicts and then commit the result.
它删除了我的大部分项目。我通过git reset --hard
解开了这个。我拿回了我的项目文件,但我仍然无法推送到Github。
以下是在将我的网站变成Github Pages网站后,我的repo发生了什么。正如你所看到的,它删除了我的大部分项目,这似乎是我在git pull origin master
时恢复的内容。
我该如何解决这个问题?我想让我的分支步入正轨,这样我就可以在不丢失所有这些文件的情况下继续推进它。
将您提交的文件或目录制作为
git add .
或者文件/目录名而不是".">
git commit --all
git push origin master
此外,你需要确保你没有落后于已经推送的代码。如果是这样的话,这个错误将被引发
我试图数字pullr然后git推送原点主机
okey