我搜寻过但没有找到这个问题的答案。
我有一个在Heroku上运行的应用程序。 从我的本地机器上通常进行实现并且只需要:
git add .
git commit -m "whatever change, I know I can add and commit at the same time..."
git push <the-heroku-repo>
然后它会上传并更新Heroku应用中的主分支。到目前为止一切都很好。
现在,我想要另一台机器自动从Heroku仓库拉取并更新自己。
所以我这样做:
git clone <the-heroku-repo>
这样可以获取应用程序,并使用以下命令查看git配置:
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@heroku.com:theapp.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
要更新这个新的仓库,我只需要执行pull操作:
git pull origin
或者我可以获取并合并:
git fetch origin
git merge origin/master
我的问题
在上面的获取和合并之间,我可以通过以下方式检查更改:
git log -p master..origin/master
有没有办法在不拉取之前找到本地主分支和远程Heroku repo最新版本之间的差异?只需比较本地和远程,并查看更改。我只是找不到正确的方法。
谢谢。
git log
命令之前执行git fetch origin
存在什么问题感兴趣? - Mark Longairgit fetch origin master
。如果您希望将更改合并/变基并提交到上游,则检索主分支永远不会浪费时间。 - Justin ᚅᚔᚈᚄᚒᚔ