diff options
| author | Hunter Kvalevog <hunter@kvog.sh> | 2026-09-27 11:35:53 -0500 |
|---|---|---|
| committer | Hunter Kvalevog <hunter@kvog.sh> | 2026-09-27 11:35:53 -0500 |
| commit | f02a764d528a14dd67c854ce3df89cc90e492242 (patch) | |
| tree | d9a688e2fbc3a44254627261f084b54c7e979c4e | |
| parent | e34e7ea9853b96bc326b05cf3bad5ae7d0362d2d (diff) | |
| -rw-r--r-- | content/notes/git.md | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/content/notes/git.md b/content/notes/git.md new file mode 100644 index 0000000..baed2b7 --- /dev/null +++ b/content/notes/git.md @@ -0,0 +1,51 @@ ++++ +title = 'git usage notes' ++++ + +## Documentation + +* Official reference: https://git-scm.com/docs + +## Commands I often forget + +### Committing + +Rebase the last 3 commits: +``` +git rebase -i HEAD~3 +``` + +Rebase all commits: +``` +git rebase -i --root +``` + +### Working with remotes + +Hard reset from remote: +``` +git fetch +git reset --hard origin/master +``` + +### Searching commits + +Search for commits containing text: +``` +git log --grep="abc" +``` + +Case-insensitive version: +``` +git log -i --grep="abc" +``` + +Search by author +``` +git log --author="guy" +``` + +List contributors by commit count: +``` +git shortlog --summary --numbered --all --no-merges +``` |