3/4/2018 - 10:23 PM


To delete a local branch:

git branch -d the_local_branch

To remove a remote branch (if you know what you are doing!):

git push origin :the_remote_branch

or simply use the new syntax (v1.7.0):

git push origin --delete the_remote_branch

Remove all local branches

git branch | grep -v "master" | xargs git branch -D

Helpful links

How to remove local untracked files from the current Git branch

For reference:

See which files will be delete

git clean -n

Will delete the files

git clean -f

Clear git cache

git rm -r --cached .

Git ignore changes to already tracked files

Where file is the name of the file you want to ignore
git update-index --assume-unchanged <file>

Opposite to above

git update-index --no-assume-unchanged <file>

Look at the git config

git config --global -l

Set windows line-endings and update all line-ending


Set LF as your line ending default.

git config --global core.eol lf

Remove the index and force Git to rescan the working directory.

rm .git/index

Rewrite the Git index to pick up all the new line endings.

git reset


Error: Your github oauth token for contains invalid characters


Fix reference: