git-rm

How do you fix a bad merge, and replay your good commits onto a fixed merge?

Deadly 提交于 2019-11-25 22:18:30
问题 I accidentally committed an unwanted file ( filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the repository history. Is it possible to rewrite the change history such that filename.orig was never added to the repository in the first place? 回答1: Please don't use this recipe if your situation is not the one described in the question. This recipe is for fixing a bad merge, and replaying your

Removing multiple files from a Git repo that have already been deleted from disk

一笑奈何 提交于 2019-11-25 20:00:02
I have a Git repo that I have deleted four files from using rm ( not git rm ), and my Git status looks like this: # deleted: file1.txt # deleted: file2.txt # deleted: file3.txt # deleted: file4.txt How do I remove these files from Git without having to manually go through and add each file like this: git rm file1 file2 file3 file4 Ideally, I'm looking for something that works in the same way that git add . does, if that's possible. For Git 1.x $ git add -u This tells git to automatically stage tracked files -- including deleting the previously tracked files. For Git 2.0 To stage your whole