如何查看/编辑 git 远程分支

发布于 2024-09-13 23:20:04 字数 240 浏览 5 评论 0原文

嗨,我对 git 完全陌生,但我有使用 SVN 的经验。所有教程都假设人们知道如何在使用 git 时查看/编辑文件,但我很困惑。我克隆了一个存储库(来自需要与我共享代码的人),然后将几个远程分支签出到本地分支。现在我想查看代码(它是Java)。我在文件系统上的任何位置都找不到这些文件。从命令行,它只提供不同提交的差异。我对此不感兴趣!我只想查看最新版本的代码,最好是在 Eclipse 中。但此时我很乐意在 gedit 中打开它。帮助!

非常感谢!

Hi I'm completely new to git, but I have experience with SVN. All the tutorials assume that one knows how to view/edit a file when using git, but I'm confused. I cloned a repository (from someone who needed to share code with me), then checked out several remote branches to local branches. Now I want view the code (it's Java). I can't find the files anywhere on my file system. From the command line, it only gives me the diffs for different commits. I'm not interested in that! I just want to see the latest edition of the code, preferably in Eclipse. But at this point I would be happy to open it in gedit. Help!

Thank you very much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

单挑你×的.吻 2024-09-20 23:20:04

如果在文件系统中找不到任何文件,则可能是使用 --bare 选项克隆了存储库。您可以再次克隆存储库,但不需要 --bare

git clone <repository>

If you cannot find any files in file system, it is possible that the repository is cloned with --bare option. You can clone the repository again, but without --bare.

git clone <repository>
面犯桃花 2024-09-20 23:20:04

首先,这里有一些有用的通用资源。这是一个很好的、简短的 git 教程。

http://www.eecs.harvard.edu/~cduan/technical/git /

本 Mercurial 教程的第 0 章对于从 svn 迁移到 git 的人来说就像从 svn 迁移到 hg 一样有效。仅阅读本章,并将任何提及的 Mercurial 替换为 Git。

http://hginit.com/top/00.html

确保您正确克隆了存储库。我假设我们是在您的主目录中执行此操作。

cd ~
git clone git://url.to.remote.repository.com/foo.git

您现在应该有一个文件夹 ~/foo。这是您的工作副本。在 foo 中,您将找到一个文件夹 .git.git 保存您的本地存储库。要查看项目的最新版本,请运行这些命令。

cd ~/foo
git checkout master

Git 会将 ~/foo 中的文件更新为存储库中的最新版本。阅读我在本文开头提供的链接,了解如何浏览 git 存储库。

First, here are a couple helpful general resources. Here's a good, short git tutorial.

http://www.eecs.harvard.edu/~cduan/technical/git/

Chapter 0 of this Mercurial tutorial works just as well for someone moving from svn to git as svn to hg. Only read this chapter, and replace any mention of Mercurial with Git.

http://hginit.com/top/00.html

Make sure you cloned the repository correctly. I'll pretend we're doing this in your home directory.

cd ~
git clone git://url.to.remote.repository.com/foo.git

You should now have a folder ~/foo. This is your working copy. Inside foo you will find a folder .git. .git holds your local repository. To see the most up to date version of the project, run these commands.

cd ~/foo
git checkout master

Git will update the files in ~/foo to the most recent version in the repository. Read the links I gave you at the beginning of this post to learn how to navigate around the git repository.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文