I have some shell script where I want to check one of my git repos. I want to know if that repos has everything committed and if it is pushed to master. Before this test I make git fetch to make sure I have the latest changes.
我已经找到了办法,以核实重新邮袋是否有一些未商定的变化:
if ! git --work-tree=$HOME/git/project --git-dir=$HOME/git/project/.git diff-index --quiet HEAD --; then
echo "Has some changes";
fi
But this is not the only thing I need. I also want to make sure that all my local commits are pushed to master.
这样做的最容易的方法是什么?