我可以“svn up”吗? git 的行为?

发布于 2024-12-11 08:56:03 字数 189 浏览 0 评论 0原文

我的大部分新项目都使用 git,遗留项目则使用 Subversion。

在 Subversion 中,我可以将项目检出到两台机器(即笔记本电脑和台式机)。这样我就可以在笔记本电脑上的分支中进行编辑,并使用 svn ci 签入它们。然后在桌面计算机上,我可以在该分支中运行 svn up 来获取更改。

git 是否有类似的工作流程?

I use git for most of my new projects and Subversion for legacy projects.

In Subversion, I can checkout a project to two machines (i.e., laptop and desktop). This way I can make edits in a branch on the laptop and check them in with svn ci. Then on the desktop machine, I can run svn up in that branch to pickup the changes.

Is there a similar workflow available with git?

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

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

发布评论

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

评论(4

柳絮泡泡 2024-12-18 08:56:03

您将:

  • 从公共 Git 存储库(主存储库)中提取 (git pull)
  • 在笔记本电脑上进行更改,然后提交它们。您可以离线执行此操作。 (git add, git commit)
  • 将更改从笔记本电脑的克隆推送回主存储库 (git Push)
  • 从主存储库中拉取桌面(git pull

You would:

  • Pull from a common Git repository (the master) (git pull)
  • Make changes on the laptop, and commit them. You can do this offline. (git add, git commit)
  • Push the changes from the laptop's clone back to the master repository (git push)
  • Pull from the master repository on the desktop (git pull)
怪异←思 2024-12-18 08:56:03

当然有。相当于 svn ci 的 git 是 git commit -a 后跟 git push,相当于 svn up是 git pull 。除此之外,它与 Subversion 几乎相同。

使用 git,如果您能够通过 ssh 从一台笔记本电脑连接到另一台笔记本电脑,您还可以直接从桌面将更改拉取到笔记本电脑。为此,您可以在笔记本电脑上运行

git pull ssh://user@desktop/path/to/git/working/copy branchname:branchname

或者您可以运行

git remote add desktop ssh://user@desktop/path/to/git/working/copy

一次来​​设置命名远程,然后

git pull desktop branchname:branchname

There certainly is. The git equivalent to svn ci is git commit -a followed by git push, and the equivalent to svn up is git pull. Otherwise, it's pretty much the same as with Subversion.

With git, you can also directly pull changes to your laptop from your desktop, if you are able to connect from one to the other with ssh. To do this, on your laptop you would run

git pull ssh://user@desktop/path/to/git/working/copy branchname:branchname

Or you could run

git remote add desktop ssh://user@desktop/path/to/git/working/copy

once to set up a named remote, then

git pull desktop branchname:branchname
最好是你 2024-12-18 08:56:03

您可以使用类似于 svn ci 的方式使用 git Push,而 git pull 将完成剩下的工作。

You use git push similarly to svn ci, and git pull will do the rest.

感受沵的脚步 2024-12-18 08:56:03

svn ci 大约是 git add 后跟 git commit (或者如果你总是提交,就使用 git commit -a每个更改的文件)。

svn up 大致相当于git pull

哦,听起来你想要一个远程跟踪分支 - 查一下,它们有详细的记录。

svn ci is approximately git add followed by git commit (or just use git commit -a if you always commit every changed file).

svn up is roughly git pull.

Oh, and it sounds like you want a remote tracking branch - look it up, they're well documented.

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