如何删除远程存储库中的文件? [英] how to delete files in the remote repository?

查看:115
本文介绍了如何删除远程存储库中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这个问题的具体含义是什么。基本上,我需要删除一些文件&我的远程存储库上的目录



我有一个本地git repo&在github的远程回购


  1. 一直在自己工作。

  2. 一位朋友提出了一个请求。

  3. 我合并了他的请求(通过github界面)

  4. 我抽出了更改。代码并决定不进行修改(不应该在第一个地方进行合并)

  5. 我恢复了以前的提交 更改

  6. 推送到服务器。

这就是我的本地存储库时刻:

  * 7e143b1(HEAD)
| \
| * 18cea0f(起源/主,起源/头,主)
| | \
| | * fc19ccf
* | | 6f3c58a
| / /
* | 8d82486
| /
| * d3ce65f(pre-install-activeadmin)
| /
* 7d0566c
* d1c77ab
* 75ba704
* 30dc67c(heroku / master)
* f89b1f6
* ea5e2db
* 08931d6
* 9773a6f
* b636aba
* cb6f8d4

我可以将我的本地存储库更改为 7d0566c 。我不确定远程仓库中的仓库指向哪里。



如何删除那些位于远程仓库但不在本地仓库中的文件?



很明显,我没有在我的本地回购库中看到他的任何文件,因为我将HEAD重置为先前的提交。但是,远程回购仍然显示他的文件。当我承诺时,它承诺很好。

我的工作流程是否错误?我应该首先测试这个补丁。任何建议?我是版本控制的新手。谢谢

解决方案

从服务器拉取更改,然后执行 git rm 在您的本地回购站上,提交更改并推送到服务器。这些文件将被删除。


I am not sure what is the exact term for this problem. Basically, I need to remove some files & directory on my remote repository

I have a local git repo & remote repo in github

  1. Had been working myself.
  2. A friend made a pull request.
  3. I merged his request (via github interface)
  4. I pulled the changes.
  5. I tested the code and decided not to take his changes (shouldn't have merged at the first place)
  6. I reverted back to a previous commit
  7. Made some changes
  8. Push to the server.

This is how my local repository looks like at the moment:

*   7e143b1  (HEAD)
|\  
| *   18cea0f  (origin/master, origin/HEAD, master)
| |\  
| | * fc19ccf 
* | | 6f3c58a 
|/ /  
* | 8d82486 
|/  
| * d3ce65f  (pre-install-activeadmin)
|/  
* 7d0566c 
* d1c77ab 
* 75ba704 
* 30dc67c  (heroku/master)
* f89b1f6 
* ea5e2db 
* 08931d6 
* 9773a6f 
* b636aba 
* cb6f8d4 

I can change my local repo to 7d0566c. I am not sure where the head on my remote repo is pointing to.

How do I remove those files that are on remote repo but are not on my local repo?

Obviously, I do not see any of his files in my local repo because I did a reset of my HEAD to a previous commit. However, the remote repo still shows his files. When I commit, it commits just fine.

Is my workflow wrong? I should have just tested the patch at the first place. Any suggestion? I am new to version control. Thank you

解决方案

Pull the changes from the server, then do a git rm on your local repo, commit the changes, and push to the server. The files will be deleted.

这篇关于如何删除远程存储库中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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