简体   繁体   English

Git-已提交和推送的更改中的文件需要取消提交

[英]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.

相关问题 查找已提交但未推送的 git 文件 - find git files that are committed but not pushed Git是不允许的局部变化被提交或推 - Git is not allowing local changes to be committed or pushed 如何区分 Git 中需要拉取的文件和本地提交并准备推送的文件 - How to differentiate between files that need to be pulled in Git, and files that are committed locally and ready to be pushed 如何撤消对Git中某些跟踪文件的已提交和推送的更改? - How do I undo my committed and pushed changes to some of the tracking files in Git? Git与部署:暂存,提交和推送本地更改,而不显示在远程 - Git & Deployment: Local changes staged, committed, and pushed, not showing on remote 撤消所有本地提交但尚未推送的git文件 - undo all local committed yet not pushed files in git git已提交但未推送-在分支中找不到文件,它们在哪里? - git committed but not pushed - cannot find the files in branch, where are they? 是否可以使用Python将文件列表/文件推入/提交到GIT中? - Can a list of files / file be pushed / committed into GIT using Python? Git:获取在crrent分支中提交和推送的文件/文件夹列表 - Git: Get a list of files/folder committed and pushed in crrent branch Git 不显示某些文件的更改已提交或历史记录 - Git not displaying changes committed or in history for some of the files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM