How to remove these files from my current branch in Git?
How to remove these files from my current branch in Git?
You need to mark a file for deletion with the command below
git rm <file>
Executing the command below, the file is marked deleted :
git status
Now you can only perform the removal by doing the commit:
git commit -am "Removido arquivo..."
If the files are in the Untracked
state, it means that git
does not yet have them under versioning.
You can use the following command:
git clean -f
Or delete the files manually with your preferred program, for example command rm
on the command line.
It is worth mentioning that after deleting it will not be able to revert, after all the file never was under versioning.
If the files are versioned in git then the correct answer is @ Brandão
Shows the files that will be removed:
git clean -dnf
Remove untrackeds files
git clean -df
You can consult the documentation at link
git rm arquivo.txt
After this, simply commit to confirm the removal
git commit -a -m "Exclusao do arquivo.txt"