Add a git alias to see size of tracked files
This commit is contained in:
		
							parent
							
								
									fb295f681d
								
							
						
					
					
						commit
						a8d9e18c36
					
				
							
								
								
									
										18
									
								
								.aliases
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								.aliases
									
									
									
									
									
								
							| 
						 | 
					@ -1276,6 +1276,19 @@ git_create_stash_patch() {
 | 
				
			||||||
    printf "${BOLD}${YELLOW}Created $file for stash@{$stashNum}.${NORMAL}\n"
 | 
					    printf "${BOLD}${YELLOW}Created $file for stash@{$stashNum}.${NORMAL}\n"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					git_print_tracked_file_sizes() {
 | 
				
			||||||
 | 
					    git ls-tree -r -l HEAD | sort -k 4 -nr | awk '{
 | 
				
			||||||
 | 
					        sha = substr($3, 1, 7);  # Truncate the commit SHA to 7 characters
 | 
				
			||||||
 | 
					        if ($4 >= 1024 * 1024) {
 | 
				
			||||||
 | 
					            printf "%s  sha:%s  %06.2f MB   %s\n", $2, sha, $4 / 1024 / 1024, $5
 | 
				
			||||||
 | 
					        } else if ($4 >= 1024) {
 | 
				
			||||||
 | 
					            printf "%s  sha:%s  %06.2f KB   %s\n", $2, sha, $4 / 1024, $5
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            printf "%s  sha:%s  %04d B      %s\n", $2, sha, $4, $5
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }'
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias am='git commit --amend'
 | 
					alias am='git commit --amend'
 | 
				
			||||||
alias amno='git_amend_nocheckin'
 | 
					alias amno='git_amend_nocheckin'
 | 
				
			||||||
alias ama='git commit --amend -C head --author'
 | 
					alias ama='git commit --amend -C head --author'
 | 
				
			||||||
| 
						 | 
					@ -1338,8 +1351,8 @@ alias gmffm='git merge --ff-only master'
 | 
				
			||||||
alias gmffs='git merge --ff-only --squash'
 | 
					alias gmffs='git merge --ff-only --squash'
 | 
				
			||||||
alias gmtheirs='git merge -Xtheirs'
 | 
					alias gmtheirs='git merge -Xtheirs'
 | 
				
			||||||
alias gp='git push'
 | 
					alias gp='git push'
 | 
				
			||||||
alias gpa='git push --all && echo "pushing tags..." && git push --tags'
 | 
					alias gpa='echo "pushing all branches..." && git push --all && echo "pushing tags..." && git push --tags'
 | 
				
			||||||
alias gpaf='git push --all -f && echo "pushing tags..." && git push --tags -f'
 | 
					alias gpaf='echo "force pushing all branches..." && git push --all -f && echo "force pushing tags..." && git push --tags -f'
 | 
				
			||||||
alias gpf='git push -f'
 | 
					alias gpf='git push -f'
 | 
				
			||||||
alias gpff='git pull --ff-only'
 | 
					alias gpff='git pull --ff-only'
 | 
				
			||||||
alias gplu='git pull --set-upstream origin HEAD'
 | 
					alias gplu='git pull --set-upstream origin HEAD'
 | 
				
			||||||
| 
						 | 
					@ -1402,6 +1415,7 @@ alias gx='git reset --hard'
 | 
				
			||||||
alias gxx='git reset --hard HEAD~1'
 | 
					alias gxx='git reset --hard HEAD~1'
 | 
				
			||||||
alias gxom='git reset --hard origin/master'
 | 
					alias gxom='git reset --hard origin/master'
 | 
				
			||||||
alias gstats='echo "Total commits: $(git rev-list HEAD --count)"; echo "\nAuthor breakdown:"; git shortlog | grep -E "^[^ ]"'
 | 
					alias gstats='echo "Total commits: $(git rev-list HEAD --count)"; echo "\nAuthor breakdown:"; git shortlog | grep -E "^[^ ]"'
 | 
				
			||||||
 | 
					alias gsize='git_print_tracked_file_sizes'
 | 
				
			||||||
alias gwip="git add . && git commit -m \"WIP\""
 | 
					alias gwip="git add . && git commit -m \"WIP\""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
####################################################################################################
 | 
					####################################################################################################
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user