Search code examples
gitgit-commitgit-push

How to know what differences that "git push" is going to push?


After I have git add, and git commit, my workspace, index cached, and local repository became the same. So how can I know when I "push", what differences are there in this patch set?


Solution

  • In conjunction with git-diff

    git diff origin/master [ <local-branch-name> ]
    

    you might be looking for

    git push --dry-run --verbose
    

    This will simulate a push and print all information you need on the way. From the git man page:

    git-push:
    -v
    --verbose
    
        Run verbosely.
    
    -n
    --dry-run
    
        Do everything except actually send the updates.