config/git: fix sysyadm & add diffa
This commit is contained in:
		
					parent
					
						
							
								b08c4e0c3f
							
						
					
				
			
			
				commit
				
					
						8b36d80d5e
					
				
			
		
					 4 changed files with 17 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -13,11 +13,17 @@ yc() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
alias sysyadm="yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm"
 | 
			
		||||
alias sysinit="sysyadm init -b main -w /; sysyadm gitconfig include.path '$XDG_CONFIG_HOME/git/config'"
 | 
			
		||||
alias sysinit="sysyadm init -b main -w /" #; sysyadm gitconfig include.path '$XDG_CONFIG_HOME/git/config'"
 | 
			
		||||
sy() {
 | 
			
		||||
  unignore="/etc/yadm/unignore"
 | 
			
		||||
  test -r "$unignore" && cat "$unignore" | envsubst | sysyadm add --intent-to-add --pathspec-from-file=-
 | 
			
		||||
  test "$#" -eq 0 && sysyadm s || sysyadm "$@"
 | 
			
		||||
  case "$1" in
 | 
			
		||||
    ("") sysyadm s;;
 | 
			
		||||
    (p) sysyadm p;;
 | 
			
		||||
    (l) sysyadm fetch && sy rebase main --onto origin/main;;
 | 
			
		||||
    (*) sudo -E $(alias sysyadm | cut -d\' -f2) "$@";;
 | 
			
		||||
  esac
 | 
			
		||||
  sudo chown -R $USER /etc/yadm
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gcn() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								.local/bin/scripts/git-diffa
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								.local/bin/scripts/git-diffa
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
# Diff given files against all branches
 | 
			
		||||
git for-each-ref --format='%(refname:short)' | while read branch; do { highlight $branch && git diff --color=always $branch..HEAD "$@"; }; done | less
 | 
			
		||||
| 
						 | 
				
			
			@ -1,9 +1,11 @@
 | 
			
		|||
#!/bin/sh -e
 | 
			
		||||
# set repo as origin and set all branches upstream to a corresponding remote branch, if available
 | 
			
		||||
git remote remove origin 2>/dev/null
 | 
			
		||||
git remote add origin $(git-repo "$@")
 | 
			
		||||
git remote $(case "$(git remote)" in
 | 
			
		||||
  (*origin*) echo set-url;;
 | 
			
		||||
  (*) echo add;;
 | 
			
		||||
esac) origin "$(git-repo "$@")"
 | 
			
		||||
git remote -v && git fetch
 | 
			
		||||
 | 
			
		||||
git branch | sed 's/ //g' | sed 's/*//' | while read branch
 | 
			
		||||
git branch --format='%(refname:short)' | while read branch
 | 
			
		||||
do test $(git branch -a | grep origin/$branch | wc -l) -gt 0 && git branch -u origin/$branch $branch
 | 
			
		||||
done
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
# Commits by myself throughout the current week
 | 
			
		||||
# Depends on git-my alias listing commits by myself
 | 
			
		||||
# depends: git-my alias - listing own commits
 | 
			
		||||
git my --after "$(date -d "Mon ${1:-1} weeks ago")" --before "$(date -d "Mon $(expr ${1:-1} - 1) weeks ago")" "${@:2}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue