只推送一个文件夹到远程回购 [英] Pushing only one folder to remote repo

查看:120
本文介绍了只推送一个文件夹到远程回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Git 1.7.4.1。我想将我在一个文件夹上做的提交推送到远程回购。如何只将更改从一个文件夹推送到远程回购?我找到的所有文档仅列出了如何推送整个repo ...

  davea-mbp2:systems davea $ git推送起始中继线
密码:
至http://dalvarado@mydomain.com/systems.git
! [rejected] trunk - >主干(非快进)
错误:未能将某些参考推送到'http://dalvarado@mydomain.com/systems.git'
为防止您失去历史记录,正向更新被拒绝
在再次推送之前合并远程更改(例如'git pull')。有关详细信息,请参阅git push --help的快速转发部分的
'注意事项。

我被警告的冲突不适用于我要推送的文件夹。任何帮助表示赞赏, - 戴夫

解决方案

Git不像颠覆。简单的答案是,你不能。



你应该考虑重新改变你的改变(只有一个相关的)对远程

  git rebase -i origin / trunk 

应该让你进行。一定要阅读一路上的评论和说明。当然也有 man git-rebase

最后,当你对结果满意时,你可以从那里创建一个新的分支

  git checkout -b rebased HEAD 

或者您可以选择将其设为您的新主人。我会让你知道如何在本地管理你的分支机构(因为你没有告诉我们关于它们的信息)。



推动起来很容易,

  git push origin trunk 


I'm using Git 1.7.4.1. I want to push commits I did on one folder to my remote repo. How do I push only changes from one folder to my remote repo? All the documentation I've found only lists how to push the entire repo ...

davea-mbp2:systems davea$ git push origin trunk
Password: 
To http://dalvarado@mydomain.com/systems.git
 ! [rejected]        trunk -> trunk (non-fast-forward)
error: failed to push some refs to 'http://dalvarado@mydomain.com/systems.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

The conflicts I'm being warned about do not apply to the folder that I want to push. Any help is appreciated, - Dave

解决方案

Git is not like subversion. The short answer is, you can't.

You should consider rebasing your change (only the one relevant) against the remote

git rebase -i origin/trunk

should get you underway. Be sure to read the comments and instructions along the way. There is also man git-rebase of course.

In the end, when you are satisfied with the result, you can either create a new branch from there

 git checkout -b rebased HEAD

or you can opt to make it your new master. I'll leave it up to you how to manage your branches locally (because you didn't tell us about them).

Pushing woud then be easy with

 git push origin trunk

这篇关于只推送一个文件夹到远程回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆