How can I “git log” only code published to trunk?

At my workplace we have a “master” trunk branch that represents published code. To make a change, I check out a working copy, create a topic branch, commit to the topic branch, merge the topic branch into master, and push.

For small changes, I might commit directly to master, then push.

  • git branch roll back to previous commits
  • Find branching point from post-receive hook
  • How to log every branch last commit time?
  • Does the folder I am in have any significance in git?
  • Where am I? * (no branch)
  • Deleting a local Git Branch that was never pushed - delete it on the server, too?
  • My problem is that when I use “git log”, I don’t care about my topic branches in my local working copy. I only want to see the changes to the master branch on the remote, shared git server. What’s more, if I use –stat or -p or one of their friends, I want to see the files and changes associated with the merge commit to master, not associated to their original branch commits (which, like I said, I don’t want to see at all).

    How do I go about doing this?

  • Squash all my commits into one for GitHub pull request
  • Why are evil merges considered harmful?
  • How to push my update changes to the repository
  • Github “Pull request” close issue does not work
  • git-p4 and pulling from other repos
  • Keeping multiple .gitignore files (local and remote) in the same repository
  • 3 Solutions collect form web for “How can I “git log” only code published to trunk?”

    This should do the trick:

    git log origin/master
    

    You may want to do a git fetch first to pull down any new commits from the remote end (this won’t merge them into your local branches).

    It sounds like you actually want diff, and not log, since it sounds like you want one big listing of –stat, or -p, instead of having it broken down by the commit it originally happened in.

    git diff [--stat] origin/master...master
    

    This will show you the diff of what your master branch has (after merging in your topic branch) compared to the merge base between origin/master, and master. The important thing here is to use “…” instead of “..”.

    If you wanted to see all of this before merging your topic into master, you could replace the last “master” in the example above with the name of your topic branch, or leave it off entirely, if you currently have your topic branch checked out.

    git diff [--stat] origin/master...
    

    You can run git log --graph --oneline which makes clear which commits are on the current branch (although it doesn’t exclude those that aren’t from the list).

    If you are using git-svn, git log --grep git-svn-id will only show commits with git-svn-id in the log message (which is added by git when a commit is pushed to svn).

    Git Baby is a git and github fan, let's start git clone.