[英]Git - files from committed and pushed changes need to be uncommitted
On a separate branch as a pull request I have committed and pushed some system and project environment files. 在作为拉取请求的单独分支上,我已提交并推送了一些系统和项目环境文件。 They cause huge issues for other developers because they are my system files interfering with their system files.
它们给其他开发人员带来了巨大的问题,因为它们是我的系统文件,干扰了他们的系统文件。 How can I remove those files from that PR?
如何从PR中删除这些文件?
Suppose you modified the files on my-branch~3: 假设您修改了my-branch〜3上的文件:
git checkout my-branch~3
git checkout HEAD~1 -- some-file.txt some-file2.txt
git commit --amend --no-edit # amend revision, those files will be as they were on previous revision
git cherry-pick my-branch~3..my-branch # rewrite remaining history of branch
# check the branch to make sure everything is of
# if it is... continue with the recipe
git branch -f my-branch #move branch pointer to new rewritten branch
git checkout my-branch
git push --force origin my-branch # adjust name of branch and remote
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.