git 在远程存储库上提交历史记录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13941976/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Commit history on remote repository
提问by user1795998
回答by LopSae
git log remotename/branchname
Will display the log of a given remote branch in that repository, but only the logs that you have "fetched" from their repository to your personal "copy" of the remote repository.
将显示该存储库中给定远程分支的日志,但仅显示您从其存储库“提取”到远程存储库的个人“副本”的日志。
Remember that your clone of the repository will update its state of any remote branches only by doing git fetch
. You can't connect directly to the server to check the log there, what you do is download the state of the server with git fetch
and then locally see the log of the remote branches.
请记住,您的存储库克隆只会通过执行git fetch
. 不能直接连接服务器查看那里的日志,你要做的是下载服务器的状态,git fetch
然后在本地查看远程分支的日志。
Perhaps another useful command could be:
也许另一个有用的命令可能是:
git log HEAD..remote/branch
which will show you the commits that are in the remote branch, but not in your current branch (HEAD
).
这将显示远程分支中的提交,但不在当前分支 ( HEAD
) 中。
回答by Michael Hasan
NB. "origin" below use to represent the upstream of a cloned repository, replace "origin" with a descriptive name for the remote repo. "remote reference" can use the same format used in clone command.
注意。下面的“origin”用于表示克隆存储库的上游,将“origin”替换为远程存储库的描述性名称。“远程引用”可以使用与克隆命令相同的格式。
git remote add origin <remote reference>
git fetch
git log origin/master
回答by ocodo
You can only view the log on a local repository, however that can include the fetched branches of all remotes you have set-up.
您只能查看本地存储库上的日志,但是它可以包括您设置的所有远程设备的提取分支。
So, if you clone a repo...
所以,如果你克隆一个回购...
git clone git@gitserver:folder/repo.git
This will default to origin/master
.
这将默认为origin/master
.
You can add a remote to this repo, other than origin
let's add production
. From within the local clone folder:
除了origin
让我们添加production
. 从本地克隆文件夹中:
git remote add production git@production-server:folder/repo.git
If we ever want to see the log of production
we will need to do:
如果我们想查看日志,production
我们需要这样做:
git fetch --all
This fetches from ALL remotes (default fetch without --all
would fetch just from origin
)
这从所有遥控器中获取(默认获取而--all
不会只从 获取origin
)
After fetching we can look at the log on the production
remote, you'll have to specify the branch too.
获取后,我们可以查看production
遥控器上的日志,您还必须指定分支。
git log production/master
All options will work as they do with log on local branches.
所有选项都将像在本地分支上登录一样工作。
回答by davvs
A fast way of doing this is to clone using the --bare
keyword and then check the log:
一个快速的方法是使用--bare
关键字克隆,然后检查日志:
git clone --bare git@giturl tmpdir
cd tmpdir
git log branch
回答by user959690
I don't believe this is possible. I believe you have to clone that remote repo locally and perform git fetch
on it before you can issue a git log
against it.
我不相信这是可能的。我相信您必须在本地克隆该远程存储库并对其执行git fetch
操作,然后才能对其发出git log
警告。
回答by Fellow Stranger
This is what worked for me:
这对我有用:
git fetch --all
git log production/master
Note that this fetches from ALL remotes, i.e. potentially you "have to clone 2GB worth of objects just to look through the commit logs".
请注意,这是从所有遥控器获取的,即您可能“必须克隆价值 2GB 的对象才能查看提交日志”。
回答by steamer25
I'm not sure when filtering was added but it's a way to exclude the object blobs if you only want to fetch the history/ref-logs:
我不确定何时添加了过滤,但如果您只想获取历史记录/引用日志,这是一种排除对象 blob 的方法:
git clone --filter=blob:none --no-checkout --single-branch --branch master git://some.repo.git .
git log
回答by Naligator
You can easily get the log of the remote server. Here's how:
您可以轻松获取远程服务器的日志。就是这样:
(1) If using git via ssh - then just login to the remote server using your git login and password-- and chdir the remote folder where your repository exists- and run the "git log" command inside your repository on the remote server.
(1) 如果通过 ssh 使用 git - 那么只需使用您的 git 登录名和密码登录到远程服务器 - 并 chdir 存储库所在的远程文件夹 - 并在远程服务器上的存储库中运行“git log”命令。
(2) If using git via Unix's standard login protocol- then just telnet to your remote server and do a git log there.
(2) 如果通过 Unix 的标准登录协议使用 git - 那么只需 telnet 到您的远程服务器并在那里执行 git log。
Hope this helps.
希望这可以帮助。