当我从终端输入 运行 代码时,将使用哪个分支?

Which branch will be used, when I run code from the terminal?

如果我在git下有多个分支的软件,当我运行代码时将使用哪个代码? 将使用 master,还是最后提交更改的那个?

您可以使用以下方法进行测试:

mkdir test
cd test
vim test.R
  print("hi") # save with ESC, CTRL+x
git add test.R
git commit -m "Adding file"
git branch newbranch # create new branch
git checkout newbranch # switch to the new branch
vim test.R # edit the file on the new branch
  print("bye") # save with ESC, CTRL+x
cd ..
cat test/test.R
print("bye")
R CMD BATCH test.R # Run the program with an external application
cat test.Rout # observe the output
> print("bye")
[1] "bye"

因此,即使未提交更改,也会使用您正在处理的分支