github非快进错误
我是Git的新手,遇到了以下情况:github非快进错误,git,github,Git,Github,我是Git的新手,遇到了以下情况: 我正在通过我的雇主学习Python。基本上,您下载一个ZIP文件,它是一个包含文件、练习等的目录。您可以修改练习文件夹中的代码以获得正确的解决方案 现在我需要将这些更新的代码文件推送到git repo 但是为了正确地做每件事,我需要将原始回购协议转移到我应该将更新的代码推送到的地方 所以我分叉了这个repo,但没有将它克隆到我的本地机器上,因为如果我这样做,它会覆盖更新的代码(对吗?) 我试着做如下事情 打开Git,并使用更新的代码导航到“我的机器”中的文件夹
git commit -m "Add corrections"
git remote add origin [the forked repo in company github]
git push
然后我收到非快进错误
我的问题是,当一个repo文件位于我的本地时,如何推送该文件的更新版本,而不必克隆目录并手动替换文件?
这是我的git状态
log:
$ git status
rebase in progress; onto 8e66f31
You are currently rebasing branch 'master' on '8e66f31'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: SSH_KEY.txt
new file: data/baby_names.csv
new file: data/rc play.py
new file: exercises/compare.py
new file: exercises/stats.py
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both added: data/NY.csv
both added: data/NY_sample.csv
both added: data/series_I.dat
both added: data/series_II.dat
both added: data/series_III.dat
both added: data/series_IV.dat
both added: exercises/classes_1.py
both added: exercises/classes_2.py
both added: exercises/exceptions.py
both added: exercises/streaming.py
both added: exercises/tests.py
both added: test_code
$git状态
正在进行的重新设定基准;安装到8e66f31上
您当前正在对“8e66f31”上的分支“主”重定基址。
(修复冲突,然后运行“git-rebase--continue”)
(使用“git-rebase--skip”跳过此修补程序)
(使用“git rebase--abort”签出原始分支)
要提交的更改:
(使用“git重置磁头…”取消分级)
新文件:SSH_KEY.txt
新文件:data/baby_names.csv
新文件:data/rc play.py
新文件:exercises/compare.py
新文件:exercises/stats.py
未合并路径:
(使用“git重置磁头…”取消分级)
(使用“git add…”标记分辨率)
都添加了:data/NY.csv
都添加了:data/NY_sample.csv
两者均添加:数据/系列I.dat
均添加:数据/系列_II.dat
两者均添加:数据/系列_III.dat
两者均添加:数据/系列_IV.dat
两个都增加了:练习/课程\u 1.py
两者都增加了:练习/课程2.py
都添加了:exercises/exceptions.py
都添加了:exercises/streaming.py
都添加了:exercises/tests.py
两者都添加了测试代码
一种简单的方法是克隆fork,将修改过的文件复制到克隆上,然后执行通常的git add-A
,git commit-m
等操作
另一种方法是在您自己的目录中提交您的更改,然后将您的fork作为远程文件添加到它,从fork重置为最新版本,然后在上面应用您的提交
在您自己的目录中:
git init
git add -A
git commit -m <msg> # <- note this commit id
git remote add origin <fork git address>
git reset --hard origin/master
git cherry-pick <commit id from third step>
git init
git添加-A
git commit-m#我得到了第一部分,这是我想要避免的,因为我将不得不对几个文件夹执行此操作。不幸的是,我没有理解第二部分。否决票?至少添加一条评论,说明为什么你认为答案不好@vashts85:为了让答案更清楚,我对答案进行了扩展,但我不认为这样做与几个文件夹有什么关系。您可以编写脚本来重复此操作。