3

I have 2 branches dev & prod. Would like to copy 1 file from dev to prod.

I'm already on the prod branch on remote server.

So i tried

git checkout dev <file-name>

If i do

git checkout dev -- <file-name>

Then it gives

fatal: invalid reference: dev

Jackson
  • 1,426
  • 3
  • 27
  • 60

1 Answers1

1

You need the checkout the other branch and pull down the changes from the server, before trying to get the file from the other branch.

# checkout other branch
git checkout dev

# pull down changes
git pull

# checkout your working branch
git checkout prod

# checkout file from other branch
git checkout dev -- <file-name>
Preston
  • 7,399
  • 8
  • 54
  • 84