Git: list only “untracked” files (also, custom commands)

Is there a way to use a command like git ls-files to show only untracked files? The reason I’m asking is because I use the following command to process all deleted files: git ls-files -d | xargs git rm I’d like something similar for untracked files: git some-command –some-options | xargs git add I was … Read more

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

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? … Read more

Remove a folder from git tracking

I need to exclude a folder (name uploads) from tracking. I tried to run git rm -r –cached wordpress/wp-content/uploads and after that I added the path to .gitignore /wordpress/wp-content/uploads but when I ran git status they show up as deleted. If I try to commit the changes, the files will be deleted, not only removed … Read more

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

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 … Read more