View differences of branches with meld?

后端 未结 8 719
终归单人心
终归单人心 2020-11-30 16:30

I know that I can view the difference between HEAD and current state with meld .. But how can I view the differences between branches, for example master<

8条回答
  •  旧巷少年郎
    2020-11-30 17:03

    It is important to say that using git difftool -d you can still edit your working files in Meld and save them. In order to achieve that you need to compare some branch to your current working tree, for example:

    git difftool -d branchname
    

    Meld will be showing that both left and right directories are located in /tmp. However, files in the right directory are actually symbolic links to your files in the current working directory (does not apply to Windows). So you can edit them right in Meld and when you save them your changes will be saved in your working dir.

    Yet more interesting option is comparison of current working dir with stash. You can do that by simply typing:

    git difftool -d stash
    

    Then you can transfer some changes from stash (left window) to your current working copy (right window), without using git stash pop/apply and avoiding bothersome conflict resolution which may be induced by this commands.

    I think that it can significantly boost up workflow with stashes. You can gradually transfer changes from stash to working copy and commit them one by one, introducing some another changes if you want.

提交回复
热议问题