git diff --cached
git fetch --all
git reset --hard origin/<branch_name>
git fetch
git reset origin --hard
git pull
or
git fetch
git checkout another-branch
git branch -d affected-branch
git checkout affected-branch
origin is not necessary if local branch
git checkout <origin/branch_name> -- <path>
git checkout --theirs <filename/pattern>
During rebase "ours" refers to the other branch, not the current one we're in
git reset --soft HEAD~1
Step 1 is to show what will be deleted by using the -n option:
git clean -n
Clean Step - beware: this will delete files:
git clean -f
Setting your branch to exactly match the remote branch can be done in two steps:
git fetch origin
git reset --hard origin/master
If you want to save your current branch's state before doing this (just in case), you can do:
git commit -a -m "Saving my work, just in case"
git branch my-saved-work