まとめ
「master で作業してた」みたいなうっかり
ツールの補助を受けながら作業を進めていく( = 定型作業をコマンドに落とし込んでいく)と、減らせるかも
(無関係なブランチで作業してたウッカリは... しらない... cherry-pick とか rebase とか revert とか最後の手段である push -f とかでがんばってほしい)
たとえば git flow
初期化と作業の流れ
git flow init
すると色々聞かれるので適当に設定する
Initialized empty Git repository in /home/my_name/my_repo/.git/ No branches exist yet. Base branches must be created now. Branch name for production releases: [master] Branch name for "next release" development: [develop] How to name your supporting branch prefixes? Feature branches? [feature/] Release branches? [release/] Hotfix branches? [hotfix/] Support branches? [support/] Version tag prefix? []
- あとは
git flow
のサブコマンドを使って作業を進めていく
コマンドに沿って進めていくと、作業しているブランチがほぼ必ず develop
or feature/****
ブランチになるので、大きな事故になりづらい