git:从非git存储库导入更改 [英] git: import changes from non git repository

查看:160
本文介绍了git:从非git存储库导入更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




  • 本地git回购,默认主分支

  • 内容为repo(非git),每天与本地仓库同步,​​master分支



工作流程:


  • user1正在使用本地git repo(git add,工作目录干净)
  • user2(非git用户)直接在FTP服务器



如何将所有在FTP上更改的文件导入本地git仓库并查看已更改的项目? b $ b

解决方案

这听起来有点噩梦。我认为它不能在FTP服务器上拥有一个git仓库。在这种情况下,我会在工作库中创建一个单独的分支:

  git checkout -b ftp 

复制ftp并将其提交给分支:

  git commit -a 

然后回到master:

  git checkout master 

并从FTP分支进行正常的合并,比较,挑选。您可能想在合并完成后删除FTP目录。


Scenario:

  • Local git repo, default master branch
  • FTP server with content of the repo (non git), synchronized daily with the local repo, master branch

Workflow:

  • user1 is working on local git repo (git add, working directory clean)
  • user2 (non git user) changed files directly on the FTP server

How can I import all files changed on FTP to the local git repo and see what has changed?

解决方案

It sounds a bit nightmarish. I assume it is no option to have a git repository on the FTP server. In that case I would create a separate branch in my work repository:

git checkout -b ftp

copy the ftp stuff over and commit it to the branch:

git commit -a 

then go back to the master:

git checkout master

and do the normal merge, diff, cherry-pick from the FTP branch. You might want to delete the FTP directory after merging is done.

这篇关于git:从非git存储库导入更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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