Github意外更改两个文件 [英] Github accidental changes in two files

查看:87
本文介绍了Github意外更改两个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GitHub的新手,目前正在学习在公共存储库上工作.我已经分叉了存储库,并创建了两个分支(主分支和测试分支).我在测试部门工作.

I am new to GitHub and am currently learning to work on a public repository. I have forked the repository and have two branches created (master and testing). I work on the testing branch.

偶然地,我更改了远程存储库中不应更改的两个文件,并创建了请求请求.当然,由于这些更改,我的请求被放弃了,并要求我从这两个文件中还原更改. 我尝试使用Internet上可用的许多方法以及我自己的一些方法来还原更改. (例如从git手动复制粘贴),git revert等.

Accidentally I changed two files of the remote repository that were not supposed to be changed and created a pull request. Of course, my request was discarded because of those changes and I was asked to revert the changes from those two files. I tried to revert the changes using many methods available on the internet and also some of my own. (like manual copy-paste from git), git revert and others.

现在,当我运行git diff <testing> origin/master时,看不到两个禁止的文件.这是否意味着它们之间没有区别?

Now, when I run git diff <testing> origin/master , I do not see the two forbidden files. Does that mean there's no difference in them ?

有人可以向我解释如何检查远程存储库中特定文件的差异吗? 有人还能解释如何还原禁止的更改并创建新的拉取请求.

Can someone explain to me how to check differences in particular files from remote repository ? And can someone also explain how to revert forbidden changes and create a new pull request.

非常感谢.

推荐答案

由于您告诉我们创建了对两个文件进行了不想要的修改的请求请求,因此,我假设您已经提交了这些更改.

Since you told us that you created a pull request with unwanted modifications to two files, I will assume therefore that you have already committed those changes.

如果所讨论的提交是testing分支中的最新提交,则可以尝试将这两个文件重置为紧接的先前提交,然后修改该提交:

If the commit in question is the most recent commit in the testing branch then you can try resetting those two files to the immediately prior commit and then amending the commit:

git checkout testing
git checkout HEAD~1 -- path/to/file1.ext
git checkout HEAD~1 -- path/to/file2.ext
# git add, if needed
git commit --amend
git push --force origin testing

这篇关于Github意外更改两个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆