1. Three ways to undo changes made to Git project
- git checkout HEAD filename: Discards changes in the working directory
- git reset HEAD filename: Unstages the file changes in staging area
- git reset SHA: used to reset to a previous commit in the commit history
2. add multiple files to staging area with single command
git add filename_1, filename_2
3. Useful commands in git branch workflow
- git branch : List all Git project‘s branches
- git branch branch_name : Create a new branch
- git checkout branch_name : Switch from one branch to another
- git merge branch_name : Join file changes from one branch to another
- git branch -d branch_name : delete a specified branch
4. Use commands in Git Collaborative Workflow
- git clone : create a local copy of a remome
- git remoe -v : Lists a git project‘s remotes
- git fetch : Fetches work from remote into local copy
- git merge origin/master : Mergers origin/master into the local branch
- git push origin <branch_name> : pushes a local branch to the origin remote
common git commands
原文:http://www.cnblogs.com/li-hongjie/p/5061940.html