gge-ucd / Discussion

Class discussion for R-DAVIS course
0 stars 4 forks source link

Folders? #14

Closed iheartrats closed 7 years ago

iheartrats commented 7 years ago

I am having trouble reconciling the folders and files that are on my git and computers. I am switching back and forth between a laptop and a desktop at home. I am under the impression that git is acting essentially as a "google drive" for the files. But I have somehow managed to make a ton of different folders. I just cleared out the old ones and re-connected my katie_smith repository on my desktop. I added in a couple folders directly into the "Files" pane and they appeared in my local drive, but not in the web git repository and not on to the local repository on my lap top (after pushing and pulling). The folders are identical "c:/R/katie_smith". I don't know if I am just not really understanding git or if I have a setting wrong or something. There is not an option to create the folders in the web repository so I don't really know what is going on. Halplz.

ryanpeek commented 7 years ago

So...git is kind of different in that unlike dropbox or google drive, it won't sync files between your local computer and the cloud (your repository on Github) unless you explicitly select those files, commit them, and push them up to Github 🚀 ☁️ . So it gives you much greater control, and retains a lot more information about what exactly has changed between revisions/additions/deletions in each file.

In addition, if you are just creating folders and those folders don't have any files in them, git may not add them, because it doesn't see that as a "change". It only recognizes a change when you put a file inside a 📁 , and then do the add (or stage) ➡️ commit ➡️ push steps.

So, rules for steps you should take:

  1. Pull from your existing repository to local desktop or laptop. Then you know you are ready to do stuff. If there are issues locally (i.e., you can't pull because there are conflicts), best options are to delete your stuff locally (maybe copy the stuff you want to keep elsewhere temporarily) and start fresh using the "clone, create new git project in Rstudio" pipeline we covered. Or you can ask me to take a look next time your around.
  2. Assuming you pulled, you can now open the location you are keeping the clone or project directory on your computer. Use an explorer window, make some folders, add some files, etc. You can do this from Rstudio as well. Whatever you like.
  3. Once files are organized and added in the way you prefer, you can in RStudio, click on the git tab, click the little boxes next to each file you want to add to your repository (notice if you click a folder it will select all the files within that folder for you...unless there are empty folders). Click on Commit.
  4. Type a short message saying, "I hate github but I'm following these instructions to add my files" 👍 , click the Commit button.
  5. Should be successful, close that little black box window and click "Push". Wait a minute or three for it to push all the up to your repository. Go check repo online and make sure you see stuff you just pushed.

Done! Hope this helps. Good luck.

R