ios git解决冲突

如何在iOS上使用Git设置跨平台的云同步解决方案以在任何地方工作。 (How to set up a cross-platform cloud sync solution for working anywhere using Git on iOS.)

I previously wrote about a (hackish) way to use a single Dropbox folder on a dual-boot Windows and Linux machine. I’ve since gained some sense gone full Linux with Ubuntu 18.04 LTS, but the Dropbox set up seems to have stopped being an option in any case. Fortunately, I’ve since found a much better (far less hackish) way to remote-sync files across different file systems. Reflecting my current set up, I’m talking about iOS (iPad and iPhone) and my Linux machine.

之前,我曾写过一种在双启动Windows和Linux计算机上使用单个Dropbox文件夹的(骇人听闻的)方法。 从那以后,我对使用Ubuntu 18.04 LTS的完整Linux有了一定的了解,但是无论如何,Dropbox的设置似乎都不再是一种选择。 幸运的是,从那时起,我发现了一种更好的方式(远没有那么骇人听闻的),可以跨不同文件系统远程同步文件。 为了反映我当前的设置,我在谈论iOS(iPad和iPhone)和我的Linux机器。

The new sync system is based on Git, very customizable, and conveniently extensible. Beyond text files, you can sync anything that Git can (which is almost everything — if you want to edit your .gitignored files on the go I’m not sure I can help). If you’re already familiar with Git, getting set up will be a walk in the park. If Git is new to you, I think these tools help make the concepts of Git cloning, pulling, and pushing straightforward to understand.

新的同步系统基于Git,非常可定制且可方便扩展。 除了文本文件之外,您还可以同步Git可以执行的任何操作(几乎是所有操作-如果您想随时随地编辑.gitignore d文件,我不确定我能帮助您)。 如果您已经熟悉Git,那么在公园里散步就可以开始设置。 如果您不熟悉Git,我认为这些工具有助于使Git克隆,提取和推送的概念更容易理解。

组件 (Components)

  • Working Copy app ($15.99 one-time pro-unlock and well worth it, iOS only)

    Working Copy应用程序 (15.99美元的一次性专业解锁功能,非常值得,仅适用于iOS)

  • iA Writer app ($8.99 one-time purchase for iOS, also available on Mac, Windows, and Android)

    iA Writer应用程序 (iOS一次性购买为8.99美元,也可在Mac,Windows和Android上使用)

  • GitHub repositories (private or public, both free)

    GitHub存储库( 私有或公共,均免费)

I was inspired by this article as well as this one.

我的灵感来自于这篇文章以及这一个 。

设置好 (Get set up)

Here are the steps to setting up that I’ll walk you through in this article.

这里是设置步骤,本文将引导您完成。

  1. Create your remote repository创建您的远程存储库
  2. Clone repository to iPad with Working Copy使用工作副本将存储库克隆到iPad
  3. Open and edit files with iA Writer使用iA Writer打开和编辑文件
  4. Push changes back to remote将更改推回远程
  5. Pull changes from repository on your computer从计算机上的存储库中提取更改

This system is straightforward to set up whether you’re a command line whiz or just getting into Git. Let’s do it!

无论您是命令行专家还是刚进入Git,均可轻松使用该系统进行设置。 我们开始做吧!

创建您的远程存储库 (Create your remote repository)

GitHub now offers free private repositories for up to three collaborators. Choose “Private” on GitHub’s repository creation page:

GitHub现在为最多三个合作者提供免费的私有存储库 。 在GitHub的存储库创建页面上选择“私有”:

Create the repository. If you’d like to, you can follow GitHub’s instructions to push some files to it from your computer, or you can add files later from your iPad.

创建存储库。 如果愿意,您可以按照GitHub的说明从计算机将一些文件推送到它,或者以后可以从iPad添加文件。

使用工作副本将存储库克隆到iPad (Clone repository to iPad with Working Copy)

Download Working Copy from the App Store. It’s one of the more expensive apps I’ve purchased, but I think it’s well worth it. Developer Anders Borum has a steady track record of frequent updates and incorporating the latest features for iOS apps, like drag and drop on iPad. I think he’s fairly priced his product in light of the work he puts into maintaining and enhancing it.

从App Store下载工作副本 。 这是我购买的较昂贵的应用程序之一,但我认为它非常值得。 开发人员Anders Borum拥有频繁更新的稳定记录,并结合了iOS应用程序的最新功能,例如在iPad上拖放 。 我认为,根据他在维护和增强产品方面所做的工作,他对产品定价合理。

In Working Copy, find the gear icon in the top left corner and touch to open Settings.

在工作副本中,找到左上角的齿轮图标,然后触摸以打开设置。

Tap on SSH Keys, and you’ll see this screen:

点击SSH密钥,您将看到以下屏幕:

SSH keys, or Secure Shell keys, are access credentials used in the SSH protocol. Your key is a password that your device will use to securely connect with your remote repository host — GitHub, in our example. Since anyone with your SSH keys can potentially pretend to be you and gain access to your files, it’s important not to share them accidentally, like in a screenshot on a blog post.

SSH密钥或Secure Shell密钥是SSH协议中使用的访问凭据。 密钥是设备用来与远程存储库主机安全连接的密码(在我们的示例中为GitHub)。 由于拥有SSH密钥的任何人都可能假装为您并可以访问您的文件,因此,不要像博客文章中的屏幕快照那样意外共享它们,这一点很重要。

Tap on the second line that looks like “WorkingCopy@iPad-xxxxxxxx” to get this screen:

点击第二行,类似于“ WorkingCopy @ iPad-xxxxxxxx”以获取此屏幕:

Working Copy supports easy connection to both BitBucket and GitHub. Tap “Connect With GitHub” or BitBucket to bring up some familiar sign-in screens that will authorize Working Copy to access your account(s).

工作副本支持轻松连接到BitBucket和GitHub。 点击“使用GitHub连接”或BitBucket,以显示一些熟悉的登录屏幕,这些屏幕将授权工作副本访问您的帐户。

Once connected, tap the “+” symbol in the top right of the side bar to add a new repository. Choose “Clone repository” to bring up this screen:

连接后,点击侧栏右上角的“ +”符号以添加新的存储库。 选择“克隆存储库”以显示此屏幕:

Here, you can either manually input the remote URL, or simply choose from the list of repositories that Working Copy fetches from your connected account. When you make your choice, the app clones the repository to your iPad and it will show up in the sidebar. You’re connected!

在这里,您既可以手动输入远程URL,也可以从工作副本从您所连接的帐户中获取的存储库列表中进行选择。 当您做出选择时,该应用会将存储库克隆到您的iPad,它将显示在侧边栏中。 您已连接!

使用iA Writer打开和编辑文件 (Open and edit files with iA Writer)

One of the (many) reasons I adore iA Writer is its ability to select your freshly cloned remote repository as a Library Location. To do this in the iA Writer app:

我喜欢iA Writer的(很多)原因之一是它能够选择新克隆的远程存储库作为“库位置”。 要在iA Writer应用中执行此操作:

  1. From the main Library list, in the top right of the sidebar, tap “Edit”在侧边栏右上方的主库列表中,点击“编辑”
  2. Tap “Add Location…”点击“添加位置...”
  3. A helpful popup appears. Tap OK.出现一个有用的弹出窗口。 点击确定。
  4. From the Working Copy location, tap “Select” in the top right, then choose the repository folder.在工作副本位置,点击右上方的“选择”,然后选择存储库文件夹。
  5. Tap “Open”, then “Done”点击“打开”,然后点击“完成”

Your remote repository now appears as a Location in the sidebar. Tap on it to work within this directory.

现在,您的远程存储库在边栏中显示为“位置”。 点击它可在此目录中工作。

While inside this location, new files you create (by tapping the pencil-and-paper icon in the top right corner) will be saved to this folder locally. As you work, iA Writer automatically saves your progress. Next, we’ll look at pushing those files and changes back to your remote.

在此位置内,您创建的新文件(通过点击右上角的铅笔和纸图标)将被本地保存到该文件夹​​中。 在工作时,iA Writer会自动保存进度。 接下来,我们将研究将这些文件和更改推送回您的遥控器。

将更改推回远程 (Push changes back to remote)

Once you’ve made changes to your files, open Working Copy again. You should see a yellow dot on your changed repository.

更改文件后,再次打开工作副本。 您应该在更改的存储库上看到一个黄点。

Tap on your repository name, then on “Repository Status and Configuration” at the top of the sidebar. Your changed files will be indicated by yellow dots or green “+” symbols. These mean that you’ve modified or added files, respectively.

点击您的存储库名称,然后点击侧栏顶部的“存储库状态和配置”。 更改的文件将以黄色圆点或绿色“ +”符号表示。 这意味着您分别修改或添加了文件。

Working Copy is a sweet iOS Git client, and you can tap on your files to see additional information including a comparison of changes (“diff”) as well as status and Git history. You can even edit files right within the app, with syntax highlighting for its many supported languages. For now, we’ll look at how to push your changed work to your remote repository.

Working Copy是一个不错的iOS Git客户端,您可以点击文件以查看其他信息,包括更改比较(“ diff”)以及状态和Git历史记录。 您甚至可以直接在应用程序内编辑文件,并突出显示其许多受支持语言的语法 。 现在,我们将研究如何将更改的工作推送到远程存储库。

On the “Repository Status and Configuration” page, you’ll see right at the top that there are changes to be committed. If you’re new to Git, this is like “saving your changes” to your Git history, something typically done with the terminal command git commit. You can think of this as saving the files that we’ll want to send to the GitHub repository. Tap “Commit changes.”

在“存储库状态和配置”页面上,您会在右上方看到要提交的更改。 如果您不熟悉Git,这就像“保存更改”到Git历史记录一样,通常使用终端命令git commit来完成。 您可以将其视为保存我们要发送到GitHub存储库的文件。 点击“提交更改”。

Enter your commit message, and select the files you want to add. Turn on the “Push” switch to send everything to your remote repository when you commit the files. Then tap “Commit.”

输入您的提交消息,然后选择要添加的文件。 提交文件时,打开“推”开关可将所有内容发送到远程存储库。 然后点击“提交”。

You’ll see a progress bar as your files are uploaded, and then a confirmation message on the status screen.

上传文件时,您会看到一个进度条,然后在状态屏幕上看到一条确认消息。

Congratulations! Your changes are now present in your remote repository on GitHub. You’ve successfully synced your files remotely!

恭喜你! 您的更改现在显示在GitHub上的远程存储库中。 您已成功远程同步文件!

从计算机上的存储库中提取更改 (Pull changes from repository on your computer)

To bring your updated files full circle to your computer, you pull them from the GitHub repository. I prefer to use the terminal for this as it’s quick and easy, but GitHub also offers a graphical client if terminal commands seem a little alien for now.

要将更新的文件完整地带到您的计算机上,请从GitHub存储库中将它们拉出。 我更喜欢使用终端,因为它既快速又简单,但是如果终端命令现在看起来有点陌生,那么GitHub也提供了图形客户端。

If you started with the GitHub repository, you can clone it to a folder on your computer by following these instructions.

如果您从GitHub存储库开始,则可以按照以下说明将其克隆到计算机上的文件夹中。

保持同步 (Staying in sync)

When you update your work on your computer, you’ll use Git to push your changes to the remote repository. To do this, you can use GitHub’s graphical client, or follow these instructions.

当您在计算机上更新工作时,将使用Git将更改推送到远程存储库。 为此,您可以使用GitHub的图形客户端 ,或按照以下说明进行操作 。

On your iOS device, Working Copy makes pulling and pushing as simple as a single tap. On the Repository Status and Configuration page, tap on the remote name under “Remotes”.

在您的iOS设备上,“工作副本”使拉动和推动都变得像单击一样简单。 在“存储库状态和配置”页面上,点击“远程”下的远程名称。

Then tap “Synchronize”. Working Copy will take care of the details of pushing your committed changes and/or pulling any new changes it finds from the remote repository.

然后点击“同步”。 工作副本将处理有关推送您的更改和/或从远程存储库中找到的任何新更改的细节。

还不错吧? (Not bad, right?)

For a Git-based developer and work-anywhere-aholic like me, this set up couldn’t be more convenient. Working Copy really makes staying in sync with my remote repositories seamless, never mind the ability to work with any of my GitHub repos on the go.

对于像我这样的基于Git的开发人员和随处可见的狂热爱好者,此设置再方便不过了。 Work Copy确实使与我的远程存储库的同步保持无缝,不用担心能够随时随地使用我的任何GitHub存储库。

For editing on the go, here’s a useful tip. Use .gitignore in your sync repository if you don’t need to move large files, like images, around with you. This will stop the ignored files from being pushed to GitHub and pulled to your iOS device - they’ll only remain on your computer’s larger hard drive. The .gitignore file of one of my sync repositories looks like this:

对于随时随地进行编辑,这是一个有用的提示。 如果您不需要.gitignore移动大型文件(例如图像),请在同步存储库中使用.gitignore 。 这将阻止被忽略的文件被推送到GitHub并被拉到您的iOS设备-它们只会保留在计算机较大的硬盘上。 我的一个同步存储库之一的.gitignore文件如下所示:

*.png
*.jpeg
*.jpg
*.mp4
*.gif

This means all the media files stay on my computer, and I can pull just the text file content to my iPad from GitHub to work on while I’m out and about.

这意味着所有媒体文件都保留在我的计算机上,并且我可以在外出时从GitHub将文本文件内容仅提取到iPad上进行工作。

I most recently used this set up to get some writing done while hanging out in the atrium of Washington DC’s National Portrait Gallery, which is pleasantly photogenic.

我最近使用此装置在华盛顿特区国家肖像画廊的中庭闲逛时完成了一些写作工作,该画廊令人上镜。

I’d love to hear how this set up works for you and how you use it. In the meantime, happy working!

我很想听听此设置如何为您工作以及如何使用它。 同时,工作愉快!

翻译自: https://www.freecodecamp.org/news/a-remote-sync-solution-for-ios-and-linux-git-and-working-copy-1aba488b3547/

ios git解决冲突

ios git解决冲突_适用于iOS和Linux的远程同步解决方案:Git和工作副本相关推荐

  1. eclipse git 解决冲突 解决 mergetool 不能使用问题

    eclipse git 解决冲突 解决 mergetool 不能使用问题 参考文章: (1)eclipse git 解决冲突 解决 mergetool 不能使用问题 (2)https://www.cn ...

  2. 【git】git解决冲突

    git解决冲突 1.概述 2.rebase使用 3.rebase相关命令 4.参考 1.概述 git解决冲突有两种办法: rebase merge 先说结论,解决冲突时尽量使用rebase.原因是因为 ...

  3. VSCode中Git解决冲突的步骤

    VSCode中Git解决冲突的步骤 1>>合并分支后,如果存在冲突,右下角会出现一个提示框,提示:存在合并冲突.请在提交之前解决这些冲突. 2>>左边导航第三个图标中,找到产生 ...

  4. git解决冲突后,仍然处于git merging

    git 解决冲突后仍然处于merging状态(无法commit.pull和push) 导致这种问题通常是包结构变化,导致本地代码和远程分支文件冲突所致(远程分支文件存在,而本地缺删了文件),解决方案, ...

  5. ios开发 架子鼓功能开发_适用于iOS开发人员的功能标志

    ios开发 架子鼓功能开发 When building modern applications, things tend to move quite quickly. When you add mul ...

  6. git拉取代码如何解决冲突_开源项目 git pull 代码冲突的解决方式?

    假设我正在使用一个开源项目,为了时刻保持根官方github保持同步,我用git clone项目到本地并进行二次开发,我的大部分二次开发是不会和官方的核心文件产生冲突的,但是个别文件还是会冲突.. 比如 ...

  7. git拉取代码如何解决冲突_「GIT SourceTree冲突」解决方案

    现在程序猿标配GIT作为代码管理,但是从SVN到GIT学习中,其中GIT的冲突是一个难点,常常会导致Push不上去,Pull不下来,很尴尬的地步,还不知道自己写的代码被覆盖没,废话不多说,直接上干货! ...

  8. git解决冲突 删除本地_解决冲突

    人生不如意之事十之八九,合并分支往往也不是一帆风顺的. 准备新的feature1分支,继续我们的新分支开发: $ git switch -c feature1 Switched to a new br ...

  9. ios web应用程序_使用ios 13改善应用程序的可访问性

    ios web应用程序 I know, iOS 13 has been with us for quite some time now, WWDC 2020 is just around the co ...

最新文章

  1. linux认证授权系统,linux高级操作系统用户认证与授权-20210323002921.doc-原创力文档...
  2. 前端笔记-thymeleaf显示数据及隐藏数据
  3. torch.mul() 和 torch.mm() 区别【矩阵a和b对应位相乘/矩阵相乘】
  4. vim粘贴乱码的原因
  5. python怎么读取excel-python怎么读取excel表格
  6. MJKDZ PS2手柄控制OskarBot小车(二):硬件连接与通信时序
  7. Qt + FFmpeg 屏幕录制器
  8. 51jiqiren小语种语音机器人
  9. React从零到一Demo演练(上)
  10. onlyoffice mysql_Onlyoffice部署文档
  11. 大象装进冰箱要几步?Python 来解答
  12. k8s 亲和、反亲和、污点、容忍
  13. 华硕电脑改光驱启动计算机,华硕笔记本怎么在BIOS里设置从光驱开启重装系统...
  14. php开发API接口的代码案例
  15. 最快最有效的锻炼出腹肌来
  16. 51单片机基础之蜂鸣器
  17. wpf中图片资源引用问题
  18. html 英文自动换行,CSS让英文单词的自动换行
  19. vb获取服务器文件路径,vb打开ftp服务器文件路径
  20. “螺蛳粉宇宙中心”柳州,看网红速食如何实现长红?

热门文章

  1. 2020.10.s1 冯上
  2. 使用markdown语法记录笔记 1613957838
  3. 安装虚拟环境virtualenv与virtualenvwrapper在centos7系统上
  4. redis-启动服务端-客户端连接服务端
  5. django-模型类的查询方法
  6. linux-安装树形查看工具-tree
  7. linux-分区与硬盘-实战:添加新硬盘
  8. Ajax 和 PHP 实现验证码的实时验证
  9. spring系统学习:20180607--Spring的 IOC 的XML和注解的整合开发
  10. OpenSsl工具的介绍