Your gitconfig/gitalias

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Your gitconfig/gitalias

Unread post by franksinistra » Sun Oct 23, 2016 5:23 am

mine looks like this:

Code: Select all

[alias]
    s = status --short
    # pretty log
	lp = log --max-count=50 --pretty=format:"%h%x09%d%x20%s"
	up='git fetch && git rebase --autostach FETCH_HEAD'
	lns = ls-files --other --directory --exclude-standard --cached
	cur = rev-parse --abbrev-ref HEAD
	rec = !git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ | head -n 10
	poc = !git push origin $(git cur)
	rmt = !git remote -v | grep '@.*fetch' | sed 's/.*:\\(.*\\).git.*/\\1/g'
	pr = !firefox https://github.com/$(git rmt)/compare/$(git cur)?expand=1

	# FZF / FZY stuff
	# prefixed with f-
	# fuzzy checkout
	  fco = !git checkout $(git rec | fzy)
	# fuzzy show log
	  fsl = !_hash=$(git lp | fzy) && git show ${_hash%% *}
	# fuzzy commit sha copy 
	  fcl = !_hash=$(git lp | fzy) && echo ${_hash%% *} | xclip
	# fuzzy interactive rebase
	  frb = !_hash=$(git lp | fzy) && git rebase -i ${_hash%% *}
	# edit un-committed file(s)
	  feu = !_files=$(git s | cut -d ' ' -f2- | fzf-tmux -m) && $EDITOR ${_files}
	# edit already pushed file(s)
	  fec = !_hash=$(git lp | fzf-tmux -m) && _files=$(git show --pretty='format:' --name-only ${_hash%% *} | fzf-tmux -m) && $EDITOR ${_files}
	# fuzzy git-reset to ${SHA_COMMIT}
	  frs = !_hash=$(git lp | fzf-tmux) && git reset --soft ${_hash%% *}
EDIT: alignment
As of lately, i prefer fzy https://github.com/jhawthorn/fzy over fzf due to its binary size (and compiling fzf on ARM device is a pain in the butt).

I think this is messy as fuck, and probably a lot better if i write it in a bash-script.... but i'm too lazy for that.

Now show me yours.
rice no more.

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Your gitconfig/gitalias

Unread post by dkeg » Sun Oct 23, 2016 1:05 pm

I don't have anything. The only piece I have is in .bashrc for simpler pushes

Code: Select all

# usage: gitpush [ . |"files"] ["commit message"] [branchname]
function gitpush() {
    args=("$@")
        git add ${args[0]} && git commit -m "${args[1]}" && git push -u origin ${args[2]}
}

Work hard; Complain less

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Your gitconfig/gitalias

Unread post by franksinistra » Sun Oct 23, 2016 1:56 pm

yup i agree, for the most part those are the only ones I use (at home, on the desktop / pi for dotfiles/toy projects). At work I need something a bit more.... versatile. :)
rice no more.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Your gitconfig/gitalias

Unread post by GekkoP » Sun Oct 23, 2016 3:21 pm

[trolling with rhyme]
I use Magit and that's about it.
[/trolling with rhyme]

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Your gitconfig/gitalias

Unread post by franksinistra » Sun Oct 23, 2016 5:58 pm

^ Also true, but i've been having a lot of issues regarding magit. Mostly when doing rebase / browse commit file(s) and random errors when squashing commits.

Not even sure why, could be my own fault at that. So i use this in the meantime.
rice no more.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Your gitconfig/gitalias

Unread post by GekkoP » Sun Oct 23, 2016 6:35 pm

^ Weird. Rebasing is the one thing that I am really I can use Magit for.

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Your gitconfig/gitalias

Unread post by franksinistra » Mon Oct 24, 2016 12:12 pm

Found the culprit, it appears magit-ediff and fira code workaround for emacs don't play well with each other, causing random crashes and cpu spikes. :(

Alright, I'll keep the gitalias for backup.
rice no more.

User avatar
ChefIronBelly
Approved BBQer
Posts: 1044
Joined: Mon Jan 13, 2014 6:01 am
Location: Michigan

Re: Your gitconfig/gitalias

Unread post by ChefIronBelly » Mon Oct 24, 2016 2:24 pm

a couple.
alias g='git'
alias gc='git commit -m "adds and tweaks"'
(1/1) Installing: LinuxBBQ...................................[69%]==============[/]

Post Reply