<bdo id='9Ol7b'></bdo><ul id='9Ol7b'></ul>

    <tfoot id='9Ol7b'></tfoot>
  1. <legend id='9Ol7b'><style id='9Ol7b'><dir id='9Ol7b'><q id='9Ol7b'></q></dir></style></legend>

    <small id='9Ol7b'></small><noframes id='9Ol7b'>

      <i id='9Ol7b'><tr id='9Ol7b'><dt id='9Ol7b'><q id='9Ol7b'><span id='9Ol7b'><b id='9Ol7b'><form id='9Ol7b'><ins id='9Ol7b'></ins><ul id='9Ol7b'></ul><sub id='9Ol7b'></sub></form><legend id='9Ol7b'></legend><bdo id='9Ol7b'><pre id='9Ol7b'><center id='9Ol7b'></center></pre></bdo></b><th id='9Ol7b'></th></span></q></dt></tr></i><div id='9Ol7b'><tfoot id='9Ol7b'></tfoot><dl id='9Ol7b'><fieldset id='9Ol7b'></fieldset></dl></div>

    1. 使用 pygit2 拉取和集成远程更改

      时间:2023-08-30
    2. <legend id='9wovp'><style id='9wovp'><dir id='9wovp'><q id='9wovp'></q></dir></style></legend>
      <i id='9wovp'><tr id='9wovp'><dt id='9wovp'><q id='9wovp'><span id='9wovp'><b id='9wovp'><form id='9wovp'><ins id='9wovp'></ins><ul id='9wovp'></ul><sub id='9wovp'></sub></form><legend id='9wovp'></legend><bdo id='9wovp'><pre id='9wovp'><center id='9wovp'></center></pre></bdo></b><th id='9wovp'></th></span></q></dt></tr></i><div id='9wovp'><tfoot id='9wovp'></tfoot><dl id='9wovp'><fieldset id='9wovp'></fieldset></dl></div>
              <tbody id='9wovp'></tbody>
            <tfoot id='9wovp'></tfoot>
              <bdo id='9wovp'></bdo><ul id='9wovp'></ul>

              1. <small id='9wovp'></small><noframes id='9wovp'>

                本文介绍了使用 pygit2 拉取和集成远程更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                I do have the following problem. I'm writing a script which searches a folder for repositories, looks up the remotes on the net and pulls all new data into the repository, notifying me about new changes. The main idea is clear. I'm using python 2.7 on Windows 7 x64, using pygit2 to access the git features. The command-line supports the simple command "git pull 'origin'", but the git api is more complicated and I don't see the way. Okay, I came that far: import pygit2 orepository=pygit2.Repository("path/to/repository/.git") oremote=repo.remotes[0] result=oremote.fetch() This code retrieves the new objects and downloads it into the repository, but doesn't update the master branch or check the new data out. By inspecting the repository with TortoiseGit I see that nothing way checked out , even the new log messages don't appear when showing the log. I need to use the git pull command to refresh the repository and working copy at all. Now my question: What do I need to do to do all that by using pygit2? I mean, I download the changes by fetching them, but what do I need to do then? I want to update the master branch and working copy too... Thank you in advance for helping me with my problem. Best Regards.

                解决方案

                Remote.fetch() does not update the files in the workdir because that's very far from its job. If you want to update the current branch and checkout those files, you need to also perform those steps, via Repository.create_reference() or Reference.target= depending on what data you have at the time, and then e.g. Repository.checkout_head() if you did decide to update.

                git-pull is a script that performs very many different steps depending on the configuration and flags passed. When you're writing a tool to simulate it over multiple repositories, you need to figure out what it is that you want to do, rather than hoping everything is set up just so that git-pull won't surprise you.

                这篇关于使用 pygit2 拉取和集成远程更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何为数组值编写匹配条件? 下一篇:使用 PDFMiner (Python) 处理在线 pdf 文件.编码网址?

                相关文章

                <i id='gASep'><tr id='gASep'><dt id='gASep'><q id='gASep'><span id='gASep'><b id='gASep'><form id='gASep'><ins id='gASep'></ins><ul id='gASep'></ul><sub id='gASep'></sub></form><legend id='gASep'></legend><bdo id='gASep'><pre id='gASep'><center id='gASep'></center></pre></bdo></b><th id='gASep'></th></span></q></dt></tr></i><div id='gASep'><tfoot id='gASep'></tfoot><dl id='gASep'><fieldset id='gASep'></fieldset></dl></div>
                <legend id='gASep'><style id='gASep'><dir id='gASep'><q id='gASep'></q></dir></style></legend>

              2. <small id='gASep'></small><noframes id='gASep'>

                    <tfoot id='gASep'></tfoot>
                      <bdo id='gASep'></bdo><ul id='gASep'></ul>