Clean

You are here:
Estimated reading time: < 1 min
In this article



Do! Backup modified/created files help with git status;

Checkout File

git checkout -- path/to/file.ext

Force Pull

Important: If you have any local changes, they will be lost. With or without –hard option, any local commits that haven’t been pushed will be lost.(*)

git fetch --all git reset --hard origin/<branch_name>

source

Unstage

$ git rm --cached <filePath>

Delete the most recent commit, keeping the work you’ve done:

git reset --soft HEAD~1

Delete the most recent commit, destroying the work you’ve done:

git reset --hard HEAD~1

Soft waygit checkout -- .;git clean -df

Hard way (Destructive)

git clean -n;git clean -f -d;git clean -fx;git clean -fd;git reset --hard HEAD;
Was this article helpful?
Dislike 0
Views: 24