User Tools

Site Tools


git_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
git_cheat_sheet [2025/11/23 21:38] – [Install] stephengit_cheat_sheet [2025/12/04 00:38] (current) – [Who needs to clean up] stephen
Line 276: Line 276:
 ===== 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.
  
-<code>+Bash: 
 +<code bash>
 for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r
 </code> </code>
  
 +Powershell:
 +<code powershell>
 +git branch -r | Where-Object { $_ -notmatch 'HEAD' } | ForEach-Object {
 +    $branch = $_.Trim()
 +    $info = git show --format="%ai %ar by %an" $branch | Select-Object -First 1
 +    [PSCustomObject]@{
 +        Info = $info
 +        Branch = $branch
 +    }
 +} | Sort-Object Info -Descending | Format-Table -AutoSize
 +</code>
 ===== How PRs work ===== ===== How PRs work =====
  
git_cheat_sheet.txt · Last modified: 2025/12/04 00:38 by stephen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki