4 ms·
fzf is awesome :) My favorite fzf usage (but not the most often used) is this alias I put in my ~/.gitconfig file frbi = "!f() { git rebase -i $(git log -
by graton 4y ago
fzf is awesome :)
My favorite fzf usage (but not the most often used) is this alias I put in my ~/.gitconfig file
frbi = "!f() { git rebase -i $(git log --pretty=oneline --color=always | fzf --ansi | cut -d ' ' -f1)^ ; }; f"
So I do: git frbi (which to me means Fzf ReBase Interactive)
And then can easily pick what commit I will use as my starting point for doing some rebase work.
- xwowsersx 4y agoGoing to use this, thanks! How do I limit it to N number of commits?
- badhrink 4y agoYou can use the max-count option for the git log command. Something like this: git log --graph --decorate --pretty=oneline --abbrev-commit --color=always --max-count=$cnt
- graton 4y agoNot sure. But I can use it on the Linux kernel without issue, which is 1,107,114 commits at the time I just tested it. So I have never felt a need to limit it. EDIT: Probably could use the "--max-count=<number>" option to `git log` which is documented in the man page.
- xwowsersx 4y agoHmm. I think I'm missing something basic here. git rebase --interactive is for when you want to take commits you've been baking and now want to clean them up, i.e. squashing some, rewording commit messages, etc, right? I'll usually do something like $ git rebase -i HEAD~5 to clean up the last 5. Can I do this with `git frbi`? Or is the point that I don't need to since all commits are "picked" by default so you just "s" and "r" the ones you want to and leave the rest?
- graton 4y ago`git frbi` allows you to pick the value that will be passed to `git rebase -i` I recommend you try it and it should hopefully make sense.
- xwowsersx 4y agoAh, I had. I just totally brain-farted on the fact that `--interactive <sha1>` takes the SHA of the commit just before the one you want to rewrite. Thanks!