Add best practice about not using "git commit -a"

This commit is contained in:
2017-07-07 16:32:59 +01:00
parent 90a6abc1c3
commit 5c783bc234

View File

@@ -168,16 +168,19 @@ interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119).
the official git the official git
documentation: documentation:
<https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project> <https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project>
2. You SHOULD always use "--force-with-lease" when doing a force push. The 2. You SHOULD never blindly commit all changes with "git commit -a". Use
"git add" to add individual changes to the staging area so you are fully
aware of what you are committing.
3. You SHOULD always use "--force-with-lease" when doing a force push. The
plain "--force" option is dangerous and destructive. More plain "--force" option is dangerous and destructive. More
information: information:
<https://developer.atlassian.com/blog/2015/04/force-with-lease/> <https://developer.atlassian.com/blog/2015/04/force-with-lease/>
3. You SHOULD understand and be comfortable with 4. You SHOULD understand and be comfortable with
rebasing: <https://git-scm.com/book/en/v2/Git-Branching-Rebasing> rebasing: <https://git-scm.com/book/en/v2/Git-Branching-Rebasing>
4. It is RECOMMENDED that you always do "git pull --rebase" instead of "git 5. It is RECOMMENDED that you always do "git pull --rebase" instead of "git
pull" to avoid unnecessary merge commits. You can make this the default pull" to avoid unnecessary merge commits. You can make this the default
behavior of "git pull" with "git config --global pull.rebase true". behavior of "git pull" with "git config --global pull.rebase true".
5. It is RECOMMENDED that all branches be merged using "git merge --no-ff". 6. It is RECOMMENDED that all branches be merged using "git merge --no-ff".
This makes sure the reference to the original branch is kept in the This makes sure the reference to the original branch is kept in the
commits, allows one to revert a merge by reverting a single merge commit, commits, allows one to revert a merge by reverting a single merge commit,
and creates a merge commit to mark the integration of the branch with and creates a merge commit to mark the integration of the branch with