| | 1 | = Git Cautions and Suggestions = |
| | 2 | [[PageOutline]] |
| | 3 | |
| | 4 | == Things to avoid == |
| | 5 | |
| | 6 | === Commands and options that overwrite data === |
| | 7 | |
| | 8 | * {{{git reset --hard}}} |
| | 9 | * The {{{-f}}} or {{{--force}}} option for any command. |
| | 10 | |
| | 11 | Examples: |
| | 12 | |
| | 13 | {{{ |
| | 14 | git checkout -f HEAD |
| | 15 | git submodule update --force |
| | 16 | }}} |
| | 17 | |
| | 18 | Once experience and expertise develops, these commands and options can be used (very) sparingly, but they are sharp, dangerous tools. |
| | 19 | |
| | 20 | == Things to embrace == |
| | 21 | |
| | 22 | === Branching and merging === |
| | 23 | |
| | 24 | Git users find that branching and merging is so fast, easy, and reliable that branching early and often is a very effective development and maintenance practice. If you aren't branching early and often, you are missing out on one of the major joys of git. |
| | 25 | |
| | 26 | === Stashing === |
| | 27 | |
| | 28 | Even when working on purpose-created branches, the situation arises where you want to temporarily set aside some work-in-progress. That's what {{{git stash}}} is for, so learn how to use it. |
| | 29 | |
| | 30 | == Acknowledgements == |
| | 31 | |
| | 32 | Edward Diener, Michael Cox contributed suggestions and comments in Boost mailing list discussions. |
| | 33 | |
| | 34 | ----- |