How to clean your local branch

Scott
Sep 22, 2021

--

git status Get a visual of current changes. red changes are unstaged changes. Green changes are staged changes.

I use the following to clear all changes

git reset Unstage your changes

git checkout .

git checkout -- .

git clean -f -fd -fx

For pesky untracked files that just won’t clear

git clean -fdxn (previews)

git clean -fdx

If there is a pesky file that won’t change, then you can do the following:
git checkout -- <file name>

If all that doesn’t work and you don’t have any commits you care about, then you can do this:

git reset --hard HEAD~1

git pull origin develop

--

--

No responses yet