Skip to content

Instantly share code, notes, and snippets.

@sab99r
Last active May 16, 2022 03:57
Show Gist options
  • Save sab99r/05557d6af8343a087ebcab601eb23b09 to your computer and use it in GitHub Desktop.
Save sab99r/05557d6af8343a087ebcab601eb23b09 to your computer and use it in GitHub Desktop.
GIT #git

RESET TO LAST COMMIT

git reset --hard HEAD

REMOVE UNSTAGED FILES

git clean -df

REMOVE CACHE

git rm -r --cached .             

Delete Branch

git branch -d {the_local_branch} (use -D instead to force deleting the branch without checking merged status)
git push origin --delete {the_remote_branch}

Unset and Add Password

git config --global --unset user.password
git config --global --add user.password <new_pass>

Fix Accidental Pulls

#Find your SHA of previus state
git reflog
#Reset eg.
git reset --hard HEAD@{1}

Switch To Pulled Other Branch

git checkout -b branchname origin/branchname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment