克隆和原始远程存储库之间的 git diff
我已经克隆了一个 github 存储库,并且在本地没有进行任何更改。 Github 存储库随着同一分支上的提交而向前推进。
- 如何找到本地存储库和原始 github 存储库之间的差异?
- 如何找到我的工作副本和原始 github 存储库之间的差异?
- 如何找到我的本地存储库和同一项目的另一个 github 存储库之间的差异?
I have cloned a github repository and made no changes locally. Github repository moved forward with commits on the same branch.
- How do I find a diff between my local repository and the original github repository?
- How do I find a diff between my working copy and the original github repository?
- How do I find a diff between my local repository and another github repository of the same project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
1) 添加您想要比较的任何远程存储库:
2) 更新远程存储库的本地副本:
Fetch 不会更改您的工作副本。
3) 将本地存储库中的任何分支与您添加的任何远程分支进行比较:
1) Add any remote repositories you want to compare:
2) Update your local copy of a remote:
Fetch won't change your working copy.
3) Compare any branch from your local repository to any remote you've added:
对您问题的另一个答复(假设您在 master 上并且已经执行了“git fetch origin”以使您存储库了解远程更改):
1)自创建本地分支以来在远程分支上提交:
2)我假设通过“工作副本” “你的意思是你的本地分支有一些尚未在远程的本地提交。要查看本地分支上有但远程分支上不存在的差异,请运行:
3) 请参阅 由 dbyrne 回答。
Another reply to your questions (assuming you are on master and already did "git fetch origin" to make you repo aware about remote changes):
1) Commits on remote branch since when local branch was created:
2) I assume by "working copy" you mean your local branch with some local commits that are not yet on remote. To see the differences of what you have on your local branch but that does not exist on remote branch run:
3) See the answer by dbyrne.
这个例子可能对某人有帮助:
注意“
origin
”是我的远程“What is on Github”的别名注意“
mybranch
”是我正在与 github 同步的分支“what is local”的别名--如果您没有创建分支,则您的分支名称是“master”。但是,我使用不同的名称
mybranch
来显示使用分支名称参数的位置。我在 github 上的远程仓库到底是什么?
添加“相同代码的其他 github 存储库” - 我们称之为分叉:
确保我们的本地存储库是最新的:
在本地更改一些内容。假设文件 ./foo/bar.py
查看我未提交的更改
在本地提交。
现在,我与我的远程(在 github 上)不同,
将其与远程 - 你的 fork 进行比较:
(这通常使用 git diff master origin 来完成)
(git push 将它们应用到远程)
我的远程分支与远程主分支有何不同?
我的本地内容与远程主分支有何不同?
我的东西与其他人的同一仓库的分支、主分支有何不同?
This example might help someone:
Note "
origin
" is my alias for remote "What is on Github"Note "
mybranch
" is my alias for my branch "what is local" that I'm syncing with github--your branch name is 'master' if you didn't create one. However, I'm using the different name
mybranch
to show where the branch name parameter is used.What exactly are my remote repos on github?
Add the "other github repository of the same code" - we call this a fork:
make sure our local repo is up to date:
Change some stuff locally. let's say file ./foo/bar.py
Review my uncommitted changes
Commit locally.
Now, I'm different than my remote (on github)
Diff this with remote - your fork:
(this is frequently done with
git diff master origin
)(git push to apply these to remote)
How does my remote branch differ from the remote master branch?
How does my local stuff differ from the remote master branch?
How does my stuff differ from someone else's fork, master branch of the same repo?