Question

I am using Github for Windows to manage several Git repos. For one of a newly cloned repo, it seems that newly created files appear in the 'X files too be committed' list, but after clicking on the Commit button, a new commit is created but the newly created files are still uncommitted!

enter image description here

I can continue to commit the same files over and over again, creating new commits each time, but the newly created files are simply not committed unless I go to the command prompt and manually do git add .

Is there a setting in Github for Windows that I have missed?

Was it helpful?

Solution

Actually I don't think you are missing anything. I just tested this and this is not the default behaviour. Normally after you commit, the files should be flagged as unsynced. When you click Sync button the committed changes should be pushed to the upstream.

This is most probably a bug.

Before commit:

Before commit

After commit :

After commit

OTHER TIPS

Best I can tell, GitHub for Windows doesn't properly recognize file differences that only vary by line endings (at least in the scenarios I've found). I had multiple javascript files that consisted of something like:

- (function(){
-   function foo(){
-     return 'bar';
-   }
- )();
+ (function(){
+   function foo(){
+     return 'bar';
+   }
+ )();

Which, at first glance didn't make sense. Then, after I looked in to it, the variance was the file went from a \r\n line ending to \n (or the inverse). FWIW, I have the following setup in .gitattributes:

* text=auto

However, I was able to resolve it by using the shell. First, a git status showed me I did, indeed, have several files with modifications (and git even told me they varied by line endings):

.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Project/Path/file.js

then, i used git commit -a to add those files, and finally git push to send them up to the repository. I now (even according to GitHub for Windows) have a syncd branch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top