Search code examples
gitfilerstudiopushcommit

Why Commiting one file, but all files are committed in RStudio?


I have a repository on Github with some files and I have a folder on the RStudio server with some files as well. I have made some changes on some files, but I just want to commit one file (test.Rmd) only using the command

git init
git add test.Rmd
git commit -m "Adding some plots" 
git push

Instead off committing this file only it commits all files in the folder where the file test.Rmd is. Why is that happened? I tried doing the exact same things for one other file in different folder and the committing worked. Before this, it seems I did something already such as

git init
git add .

that is why it added all files on the directory?

Using the git status results

git status

I suspect now that the problem is cancelling adding these large files? I think I committed all changes of all files without knowing I did it when I use git push in the end.


Solution

  • I have solved this issue by using the Git lfs for Large files. Since I am using the RStudio server, I asked the admin to install the Git lfs then I do these

    git lfs install
    git lfs track "*.h5ad, *.h5Seurat"
    git add .gitattributes
    git lfs migrate info
    git lfs migrate info --everything
    git lfs migrate import --everything --a #override changes in your working copy? 
    [Y/n] Y
    

    Then it will push the commit to Github. Note that *.h5ad and *h5Seurat is the large file extensions that I want the Git lfs to handle. I am following this link git lfs