How can I see what I am about to push with git?

前端 未结 14 2029
北恋
北恋 2020-11-27 09:06

Is there a way to see what would be pushed if I did a git push command?

What I\'m picturing is something like the \"Files Changed\" tab of Github\'s \"p

14条回答
  •  遥遥无期
    2020-11-27 09:22

    There is always dry-run:

    git push --dry-run
    

    It will do everything except for the actually sending of the data.

    If you want a more graphical view you have a bunch of options.

    Tig and the gitk script that come with git both display the current branch of your local copy and the branch of the remote or origin.

    alt text

    So any commits you make that are after the origin are the commits that will be pushed.

    Open gitk from shell while in the branch you want to push by typing gitk&, then to see the difference between what is on the remote and what you are about to push to the remote, select your local unpushed commit and right-click on the remote and choose "Diff this -> selected": alt text

提交回复
热议问题