When I do a git rebase -i
on a branch shared with a co-worker, I often want to just rebase my own commits. However, because the interactive rebase tool doesn't add the author information to the rebasing file (all t gives is the commit hash and description), I wind up having to go check commits in another tab to see if they are mine or not.
Is there any way to give git rebase -i
a --format
flag (or something like it), to make it include the author?
2 Answers. Show activity on this post. git log --author=<pattern> will show the commit log filtered for a particular author. ( --committer can be used for committer if the distinction is necessary).
You can use interactive rebase. The answer from this post gives you an example: How to change the commit author for one specific commit?. The author asks for changing author at a specific commit, but interactive rebasing can be used to change authors of multiple commits if you edit all commits that you wish to change.
Interactive rebase in Git is a tool that provides more manual control of your history revision process. When using interactive rebase, you will specify a point on your branch's history, and then you will be presented with a list of commits up until that point.
On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.
As of git 2.6, git rebase -i
uses rebase.instructionFormat
(default %s
) to generate the text after pick NNNNN...
.
Since this is a git-config
item, you can set the value per repository, for yourself in general, or even using the -c
option on a one-time basis.
EDIT:
As jdknight suggested in the comments, the specific command for this would be:
git config --add rebase.instructionFormat "(%an <%ae>) %s"
or, to avoid item repetition, as oalders suggested, you can instead set the config globally:
git config --global rebase.instructionFormat "(%an <%ae>) %s"
git -c "rebase.instructionFormat=(%an <%ae>) %s" rebase -i COMMIT_HASH
Interactive output is going to look as follows:
pick b596a7b (Nik Sumeiko <[email protected]>) Refactors type checking utilities pick c8b815f (Attila Kerekes <[email protected]>) Implements commit message linting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With