How do you remove untracked files with git clean?
git clean deletes untracked files and cannot be undone. Learn the dry run, the -f, -d, -x and -i options and a safe routine.
44 posts about Git: questions with answers, tutorials and articles, newest first.
git clean deletes untracked files and cannot be undone. Learn the dry run, the -f, -d, -x and -i options and a safe routine.
git revert undoes a commit by adding a new one, so shared history is never rewritten. Learn the options, merge reverts and conflict handling.
git reset has three modes. Soft keeps changes staged, mixed unstages them and hard discards them. See each one in action and how to recover.
git restore discards edits, recovers deleted files and unstages work in Git 2.23 and later. See each form with examples and the risks to avoid.
Use git restore --staged to remove a file from the staging area without losing your edits. Learn the older git reset form and how to unstage single hunks.
Use git restore to discard unstaged changes in one file or the whole project. Learn why it is permanent and how git stash and git clean fit in.
git commit --amend replaces the latest commit so you can fix a message or add a forgotten file. Learn the safe way to use it and how to undo a bad amend.
Use git mv to rename or move tracked files and git rm to delete them. Learn how Git detects renames and how to recover a file you removed by mistake.
A .gitignore file keeps build output, dependencies and secrets out of your repository. Learn the pattern syntax and how to ignore files already tracked.
Use git diff to see what changed in your files before you commit. Learn to read the output and compare the working tree, staging area, commits and branches.
Learn git log from the basics to filtering by author, date, message, file and code. Use --oneline and --graph to read history quickly.
A good commit message is short, imperative and explains why a change was made. Learn the format, common conventions and mistakes to avoid.
git commit records your staged snapshot in history. See what a commit stores, the options you need every day, and how to fix the latest one safely.
git add copies changes into the staging area. Learn the forms you will use daily, including patch mode, and the mistakes that put wrong files in commits.
Learn to read every section of git status, use the short format, and decide the next step before staging or committing your changes.
The working directory holds your edits, the git staging area holds the next commit, and the repository stores history. See how a change moves through them.
Run git init to turn a folder into a Git repository, then set the default branch, add a gitignore and make your first commit.
Use git config to set the name and email stored in every commit, override them per repository and correct a commit made with the wrong identity.
Step by step instructions to install Git on Windows, macOS and Linux, check the version, fix PATH problems and keep Git updated.
Git tracks your project history on your computer, while GitHub hosts Git repositories online and adds collaboration features. Learn how they work together.