Git Usage
更新日期:
- 1. Install git.
- 2. Global Config
- 3. Initialize
- 4. Add files
- 5. Commit locally.
- 6. Generate SSH key.
- 7. Test your account
- 8. Connect to your repository and push
- 9. Revert changes made to your working copy
- 10. Revert changes made to the index (i.e., that you have added)
- 11. Revert a change that you have committed
- 12. How to show what a commit did
- 13. Create a new remote branch
- 14. Handle conflicts when pulling changes from remote
- 15. Diff local changes after staged
- 16. throw away the local commits, and pull the remote commits at origin/master
- 17. Ignore file mode differences
- 18. Delete the last commit
- 19. DIFF files between 2 different branches
- 20. 克隆一个仓库,不拿所有的历史
- 21. GIT clone branch only
- 22. 新建一个分支时,一定要记得加上
- 23. Ignore folder that accidentally committed
- 24. Git 协作流程
- 25. 常用 Git 命令清单
Install git.
Global Config
Initialize
Add files
Commit locally.
Generate SSH key.
Test your account
Connect to your repository and push
Revert changes made to your working copy
Revert changes made to the index (i.e., that you have added)
Revert a change that you have committed
How to show what a commit did
Create a new remote branch
Handle conflicts when pulling changes from remote
Diff local changes after staged
throw away the local commits, and pull the remote commits at origin/master
Ignore file mode differences
Delete the last commit
DIFF files between 2 different branches
克隆一个仓库,不拿所有的历史
GIT clone branch only
新建一个分支时,一定要记得加上
- As of Git 1.8.0:
Or, if local branch foo is not the current branch:
Or, if you like to type longer commands, these are equivalent to the above two:
- As of Git 1.7.0: