Skip to content

Latest commit

 

History

History
292 lines (163 loc) · 7.55 KB

Tips.Git.md

File metadata and controls

292 lines (163 loc) · 7.55 KB

Tips.Git.md

Useful Tools

References

Useful References

Git Communities

Tips Lists by Others

Git Tutorial Resources

Git Statistics, Visualization

Commit Message Standards

Commit Message Format

  • <type>(<scope>): <subject>
  • <body>
  • <footer>

Example values:

Type Definition
feat (new feature for the user, not a new feature for build script)
fix (bug fix for the user, not a fix to a build script)
docs (changes to the documentation)
style (formatting, missing semi colons, etc; no production code change)
refactor (refactoring production code, eg. renaming a variable)
test (adding missing tests, refactoring tests; no production code change)
chore (updating grunt tasks etc; no production code change)

Example Subject Line Standard Terminology

First Word Meaning
Add Create a capability e.g. feature, test, dependency.
Cut Remove a capability e.g. feature, test, dependency.
Fix Fix an issue e.g. bug, typo, accident, misstatement.
Bump Increase the version of something e.g. dependency.
Make Change the build process, or tooling, or infra.
Start Begin doing something; e.g. create a feature flag.
Stop End doing something; e.g. remove a feature flag.
Refactor A code change that MUST be just a refactoring.
Reformat Refactor of formatting, e.g. omit whitespace.
Optimize Refactor of performance, e.g. speed up code.
Document Refactor of documentation, e.g. help files.

Git News

Downloads

Git Code Review Tools

Useful Git Articles

Useful Supplemental Tools

Interesting Github Projects

Git Command Examples

  • Configure Git on Windows for long path

    • git config core.longpaths true
  • Determine size of a git repository:

    • $ git count-objects -vH
    • Example output: *count: 1594
      • size: 1.05 MiB
      • in-pack: 0
      • packs: 0
      • size-pack: 0 bytes
      • prune-packable: 0
      • garbage: 0
      • size-garbage: 0 bytes
  • Determine URL that a local Git repository was originally cloned from

    • git config --get remote.origin.url
    • git remote show origin
    • git remote -v
    • git ls-remote --get-url
  • Tell Git to remember your credentials (on Windows)

  • When a checkout fails...

    • You can inspect what was checked out with git status...and retry the checkout with
      • git checkout -f HEAD
  • To fetch a file from another branch to the current one:

    • git checkout branch_name -- filename
  • To unstage a git add <file>

    • git reset <file>
  • To Amend a Commit Message

    • Git commit --amend
  • TO backdate commits

    • git commit --date <date>
  • To Check out the origin/master branch and then reset master branch there

    • git checkout -B master origin/master
  • “top ten list” of most commited files

    • git log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -10
  • Graphically show commits across different branches

    • git log --graph --oneline --decorate --date=relative --all