wiki:GitCautions
Home Overview Workflow Git GitHub Cautions Clone Maintain Patch


Git Cautions and Suggestions

Things to avoid

Commands and options that overwrite data without warning

  • git reset --hard
  • The -f or --force option for any command.
  • The git checkout form that takes path arguments.

Examples:

git checkout -f HEAD
git submodule update --force
git checkout config.hpp
git update .

Once experience and expertise develops, these commands and options can be used (very) sparingly, but they are sharp and very dangerous tools.

Things to embrace

Branching and merging

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.

Stashing

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.

Acknowledgements

Beman Dawes created and maintains this page. Edward Diener, Michael Cox, and Phil Richards contributed cautions.


Last modified 9 years ago Last modified on Dec 30, 2013, 2:15:48 PM
Note: See TracWiki for help on using the wiki.