Page 1 of 1

Your gitconfig/gitalias

Posted: Sun Oct 23, 2016 5:23 am
by franksinistra
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.

Re: Your gitconfig/gitalias

Posted: Sun Oct 23, 2016 1:05 pm
by dkeg
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]}
}

Re: Your gitconfig/gitalias

Posted: Sun Oct 23, 2016 1:56 pm
by franksinistra
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. :)

Re: Your gitconfig/gitalias

Posted: Sun Oct 23, 2016 3:21 pm
by GekkoP
[trolling with rhyme]
I use Magit and that's about it.
[/trolling with rhyme]

Re: Your gitconfig/gitalias

Posted: Sun Oct 23, 2016 5:58 pm
by franksinistra
^ 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.

Re: Your gitconfig/gitalias

Posted: Sun Oct 23, 2016 6:35 pm
by GekkoP
^ Weird. Rebasing is the one thing that I am really I can use Magit for.

Re: Your gitconfig/gitalias

Posted: Mon Oct 24, 2016 12:12 pm
by franksinistra
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.

Re: Your gitconfig/gitalias

Posted: Mon Oct 24, 2016 2:24 pm
by ChefIronBelly
a couple.
alias g='git'
alias gc='git commit -m "adds and tweaks"'