git_cheat_sheet
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git_cheat_sheet [2024/04/18 00:00] – [Import from SVN] stephen | git_cheat_sheet [2026/08/07 05:01] (current) – stephen | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| <code text> | <code text> | ||
| - | [core] | ||
| - | editor = ' | ||
| - | pager = cat | ||
| - | longpaths = true | ||
| - | |||
| [user] | [user] | ||
| name = Stephen Heise | name = Stephen Heise | ||
| Line 29: | Line 24: | ||
| [init] | [init] | ||
| defaultBranch = main | defaultBranch = main | ||
| - | |||
| - | [mergetool] | ||
| - | prompt = false | ||
| - | keepBackup = false | ||
| - | keepTemporaries = false | ||
| - | |||
| - | [merge] | ||
| - | tool = winmerge | ||
| - | |||
| - | [mergetool " | ||
| - | name = WinMerge | ||
| - | trustExitCode = true | ||
| - | cmd = "/ | ||
| - | |||
| - | [diff] | ||
| - | tool = winmerge | ||
| - | |||
| - | [difftool " | ||
| - | name = WinMerge | ||
| - | trustExitCode = true | ||
| - | cmd = "/ | ||
| [push] | [push] | ||
| Line 55: | Line 29: | ||
| autoSetupRemote = true | autoSetupRemote = true | ||
| + | [remote " | ||
| + | prune = true | ||
| + | |||
| [alias] | [alias] | ||
| st = status | st = status | ||
| ci = commit -m | ci = commit -m | ||
| ca = commit --amend --no-edit | ca = commit --amend --no-edit | ||
| + | cu = reset HEAD~ | ||
| + | cuh = reset --hard HEAD~ | ||
| br = branch | br = branch | ||
| ba = branch -a | ba = branch -a | ||
| Line 66: | Line 45: | ||
| fa = fetch -a | fa = fetch -a | ||
| tf = !git reset && git checkout -- . && git clean -df | tf = !git reset && git checkout -- . && git clean -df | ||
| + | as = !git add . && git stash | ||
| + | pr = !git stash pop && git reset | ||
| brdr = push --delete origin | brdr = push --delete origin | ||
| fp = push --force | fp = push --force | ||
| Line 73: | Line 54: | ||
| ro2mfp = !git ro2m && echo 'Force pushing' | ro2mfp = !git ro2m && echo 'Force pushing' | ||
| - | [winUpdater] | + | # Linux only |
| - | recentlySeenVersion | + | [credential] |
| + | helper = / | ||
| + | credentialStore | ||
| - | [remote | + | [credential |
| - | prune = true | + | useHttpPath |
| + | |||
| + | # Windows only | ||
| + | [core] | ||
| + | editor = ' | ||
| + | pager = cat | ||
| + | longpaths = true | ||
| + | |||
| + | [mergetool] | ||
| + | prompt = false | ||
| + | keepBackup = false | ||
| + | keepTemporaries = false | ||
| + | |||
| + | [merge] | ||
| + | tool = winmerge | ||
| + | |||
| + | [mergetool " | ||
| + | name = WinMerge | ||
| + | trustExitCode = true | ||
| + | cmd = "/ | ||
| + | |||
| + | [diff] | ||
| + | tool = winmerge | ||
| + | |||
| + | [difftool " | ||
| + | name = WinMerge | ||
| + | trustExitCode = true | ||
| + | cmd = "/ | ||
| </ | </ | ||
| Line 98: | Line 108: | ||
| ''< | ''< | ||
| + | |||
| + | ===== Install on Linux ===== | ||
| + | |||
| + | - Install Git Credential Manager | ||
| + | - ''< | ||
| + | - ''< | ||
| + | - Or download from [[https:// | ||
| + | - Configure Git to use Git Credential Manager | ||
| + | - ''< | ||
| + | - Select the credential store backend | ||
| + | - ''< | ||
| + | - Verify GNOME Keyring (Secret Service) is running | ||
| + | - Run: ''< | ||
| + | - If missing, start it with: ''< | ||
| + | |||
| ===== Try Git ===== | ===== Try Git ===== | ||
| Line 138: | Line 163: | ||
| | ''< | | ''< | ||
| | ''< | | ''< | ||
| - | | ''< | ||
| | ''< | | ''< | ||
| | ''< | | ''< | ||
| Line 145: | Line 169: | ||
| | ''< | | ''< | ||
| | ''< | | ''< | ||
| + | | ''< | ||
| | ''< | | ''< | ||
| + | | Stashing | ||
| + | | ''< | ||
| + | | ''< | ||
| + | | ''< | ||
| + | | ''< | ||
| + | | ''< | ||
| + | |||
| + | |||
| + | |||
| ===== Workflows ===== | ===== Workflows ===== | ||
| Line 271: | Line 305: | ||
| ===== Who needs to clean up ===== | ===== Who needs to clean up ===== | ||
| - | Lists the author and date of the last commit on each remote branch. Need to run it on bash. | + | Lists the author and date of the last commit on each remote branch. |
| - | < | + | Bash: |
| + | < | ||
| for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format=" | for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format=" | ||
| </ | </ | ||
| + | Powershell: | ||
| + | <code powershell> | ||
| + | git branch -r | Where-Object { $_ -notmatch ' | ||
| + | $branch = $_.Trim() | ||
| + | $info = git show --format=" | ||
| + | [PSCustomObject]@{ | ||
| + | Info = $info | ||
| + | Branch = $branch | ||
| + | } | ||
| + | } | Sort-Object Info -Descending | Format-Table -AutoSize | ||
| + | </ | ||
| ===== How PRs work ===== | ===== How PRs work ===== | ||
git_cheat_sheet.1713398414.txt.gz · Last modified: 2024/04/18 12:00 (external edit)
