Search code examples
gitrebasegitk

How can I hide old commits from "gitk" after rebasing?


In gitk --branches or gitk BRANCH1 BRANCH2 I can refresh the view with F5, but after rebasing or amending commits, the view retains the commits that are no longer being pointed to by any branches.

'gitk master origin/master'   Gitk after                       After restarting Gitk
                                  'git rebase origin/master'
                              and pressing F5 in gitk.

  I (HEAD,master)               I' (HEAD,master)               I' (HEAD,master)
  H                             H'                             H'
  G                             G'                             G'
  F                             F'                             F'
  E                             E'                             E'
  D                             D'                             D'
  | C (origin/master)           C  (origin/master)             C  (origin/master)
  | B                           B                              B
  |/                            | I                            A
  A                             | H                            :
  :                             | G                            :
  :                             | F
                                | E
                                | D
                                |/
                                A
                                :
                                :

Now, I know that I can remove the D..I commits by restarting gitk or by resetting the view from View > Command line by reconfiguring the view through View > Edit. But is there a more convenient way to achieve it?


Solution

  • File -> Reload (Shift-F5)

    This will rebuild the commit list. It's slower than Refresh (F5) but will remove the old commit.