GitHub - 不同步的提交? [英] GitHub - Unsynchronized Commit?

查看:149
本文介绍了GitHub - 不同步的提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在git仓库中对文件进行了一系列更改。在我承诺任何事情之前,我被要求提交别人为我提供的其他文件(来自SVN存储库)。我将这些文件放到了我的项目文件夹中,从之前的所有已更改的文件中挑选出来并提交。现在我需要同步分支以将这些转移到Github,但是当我尝试同步时,我会收到未提交的更改,请在同步之前提交更改。



我假设这是指我之前更改过的所有文件?但是,我不希望那些如此承诺......他们还没有准备好。我只想提交这一小部分文件。在这种情况下做什么?我如何移动我所做的所有更改,我不希望成为此次提交的一部分,因为缺乏更好的单词,并将我想要更改的部分放到github存储库中?



我使用的是GitHub应用程序,但可以从命令行执行,如果需要的话......只是不知道需要做什么。






以下是一些截图,使其更清晰:

在我的列表底部更改的文件是我想要移动的提交:




尝试获得提交到github,我点击同步按钮并获得:





什么是解决方案吗?如何避免这些未提交的更改?显然,我对git是新手,所以我不清楚正确的做法。感谢。

解决方案

我不知道GitHub应用程序是否提供了这种功能(尽管我会期待它),但git有一个名为git stash的函数,它将所有未提交的更改都存储在一个特殊的地方。这为您留下一个原始的工作副本(没有这些更改),您可以在其中执行任何所需操作,然后使用 git stash pop (或 git存储应用)重新应用您未提交的更改。我建议您阅读手册


I made a bunch of changes to files in a git repository. Before I committed anything I was asked to commit some other files someone else had for me (coming from an SVN repository). I dropped those files into my project folder, picked them from amongst all of the changed files from earlier and committed them. Now I need to Sync the branch to get these to move to Github but when I try to sync I get "Uncommitted Changes. Please commit your changes before syncing".

I assume this refers to all of the files I had changed previously? However, I do not want those so be committed... they are not ready. I only want to commit this small subset of files. What does one do in this situation? How do I move all of the changes I've made that I do NOT want to be a part of this commit out of the way, for lack of a better word, and get the part I DO want to change into the github repository?

I'm using the GitHub App but can do it from the command line if needed... just not sure what needs to be done.


Here are some screenshots to make it clearer:

At the bottom of my list of changed files is the commit I want to move:

Trying to get that commit to move over to github I click the Sync button and get:

What is the solution? How do I get these "uncommitted changes" out of the way? Obviously I am new to git so I am not clear on the correct approach. Thanks.

解决方案

I don't know if the GitHub app provides this functionality (though I would kind of expect it to), but git has a function called "git stash" which takes all your uncommitted changes and stashes them away in a special place. This leaves you with a pristine working copy (without those changes), where you can do whatever you need to, and then use git stash pop (or git stash apply) to reapply your uncommitted changes. I encourage you to read the manpage.

这篇关于GitHub - 不同步的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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