将文件提交给GitHub for Windows

编程入门 行业动态 更新时间:2024-10-13 14:28:49
本文介绍了将文件提交给GitHub for Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在和我的同事一起工作一个Android项目,他最近在上设置了一个GitHub仓库

似乎必须执行以下步骤

  • git add
  • git commit
  • git push ol>

    但是从这个线索

    GitHub for Windows'同步做什么?

    看起来'同步'按钮可以完成所有这三项操作吗?所以,我不确定如何准确地完成我的提交。我认为我已经进行了修改(在上一步中)的事实意味着我已经上演了它们,这就是为什么提供同步选项的原因。解决这个问题的任何帮助都将受到高度赞赏。

    PS:我也向GitHub支持团队伸出援手,并在下面发布了他们的解决方案。

    解决方案

    只要添加到VonC写的内容即可... b $ b

    试图点击同步按钮,我看到以下屏幕:

    阅读他的建议后,我点击'Open Shell'并键入

    git stash

    并且显示如下

    在此之后,我可以点击'同步'按钮并且可以同步成功。

    阅读VonC的评论后添加

    但是,在成功将该文件添加到回购后,我注意到另外两个构建文件('BuildConfig.java'和'project.properties')没有出现在Windows的GitHub中。因此,在阅读VonC的建议后,我输入了

    git stash pop

    在之前打开的shell中,然后这两个文件再次出现在GitHub for Windows上。

    从GitHub支持听回来后添加

    不幸的是,当您将更改或文件分开时,您无法同步。但有一个解决方法:

  • 提交工作目录中的所有内容(使用WIP提交消息或Work进行中)
  • 同步
  • 选择WIP提交并单击回滚到此提交按钮。 b $ b

    当你同步时,本地提交将被提取并放到你从服务器获得的提交结束。

    I'm working on an Android project with my colleague and he recently setup a GitHub repo on github. At my end, I downloaded and installed GitHub for Windows on my 64-bit Windows 7 machine. I then proceeded to go to the repo on GitHub and clone the project using the 'Clone in Windows' button.

    Everything appeared to go smoothly and the project was at

    C:\Android\git-repos\OurProject

    on my machine. I then made some changes to the file

    C:\Android\git-repos\OurProject\Host\Android\src\com\ourproject\client\SettingsActivity.java

    I then observed that the changed file (along with some changed build files) did show up on the version of GitHub I had on my machine like this

    I selected the 'SettingsActivity.java' file, filled in a short description and hit the 'Commit' button. Then I saw the following screen

    Then, when I clicked on 'sync'

    hoping the changes I made would be pushed back to the master repo, I got the following message

    unstaged changes You cannot sync with unstaged changes. Please commit your changes and try again.

    Why did I get this error message?

    I did look at this thread

    What's the unstaged changes in github?

    and it seems that one has to do the following steps

  • git add
  • git commit
  • git push
  • but from this thread

    What does GitHub for Windows' "sync" do?

    it might appear that the 'sync' button does all three? So, I'm not sure how to exactly stage my commits. I thought the fact that I had committed my changes (in the previous step) implied that I had staged them and that is why the option to sync was being offered. Any help in resolving this issue would be much-appreciated.

    P.S: I also reached out to the GitHub support team and have posted their solution below as well.

    解决方案

    Just to add to what VonC wrote...

    Each time I attempted to hit the 'sync' button, I was shown the following screen

    After reading what he suggested, I clicked on 'Open Shell' and typed

    git stash

    and it displayed something like this

    After this I was able to hit the 'sync' button and it was able to sync successfully.

    Added After Reading VonC's Comment

    However, after adding that file successfully to the repo, I noticed that the other two build files ('BuildConfig.java' and 'project.properties') were not showing up in GitHub for Windows. So, after reading VonC's suggestion, I typed

    git stash pop

    in the shell that was opened earlier and then the two files appeared again on GitHub for Windows.

    Added After Hearing Back from GitHub Support

    Unfortunately you can't sync while you have unstaged changes or files. But there is one workaround:

  • Commit everything in your working directory (use a commit message of "WIP" or something as short for "Work in Progress")
  • Sync.
  • Select the "WIP" commit and click the "rollback to this commit" button.
  • When you sync, local commits are taken and put at the end of the commits you got from the server.

    更多推荐

    将文件提交给GitHub for Windows

    本文发布于:2023-11-23 16:34:37,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:文件   GitHub   Windows

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!