aboutsummaryrefslogtreecommitdiff
path: root/cheatsheet.txt
diff options
context:
space:
mode:
Diffstat (limited to 'cheatsheet.txt')
-rw-r--r--cheatsheet.txt38
1 files changed, 32 insertions, 6 deletions
diff --git a/cheatsheet.txt b/cheatsheet.txt
index 4413252..42655a1 100644
--- a/cheatsheet.txt
+++ b/cheatsheet.txt
@@ -1,20 +1,44 @@
Global Setup
- See also Submodules below.
+ See also Submodules and History Cleanup configurations below.
+
+ git config --global user.name "First Last"
+ git config --global user.email first@example.com
git config --global color.status.branch magenta
- # This makes sure that changes to tags are also fetched.
+ # This makes sure that changes to tags are also fetched. The second
+ # version in addition makes sure they are overriden (required from
+ # git 2.20.0).
#
git config --global remote.origin.tagopt --tags
+ git config --global remote.origin.fetch '+refs/tags/*:refs/tags/*'
+ git config --global --unset remote.origin.tagopt
- # Starting 2.20 the above doesn't work anymore and should be replaced:
+ # Enable hooks globally.
#
- git config --global remote.origin.fetch "+refs/tags/*:refs/tags/*"
- git config --global --unset remote.origin.tagopt
+ git config --global core.hooksPath <bdep-util-project-dir>/bdep-util/git-hooks
+ # Override the global hooks with the repository-specific hooks (run in a
+ # repository directory).
+ #
+ git config core.hooksPath .git/hooks
+
+Commit Messages
+
+1. Separate subject from body with a blank line
+2. Limit the subject line to 78 characters
+3. Capitalize the subject line
+4. Do not end the subject line with a period
+5. Use the imperative voice in the subject line (e.g., "Implement foo" rather
+ than "Implemented foo")
+6. No articles (a/the) in the subject line
+7. Wrap the body at 78 characters
+8. Unless this is already captured in the commit payload (e.g., in
+ code comments, documentation, etc) use the body to explain what
+ and why
Undo (move to index) last commit
@@ -109,7 +133,9 @@ History Cleanup
that usually the result of the git merge command.
Note: make sure you have rerere enabled for this process to work
- smoothly (~/.gitconfig).
+ smoothly:
+
+ git config --global rerere.enabled true
Note: if you are just learning this procedure, make a local backup
copy of your repository in case things go badly and you need to