Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub - Unsynchronized Commit?

Tags:

git

github

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:

enter image description here

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

enter image description here

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.

like image 450
rg88 Avatar asked Nov 17 '11 21:11

rg88


People also ask

How do you sync changes in GitHub?

On GitHub, navigate to the main page of the forked repository that you want to sync with the upstream repository. Select the Sync fork dropdown. Review the details about the commits from the upstream repository, then click Update branch.


1 Answers

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.

like image 98
Lily Ballard Avatar answered Oct 18 '22 06:10

Lily Ballard