git checkout — 这样子废弃掉本地的修改
undo local commit
git reset HEAD~2 # undo last two commits, keep changes
git reset --hard HEAD~2 # undo last two commits, discard changes
Remove a file from git without removing it from your file system
git reset filename # or git rm --cached filename
echo filename >> .gitingore # add it to .gitignore to avoid re-adding it
git-amend 操作可以对commit message进行amend操作
Clean up local commits before pushing
git rebase --interactive
# if you didn't specify any tracking information for this branch
# you will have to add upstream and remote branch information:
git rebase --interactive origin branch