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 [2022/11/30 22:26] – [Install] stephen | git_cheat_sheet [2025/12/04 00:38] (current) – [Who needs to clean up] stephen | ||
|---|---|---|---|
| Line 21: | Line 21: | ||
| editor = ' | editor = ' | ||
| pager = cat | pager = cat | ||
| + | longpaths = true | ||
| [user] | [user] | ||
| Line 58: | Line 59: | ||
| 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 65: | Line 68: | ||
| 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 134: | Line 139: | ||
| | ''< | | ''< | ||
| | ''< | | ''< | ||
| + | | ''< | ||
| + | | ''< | ||
| | ''< | | ''< | ||
| | ''< | | ''< | ||
| Line 142: | Line 149: | ||
| | ''< | | ''< | ||
| | ''< | | ''< | ||
| + | | ''< | ||
| + | | ''< | ||
| ===== Workflows ===== | ===== Workflows ===== | ||
| Line 265: | Line 274: | ||
| </ | </ | ||
| + | ===== Who needs to clean up ===== | ||
| + | |||
| + | Lists the author and date of the last commit on each remote branch. | ||
| + | |||
| + | Bash: | ||
| + | <code bash> | ||
| + | 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.1669847199.txt.gz · Last modified: 2022/12/01 23:26 (external edit)
