Magit: Do not show "recent commits"

Created on 27 Oct 2017  路  5Comments  路  Source: magit/magit

Would it be possible not to show "recent commits" when they are already pushed upstream? I like the old behavior, it seems more intuitive to have "clean" status buffer when nothing needs to be pushed/committed, etc.

support

Most helpful comment

I don't get it.

As of ebbf00b7 (Always show recent commits in the status buffer,
2017-10-26), magit-insert-unpushed-to-upstream in
magit-status-sections-hook section hook has been replaced by
magit-insert-unpushed-to-upstream-or-recent. This results in recent
commits being displayed if there aren't any unpushed commits. To get
back the old behavior, customize magit-status-sections-hook as
@tarsius [described above].

All 5 comments

Would it be possible not to show "recent commits" when they are already pushed upstream?

That's actually what is happening now. The respective code boils down to (if there-commits-not-pushed-to-upstream insert-those insert-N-recent-commits). But the "Recent commits" section can show up while there are other lists of commits being displayed.

You can change this by customizing magit-status-sections-hook or doing it manually:

(magit-add-section-hook 'magit-status-sections-hook
                        'magit-insert-unpushed-to-upstream
                        'magit-insert-unpushed-to-upstream-or-recent
                        'replace)

By the way until recently one could use magit-insert-unpulled-from-upstream-or-recent but that made much less sense than the new magit-insert-unmerged-into-upstream-or-recent and was opt-in.

But that made less sense so the former is now an alias for just magit-insert-unpulled-from-upstream-or-recent (to avoid breaking existing customization. If you have this in your init file, then you can remove it:

(magit-add-section-hook 'magit-status-sections-hook
                        'magit-insert-unpulled-from-upstream-or-recent
                        'magit-insert-unpulled-from-upstream
                        'replace)

OK, thanks!

I don't get it. I too am seeing "Recent Commits" which have definitely been pushed to upstream.

I don't get it.

As of ebbf00b7 (Always show recent commits in the status buffer,
2017-10-26), magit-insert-unpushed-to-upstream in
magit-status-sections-hook section hook has been replaced by
magit-insert-unpushed-to-upstream-or-recent. This results in recent
commits being displayed if there aren't any unpushed commits. To get
back the old behavior, customize magit-status-sections-hook as
@tarsius [described above].

Was this page helpful?
0 / 5 - 0 ratings