How to find last merge in git?

后端 未结 7 1417
野的像风
野的像风 2020-12-29 04:31

For a web site, I have master and staging, I have worked on staging for about 10 days. How do I tell for sure what has changed since my last merge, or when that merge was? M

相关标签:
7条回答
  • 2020-12-29 05:05

    Looks like this is my best bet:

    I edited ~/.gitconfig, adding:

    [branch "master"]
        mergeoptions = --no-ff
    

    Then if I'm on master and I merge in a branch, it shows it as a full merge. Having that as a config option for just "master" shows how awesome git is, so I can still FF merges within branches, where I'm likely to have a lot of short-lived topic branches, and I don't have to remember to specify --no-ff when merging on master. Beautiful.

    I use this alias for viewing logs:

    k = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr, %cd) %C(bold blue)<%an>%Creset' --abbrev-commit

    > git k (similar to the gui gitk, but stays in the terminal)
    

    When I view logs that way, it paints a nice picture of the branching. If I want to find the last one, I can do

    > git show :/"Merge branch 'staging'"
    

    Thanks for the help.

    EDIT: As @jefromi noted in the comments to the first answer, this is probably a better technique git log --merges -n 1

    0 讨论(0)
提交回复
热议问题