简体   繁体   English

重置推送的更改git存储库

[英]Reset pushed changes git repository

I had accidentally committed and pushed modifications to some files to a branch on bitbucket. 我不小心提交了某些文件并将其修改推送到bitbucket的一个分支上。 When I wanted to remove these files from the commit I used the rm command and ended up deleting the files. 当我想从提交中删除这些文件时,我使用rm命令并最终删除了这些文件。 What I am trying to say is, I ended up deleting the files instead of removing the modifications on them. 我要说的是,我最终删除了文件,而不是删除了对文件的修改。 I tried using git reset but that only resets my latest commit, while the wrong commit/push was several points backwards. 我尝试使用git reset,但是那只会重置我的最新提交,而错误的提交/推送则倒退了几点。 Any ideas? 有任何想法吗?

You need to execute following commands: 您需要执行以下命令:

(if there are no changes, that were submitted after your push) 1. Reset your changes: git reset --hard 2. Update origin: git push origin -f (it will force push your changes). (如果没有更改,则是在推送后提交的)。1.重置更改:git reset --hard 2.更新源:git push origin -f(它将强制推送您的更改)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM