ameliabrower-noaa / Brower-NOAA-quarto-book

Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

copy files from branches #1

Open ameliabrower-noaa opened 1 year ago

ameliabrower-noaa commented 1 year ago

Learn how to copy a file from one person's branch into another branch.

ameliabrower-noaa commented 1 year ago

Megan's instructions: First, I was able to figure out how to copy files from Millie's branch over to my branch. Here are the instructions I followed: https://stackoverflow.com/questions/307579/how-do-i-copy-a-version-of-a-single-file-from-one-git-branch-to-another

But here are the exact steps that I took:

Run the following command from the Terminal in RStudio when you're in the branch where you want the file to end up:

git checkout otherbranch myfile.txt

For example, if I'm in the Ferguson branch of AviatorLlama in RStudio, the Terminal shows me this: megan.ferguson@AKCSL1016-MF19 MINGW64 ~/Work/JobStuff/Training/Openscapes/AviatorLlama_Teamwork/AviatorLlama (Ferguson) $

After the $, I type

git checkout Brower content/Methods_Cameras.qmd

then hit return, and the terminal returns the following:

Updated 1 path from 58dc91c

Then, I need to commit and push the change to the Ferguson branch. Once I do that, the file from the Brower branch now resides in the Ferguson branch.

The general formulas (which I haven't yet tried) are:

git checkout git checkout /

ameliabrower-noaa commented 1 year ago

However, when I try to do what Megan did, I get the error: error: pathspec 'Ferguson' did not match any file(s) known to git

Megan tested it and switched to working in the Brower branch and was able to copy files from Ferguson to Brower, so it seems to be a problem with how my machine or R are set up.

We've checked the file pathways and whether we need to be in a certain type of RStudio terminal (Command prompt vs. GitBash), but haven't been able to figure out why my laptop/R doesn't want to do it, but Megan's will.